优化部分查询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>