|
@@ -20,6 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="createTime" column="create_time" />
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
+ <result property="tenantId" column="tenant_id" />
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectDeptVo">
|
|
@@ -38,6 +39,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
AND dept_name like concat('%', #{deptName}, '%')
|
|
|
</if>
|
|
|
+ <if test="tenantId != null and tenantId != '' and tenantId != 0">
|
|
|
+ AND tenant_id = #{tenantId}
|
|
|
+ </if>
|
|
|
<if test="status != null and status != ''">
|
|
|
AND status = #{status}
|
|
|
</if>
|
|
@@ -76,12 +80,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</select>
|
|
|
|
|
|
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
|
|
|
- select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
|
|
|
+ select count(*) from sys_dept where status = 0 and del_flag = '0'
|
|
|
+ <if test="tenantId != null and tenantId != 0">
|
|
|
+ and tenant_id = #{tenantId}
|
|
|
+ </if>
|
|
|
+ and find_in_set(#{deptId}, ancestors)
|
|
|
</select>
|
|
|
|
|
|
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
|
|
|
<include refid="selectDeptVo"/>
|
|
|
- where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
|
|
+ where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0'
|
|
|
+ <if test="tenantId != null and tenantId != 0">
|
|
|
+ and tenant_id = #{tenantId}
|
|
|
+ </if>
|
|
|
+ limit 1
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertDept" parameterType="com.usky.system.domain.SysDept">
|
|
@@ -96,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="email != null and email != ''">email,</if>
|
|
|
<if test="status != null">status,</if>
|
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
|
+ <if test="tenantId != null and tenantId != '' and tenantId != 0">tenant_id,</if>
|
|
|
create_time
|
|
|
)values(
|
|
|
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
|
@@ -108,6 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="email != null and email != ''">#{email},</if>
|
|
|
<if test="status != null">#{status},</if>
|
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
+ <if test="tenantId != null and tenantId != '' and tenantId != 0">#{tenantId},</if>
|
|
|
sysdate()
|
|
|
)
|
|
|
</insert>
|