优化部分查询SQL

This commit is contained in:
wangchl
2018-08-06 11:42:15 +08:00
parent 127b532825
commit db8f960b0d
10 changed files with 26 additions and 16 deletions

View File

@@ -41,11 +41,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(*) from sys_user where dept_id = #{deptId} and del_flag = '0'
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
</select>
<select id="selectDeptCount" parameterType="Dept" resultType="int">
select count(*) from sys_dept
select count(1) from sys_dept
<where>
<if test="deptId != null and deptId != 0"> and dept_id = #{deptId} </if>
<if test="parentId != null and parentId != 0"> and parent_id = #{parentId} </if>

View File

@@ -55,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="countDictDataByType" resultType="Integer">
select count(*) from sys_dict_data where dict_type=#{dictType}
select count(1) from sys_dict_data where dict_type=#{dictType}
</select>
<delete id="deleteDictDataById" parameterType="Long">

View File

@@ -80,7 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectCountMenuByParentId" resultType="Integer">
select count(*) from sys_menu where parent_id=#{menuId}
select count(1) from sys_menu where parent_id=#{menuId}
</select>
<select id="checkMenuNameUnique" parameterType="String" resultMap="MenuResult">

View File

@@ -14,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<select id="selectCountRoleMenuByMenuId" resultType="Integer">
select count(*) from sys_role_menu where menu_id=#{menuId}
select count(1) from sys_role_menu where menu_id=#{menuId}
</select>
<delete id="deleteRoleMenu" parameterType="Long">

View File

@@ -83,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="checkLoginNameUnique" parameterType="String" resultType="int">
select count(*) from sys_user where login_name=#{loginName}
select count(1) from sys_user where login_name=#{loginName}
</select>
<select id="checkPhoneUnique" parameterType="String" resultMap="UserResult">

View File

@@ -14,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<select id="countUserPostById" resultType="Integer">
select count(*) from sys_user_post where post_id=#{postId}
select count(1) from sys_user_post where post_id=#{postId}
</select>
<delete id="deleteUserPost" parameterType="Long">

View File

@@ -14,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<select id="countUserRoleByRoleId" resultType="Integer">
select count(*) from sys_user_role where role_id=#{roleId}
select count(1) from sys_user_role where role_id=#{roleId}
</select>
<delete id="deleteUserRole" parameterType="Long">