You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
150 lines
5.1 KiB
150 lines
5.1 KiB
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="org.dromara.system.mapper.SysDeptMapper">
|
|
<select id="selectDeptByRoleId" parameterType="Long" resultType="org.dromara.system.domain.vo.SysDeptVo">
|
|
select * from sys_dept d
|
|
inner join sys_role_dept rd on d.dept_id = rd.dept_id
|
|
where d.del_flag = '0' and rd.role_id = #{roleId}
|
|
</select>
|
|
|
|
<select id="selectDeptById" parameterType="string" resultType="org.dromara.system.domain.vo.SysDeptVo">
|
|
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.dept_type,d.creditcode,d.zone, d.zzDisplayPath,
|
|
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
|
|
from sys_dept d
|
|
where d.dept_id = #{deptId}
|
|
</select>
|
|
|
|
<select id="electDeptById" parameterType="string" resultType="org.dromara.system.domain.vo.SysDeptVo">
|
|
select * from sys_dept
|
|
where dept_id = #{deptId}
|
|
</select>
|
|
|
|
<sql id="selectDeptVo">
|
|
select
|
|
d.dept_id as deptId,
|
|
d.parent_id as parentId,
|
|
d.ancestors,
|
|
d.dept_name as deptName,
|
|
d.order_num as orderNum,
|
|
d.leader,
|
|
d.phone,
|
|
d.email,
|
|
d.status,
|
|
d.del_flag as delFlag,
|
|
d.create_by as createBy,
|
|
d.create_time as createTime,
|
|
dept_type as deptType,
|
|
<!-- d.kingdee_org_id as kingdeeOrgId,
|
|
d.kingdee_org_parent_id as kingdeeOrgParentId,-->
|
|
<!--tenant_code as tenantCode,-->
|
|
organizationId,
|
|
organizationParentId,
|
|
zzLevel,
|
|
code,
|
|
mappingUnitParentId,
|
|
updateAt,
|
|
createAt,
|
|
<!-- description,-->
|
|
effectOn,
|
|
sequence,
|
|
isDeleted,
|
|
zzDisplayPath,
|
|
`name`,
|
|
guid,
|
|
zzIsLeaf,
|
|
isDisabled,
|
|
fullname,
|
|
isMappingUnit,
|
|
srzUnitId,
|
|
taskId,
|
|
creditcode,
|
|
zone,
|
|
<!-- simpleName,-->
|
|
<!-- isStatutoryOrg,-->
|
|
<!--isActive,-->
|
|
unitStatusCode,
|
|
unitStatus,
|
|
<!-- unitType,-->
|
|
<!-- xzqhCode-->
|
|
<!-- xzqh,-->
|
|
<!-- isCGManager,
|
|
isBureauOffice,-->
|
|
unitTypeCode
|
|
<!-- dwxzCode,
|
|
dwxz,
|
|
unitSysTypeCode,
|
|
unitSysType,
|
|
dwxtlbms,
|
|
unitLevelCode,
|
|
unitLevel-->
|
|
from
|
|
sys_dept d
|
|
</sql>
|
|
|
|
<select id="selectDepts" parameterType="org.dromara.system.domain.bo.SysDeptBo" resultType="org.dromara.system.domain.vo.SysDeptVo">
|
|
<include refid="selectDeptVo"/>
|
|
where d.del_flag = '0'
|
|
<if test='deptId != null and deptId != ""'>
|
|
AND dept_id = #{deptId}
|
|
</if>
|
|
<if test='parentId != null and parentId != ""'>
|
|
AND parent_id = #{parentId}
|
|
</if>
|
|
<if test="deptName != null and deptName != ''">
|
|
AND dept_name like concat('%', #{deptName}, '%')
|
|
</if>
|
|
<if test="isDeleted != null and isDeleted != ''">
|
|
AND isDeleted = #{isDeleted}
|
|
</if>
|
|
<if test="status != null and status != ''">
|
|
AND status = #{status}
|
|
</if>
|
|
<if test="deptType != null and deptType != ''">
|
|
AND dept_type = #{deptType}
|
|
</if>
|
|
<if test="zoneList != null ">
|
|
AND zone in
|
|
<foreach collection="zoneList" item="item" index="index"
|
|
separator="," open="(" close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="zone != null">
|
|
AND zone = #{zone}
|
|
</if>
|
|
<if test="zzDisplayPath != null and zzDisplayPath != ''">
|
|
AND zzDisplayPath = #{zzDisplayPath}
|
|
</if>
|
|
<!-- 租户数据过滤 -->
|
|
<!-- <if test="tenantCode != null and tenantCode != ''">
|
|
AND d.tenant_code = #{tenantCode}
|
|
</if>-->
|
|
<!-- 数据范围过滤 -->
|
|
<!-- <if test="params.dataScope != null and params.dataScope != ''">
|
|
${params.dataScope}
|
|
</if>
|
|
-->
|
|
order by d.parent_id, d.order_num
|
|
</select>
|
|
|
|
|
|
<select id="selectChildrenDept" parameterType="org.dromara.system.domain.bo.SysDeptBo" resultType="org.dromara.system.domain.vo.SysDeptVo">
|
|
select * from sys_dept where find_in_set(#{deptId}, ancestors)
|
|
<if test="deptType != null">
|
|
AND dept_type = #{deptType}
|
|
</if>
|
|
<if test="status != null">
|
|
AND status = #{status}
|
|
</if>
|
|
<if test="zoneList != null ">
|
|
and creditcode is not null
|
|
AND zone in
|
|
<foreach collection="zoneList" item="item" index="index"
|
|
separator="," open="(" close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
</mapper>
|
|
|