|
|
@ -24,12 +24,33 @@ |
|
|
<result property="kingdeeOrgId" column="kingdee_org_id"/> |
|
|
<result property="kingdeeOrgId" column="kingdee_org_id"/> |
|
|
<result property="kingdeeOrgParentId" column="kingdee_org_parent_id"/> |
|
|
<result property="kingdeeOrgParentId" column="kingdee_org_parent_id"/> |
|
|
<result property="tenantCode" column="tenant_code"/> |
|
|
<result property="tenantCode" column="tenant_code"/> |
|
|
|
|
|
<result property="organizationId" column="organizationId"/> |
|
|
|
|
|
<result property="organizationParentId" column="organizationParentId"/> |
|
|
|
|
|
<result property="zzLevel" column="zzLevel"/> |
|
|
|
|
|
<result property="code" column="code"/> |
|
|
|
|
|
<result property="mappingUnitParentId" column="mappingUnitParentId"/> |
|
|
|
|
|
<result property="updateAt" column="updateAt"/> |
|
|
|
|
|
<result property="createAt" column="createAt"/> |
|
|
|
|
|
<result property="description" column="description"/> |
|
|
|
|
|
<result property="effectOn" column="effectOn"/> |
|
|
|
|
|
<result property="sequence" column="sequence"/> |
|
|
|
|
|
<result property="isDeleted" column="isDeleted"/> |
|
|
|
|
|
<result property="zzDisplayPath" column="zzDisplayPath"/> |
|
|
|
|
|
<result property="name" column="name"/> |
|
|
|
|
|
<result property="guid" column="guid"/> |
|
|
|
|
|
<result property="zzIsLeaf" column="zzIsLeaf"/> |
|
|
|
|
|
<result property="isDisabled" column="isDisabled"/> |
|
|
|
|
|
<result property="fullname" column="fullname"/> |
|
|
|
|
|
<result property="isMappingUnit" column="isMappingUnit"/> |
|
|
|
|
|
<result property="srzUnitId" column="srzUnitId"/> |
|
|
|
|
|
<result property="taskId" column="taskId"/> |
|
|
|
|
|
|
|
|
</resultMap> |
|
|
</resultMap> |
|
|
|
|
|
|
|
|
<sql id="selectDeptVo"> |
|
|
<sql id="selectDeptVo"> |
|
|
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time,dept_type,d.kingdee_org_id,d.kingdee_org_parent_id |
|
|
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time,dept_type,d.kingdee_org_id,d.kingdee_org_parent_id, |
|
|
,tenant_code from sys_dept d |
|
|
tenant_code, organizationId, organizationParentId, zzLevel, code, mappingUnitParentId,updateAt, createAt, description, effectOn, sequence, isDeleted, zzDisplayPath, `name`, guid, zzIsLeaf, isDisabled, |
|
|
|
|
|
fullname, isMappingUnit, srzUnitId, taskId from sys_dept d |
|
|
</sql> |
|
|
</sql> |
|
|
|
|
|
|
|
|
<insert id="insertDeptIsKingDee" parameterType="Dept" keyProperty="deptId" useGeneratedKeys="true"> |
|
|
<insert id="insertDeptIsKingDee" parameterType="Dept" keyProperty="deptId" useGeneratedKeys="true"> |
|
|
@ -37,8 +58,8 @@ |
|
|
SELECT LAST_INSERT_ID() |
|
|
SELECT LAST_INSERT_ID() |
|
|
</selectKey> |
|
|
</selectKey> |
|
|
insert into sys_dept( |
|
|
insert into sys_dept( |
|
|
<if test="deptId != null and deptId != 0">dept_id,</if> |
|
|
<if test="deptId != null and deptId != ''">dept_id,</if> |
|
|
<if test="parentId != null and parentId != 0">parent_id,</if> |
|
|
<if test="parentId != null and parentId != ''">parent_id,</if> |
|
|
<if test="deptName != null and deptName != ''">dept_name,</if> |
|
|
<if test="deptName != null and deptName != ''">dept_name,</if> |
|
|
<if test="ancestors != null and ancestors != ''">ancestors,</if> |
|
|
<if test="ancestors != null and ancestors != ''">ancestors,</if> |
|
|
<if test="orderNum != null and orderNum != ''">order_num,</if> |
|
|
<if test="orderNum != null and orderNum != ''">order_num,</if> |
|
|
@ -53,8 +74,8 @@ |
|
|
<if test="kingdeeOrgParentId != null and kingdeeOrgParentId != ''">kingdee_org_parent_id,</if> |
|
|
<if test="kingdeeOrgParentId != null and kingdeeOrgParentId != ''">kingdee_org_parent_id,</if> |
|
|
create_time |
|
|
create_time |
|
|
)values( |
|
|
)values( |
|
|
<if test="deptId != null and deptId != 0">#{deptId},</if> |
|
|
<if test="deptId != null and deptId != ''">#{deptId},</if> |
|
|
<if test="parentId != null and parentId != 0">#{parentId},</if> |
|
|
<if test="parentId != null and parentId != ''">#{parentId},</if> |
|
|
<if test="deptName != null and deptName != ''">#{deptName},</if> |
|
|
<if test="deptName != null and deptName != ''">#{deptName},</if> |
|
|
<if test="ancestors != null and ancestors != ''">#{ancestors},</if> |
|
|
<if test="ancestors != null and ancestors != ''">#{ancestors},</if> |
|
|
<if test="orderNum != null and orderNum != ''">#{orderNum},</if> |
|
|
<if test="orderNum != null and orderNum != ''">#{orderNum},</if> |
|
|
@ -92,7 +113,7 @@ |
|
|
<select id="selectDeptList" parameterType="Dept" resultMap="DeptResult"> |
|
|
<select id="selectDeptList" parameterType="Dept" resultMap="DeptResult"> |
|
|
<include refid="selectDeptVo"/> |
|
|
<include refid="selectDeptVo"/> |
|
|
where d.del_flag = '0' |
|
|
where d.del_flag = '0' |
|
|
<if test="parentId != null and parentId != 0"> |
|
|
<if test="parentId != null and parentId != ''"> |
|
|
AND parent_id = #{parentId} |
|
|
AND parent_id = #{parentId} |
|
|
</if> |
|
|
</if> |
|
|
<if test="deptName != null and deptName != ''"> |
|
|
<if test="deptName != null and deptName != ''"> |
|
|
@ -116,7 +137,7 @@ |
|
|
<select id="selectDeptListByNoPermission" parameterType="Dept" resultMap="DeptResult"> |
|
|
<select id="selectDeptListByNoPermission" parameterType="Dept" resultMap="DeptResult"> |
|
|
<include refid="selectDeptVo"/> |
|
|
<include refid="selectDeptVo"/> |
|
|
where d.del_flag = '0' |
|
|
where d.del_flag = '0' |
|
|
<if test="parentId != null and parentId != 0"> |
|
|
<if test="parentId != null and parentId != ''"> |
|
|
AND parent_id = #{parentId} |
|
|
AND parent_id = #{parentId} |
|
|
</if> |
|
|
</if> |
|
|
<if test="deptName != null and deptName != ''"> |
|
|
<if test="deptName != null and deptName != ''"> |
|
|
@ -135,8 +156,8 @@ |
|
|
<select id="selectDeptCount" parameterType="Dept" resultType="int"> |
|
|
<select id="selectDeptCount" parameterType="Dept" resultType="int"> |
|
|
select count(1) from sys_dept |
|
|
select count(1) from sys_dept |
|
|
where del_flag = '0' |
|
|
where del_flag = '0' |
|
|
<if test="deptId != null and deptId != 0">and dept_id = #{deptId}</if> |
|
|
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if> |
|
|
<if test="parentId != null and parentId != 0">and parent_id = #{parentId}</if> |
|
|
<if test="parentId != null and parentId != ''">and parent_id = #{parentId}</if> |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="checkDeptNameUnique" resultMap="DeptResult"> |
|
|
<select id="checkDeptNameUnique" resultMap="DeptResult"> |
|
|
@ -151,7 +172,16 @@ |
|
|
where d.dept_id = #{deptId} |
|
|
where d.dept_id = #{deptId} |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="selectChildrenDeptById" parameterType="Long" resultMap="DeptResult"> |
|
|
<select id="selectDeptByOrganizationId" parameterType="String" resultMap="DeptResult"> |
|
|
|
|
|
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, |
|
|
|
|
|
(select dept_name from sys_dept where organizationId = d.organizationParentId) parent_name, d.organizationId, d.organizationParentId, |
|
|
|
|
|
d.zzLevel, d.code, d.mappingUnitParentId, d.updateAt, d.createAt, d.description, d.effectOn, d.sequence, d.isDeleted, |
|
|
|
|
|
d.zzDisplayPath, d.`name`, d.guid, d.zzIsLeaf, d.isDisabled, d.fullname, d.isMappingUnit, d.srzUnitId, d.taskId |
|
|
|
|
|
from sys_dept d |
|
|
|
|
|
where d.organizationId = #{organizationId} |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="selectChildrenDeptById" parameterType="String" resultMap="DeptResult"> |
|
|
select * from sys_dept where find_in_set(#{deptId}, ancestors) |
|
|
select * from sys_dept where find_in_set(#{deptId}, ancestors) |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
@ -179,8 +209,8 @@ |
|
|
|
|
|
|
|
|
<insert id="insertDept" parameterType="Dept" keyProperty="deptId" useGeneratedKeys="true"> |
|
|
<insert id="insertDept" parameterType="Dept" keyProperty="deptId" useGeneratedKeys="true"> |
|
|
insert into sys_dept( |
|
|
insert into sys_dept( |
|
|
<if test="deptId != null and deptId != 0">dept_id,</if> |
|
|
<if test="deptId != null and deptId != ''">dept_id,</if> |
|
|
<if test="parentId != null and parentId != 0">parent_id,</if> |
|
|
<if test="parentId != null and parentId != ''">parent_id,</if> |
|
|
<if test="deptName != null and deptName != ''">dept_name,</if> |
|
|
<if test="deptName != null and deptName != ''">dept_name,</if> |
|
|
<if test="ancestors != null and ancestors != ''">ancestors,</if> |
|
|
<if test="ancestors != null and ancestors != ''">ancestors,</if> |
|
|
<if test="orderNum != null and orderNum != ''">order_num,</if> |
|
|
<if test="orderNum != null and orderNum != ''">order_num,</if> |
|
|
@ -193,10 +223,29 @@ |
|
|
<if test="kingdeeOrgId != null and kingdeeOrgId != ''">kingdee_org_id,</if> |
|
|
<if test="kingdeeOrgId != null and kingdeeOrgId != ''">kingdee_org_id,</if> |
|
|
<if test="kingdeeOrgParentId != null and kingdeeOrgParentId != ''">kingdee_org_parent_id,</if> |
|
|
<if test="kingdeeOrgParentId != null and kingdeeOrgParentId != ''">kingdee_org_parent_id,</if> |
|
|
<if test="tenantCode != null and tenantCode != ''">tenant_code,</if> |
|
|
<if test="tenantCode != null and tenantCode != ''">tenant_code,</if> |
|
|
|
|
|
<if test="organizationId != null and organizationId != ''">organizationId,</if> |
|
|
|
|
|
<if test="zzLevel != null and zzLevel != ''">zzLevel,</if> |
|
|
|
|
|
<if test="code != null and code != ''">code,</if> |
|
|
|
|
|
<if test="mappingUnitParentId != null and mappingUnitParentId != ''">mappingUnitParentId,</if> |
|
|
|
|
|
<if test="updateAt != null and updateAt != ''">updateAt,</if> |
|
|
|
|
|
<if test="createAt != null and createAt != ''">createAt,</if> |
|
|
|
|
|
<if test="description != null and description != ''">description,</if> |
|
|
|
|
|
<if test="effectOn != null and effectOn != ''">effectOn,</if> |
|
|
|
|
|
<if test="sequence != null and sequence != ''">sequence,</if> |
|
|
|
|
|
<if test="isDeleted != null and isDeleted != ''">isDeleted,</if> |
|
|
|
|
|
<if test="zzDisplayPath != null and zzDisplayPath != ''">zzDisplayPath,</if> |
|
|
|
|
|
<if test="name != null and name != ''">`name`,</if> |
|
|
|
|
|
<if test="guid != null and guid != ''">guid,</if> |
|
|
|
|
|
<if test="zzIsLeaf != null and zzIsLeaf != ''">zzIsLeaf,</if> |
|
|
|
|
|
<if test="isDisabled != null and isDisabled != ''">isDisabled,</if> |
|
|
|
|
|
<if test="fullname != null and fullname != ''">fullname,</if> |
|
|
|
|
|
<if test="isMappingUnit != null and isMappingUnit != ''">isMappingUnit,</if> |
|
|
|
|
|
<if test="srzUnitId != null and srzUnitId != ''">srzUnitId,</if> |
|
|
|
|
|
<if test="taskId != null and taskId != ''">taskId,</if> |
|
|
create_time |
|
|
create_time |
|
|
)values( |
|
|
)values( |
|
|
<if test="deptId != null and deptId != 0">#{deptId},</if> |
|
|
<if test="deptId != null and deptId != ''">#{deptId},</if> |
|
|
<if test="parentId != null and parentId != 0">#{parentId},</if> |
|
|
<if test="parentId != null and parentId != ''">#{parentId},</if> |
|
|
<if test="deptName != null and deptName != ''">#{deptName},</if> |
|
|
<if test="deptName != null and deptName != ''">#{deptName},</if> |
|
|
<if test="ancestors != null and ancestors != ''">#{ancestors},</if> |
|
|
<if test="ancestors != null and ancestors != ''">#{ancestors},</if> |
|
|
<if test="orderNum != null and orderNum != ''">#{orderNum},</if> |
|
|
<if test="orderNum != null and orderNum != ''">#{orderNum},</if> |
|
|
@ -209,6 +258,25 @@ |
|
|
<if test="kingdeeOrgId != null and kingdeeOrgId != ''">#{kingdeeOrgId},</if> |
|
|
<if test="kingdeeOrgId != null and kingdeeOrgId != ''">#{kingdeeOrgId},</if> |
|
|
<if test="kingdeeOrgParentId != null and kingdeeOrgParentId != ''">#{kingdeeOrgParentId},</if> |
|
|
<if test="kingdeeOrgParentId != null and kingdeeOrgParentId != ''">#{kingdeeOrgParentId},</if> |
|
|
<if test="tenantCode != null and tenantCode != ''">#{tenantCode},</if> |
|
|
<if test="tenantCode != null and tenantCode != ''">#{tenantCode},</if> |
|
|
|
|
|
<if test="organizationId != null and organizationId != ''">#{organizationId},</if> |
|
|
|
|
|
<if test="zzLevel != null and zzLevel != ''">#{zzLevel},</if> |
|
|
|
|
|
<if test="code != null and code != ''">#{code},</if> |
|
|
|
|
|
<if test="mappingUnitParentId != null and mappingUnitParentId != ''">#{mappingUnitParentId},</if> |
|
|
|
|
|
<if test="updateAt != null and updateAt != ''">#{updateAt},</if> |
|
|
|
|
|
<if test="createAt != null and createAt != ''">#{createAt},</if> |
|
|
|
|
|
<if test="description != null and description != ''">#{description},</if> |
|
|
|
|
|
<if test="effectOn != null and effectOn != ''">#{effectOn},</if> |
|
|
|
|
|
<if test="sequence != null and sequence != ''">#{sequence},</if> |
|
|
|
|
|
<if test="isDeleted != null and isDeleted != ''">#{isDeleted},</if> |
|
|
|
|
|
<if test="zzDisplayPath != null and zzDisplayPath != ''">#{zzDisplayPath},</if> |
|
|
|
|
|
<if test="name != null and name != ''">#{name},</if> |
|
|
|
|
|
<if test="guid != null and guid != ''">#{guid},</if> |
|
|
|
|
|
<if test="zzIsLeaf != null and zzIsLeaf != ''">#{zzIsLeaf},</if> |
|
|
|
|
|
<if test="isDisabled != null and isDisabled != ''">#{isDisabled},</if> |
|
|
|
|
|
<if test="fullname != null and fullname != ''">#{fullname},</if> |
|
|
|
|
|
<if test="isMappingUnit != null and isMappingUnit != ''">#{isMappingUnit},</if> |
|
|
|
|
|
<if test="srzUnitId != null and srzUnitId != ''">#{srzUnitId},</if> |
|
|
|
|
|
<if test="taskId != null and taskId != ''">#{taskId},</if> |
|
|
sysdate() |
|
|
sysdate() |
|
|
) |
|
|
) |
|
|
</insert> |
|
|
</insert> |
|
|
@ -216,7 +284,7 @@ |
|
|
<update id="updateDept" parameterType="Dept"> |
|
|
<update id="updateDept" parameterType="Dept"> |
|
|
update sys_dept |
|
|
update sys_dept |
|
|
<set> |
|
|
<set> |
|
|
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if> |
|
|
<if test="parentId != null and parentId != ''">parent_id = #{parentId},</if> |
|
|
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if> |
|
|
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if> |
|
|
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if> |
|
|
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if> |
|
|
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if> |
|
|
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if> |
|
|
@ -234,6 +302,47 @@ |
|
|
where dept_id = #{deptId} |
|
|
where dept_id = #{deptId} |
|
|
</update> |
|
|
</update> |
|
|
|
|
|
|
|
|
|
|
|
<update id="updateDeptByOrganizationId" parameterType="Dept"> |
|
|
|
|
|
update sys_dept |
|
|
|
|
|
<set> |
|
|
|
|
|
<if test="parentId != null and parentId != ''">parent_id = #{parentId},</if> |
|
|
|
|
|
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if> |
|
|
|
|
|
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if> |
|
|
|
|
|
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if> |
|
|
|
|
|
<if test="leader != null">leader = #{leader},</if> |
|
|
|
|
|
<if test="phone != null">phone = #{phone},</if> |
|
|
|
|
|
<if test="email != null">email = #{email},</if> |
|
|
|
|
|
<if test="deptType != null">dept_type = #{deptType},</if> |
|
|
|
|
|
<if test="status != null and status != ''">status = #{status},</if> |
|
|
|
|
|
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if> |
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
|
|
|
|
|
<if test="kingdeeOrgId != null and kingdeeOrgId != ''">kingdee_org_id = #{kingdeeOrgId},</if> |
|
|
|
|
|
<if test="kingdeeOrgParentId != null and kingdeeOrgParentId != ''">kingdee_org_parent_id = #{kingdeeOrgParentId},</if> |
|
|
|
|
|
<if test="organizationId != null and organizationId != ''">organizationId = #{organizationId},</if> |
|
|
|
|
|
<if test="organizationParentId != null and organizationParentId != ''">organizationParentId = #{organizationParentId},</if> |
|
|
|
|
|
<if test="zzLevel != null and zzLevel != ''">zzLevel = #{zzLevel},</if> |
|
|
|
|
|
<if test="code != null and code != ''">code = #{code},</if> |
|
|
|
|
|
<if test="mappingUnitParentId != null and mappingUnitParentId != ''">mappingUnitParentId = #{mappingUnitParentId},</if> |
|
|
|
|
|
<if test="updateAt != null and updateAt != ''">updateAt = #{updateAt},</if> |
|
|
|
|
|
<if test="createAt != null and createAt != ''">createAt = #{createAt},</if> |
|
|
|
|
|
<if test="description != null and description != ''">description = #{description},</if> |
|
|
|
|
|
<if test="effectOn != null and effectOn != ''">effectOn = #{effectOn},</if> |
|
|
|
|
|
<if test="sequence != null and sequence != ''">sequence = #{sequence},</if> |
|
|
|
|
|
<if test="isDeleted != null and isDeleted != ''">isDeleted = #{isDeleted},</if> |
|
|
|
|
|
<if test="zzDisplayPath != null and zzDisplayPath != ''">zzDisplayPath = #{zzDisplayPath},</if> |
|
|
|
|
|
<if test="name != null and name != ''">`name` = #{name},</if> |
|
|
|
|
|
<if test="guid != null and guid != ''">guid = #{guid},</if> |
|
|
|
|
|
<if test="zzIsLeaf != null and zzIsLeaf != ''">zzIsLeaf = #{zzIsLeaf},</if> |
|
|
|
|
|
<if test="isDisabled != null and isDisabled != ''">isDisabled = #{isDisabled},</if> |
|
|
|
|
|
<if test="fullname != null and fullname != ''">fullname = #{fullname},</if> |
|
|
|
|
|
<if test="isMappingUnit != null and isMappingUnit != ''">isMappingUnit = #{isMappingUnit},</if> |
|
|
|
|
|
<if test="srzUnitId != null and srzUnitId != ''">srzUnitId = #{srzUnitId},</if> |
|
|
|
|
|
<if test="taskId != null and taskId != ''">taskId = #{taskId},</if> |
|
|
|
|
|
update_time = sysdate() |
|
|
|
|
|
</set> |
|
|
|
|
|
where organizationId = #{organizationId} |
|
|
|
|
|
</update> |
|
|
|
|
|
|
|
|
<update id="updateDeptChildren" parameterType="java.util.List"> |
|
|
<update id="updateDeptChildren" parameterType="java.util.List"> |
|
|
update sys_dept set ancestors = |
|
|
update sys_dept set ancestors = |
|
|
<foreach collection="depts" item="item" index="index" |
|
|
<foreach collection="depts" item="item" index="index" |
|
|
@ -268,7 +377,7 @@ |
|
|
<select id="selectDeptListHole" parameterType="Dept" resultMap="DeptResult"> |
|
|
<select id="selectDeptListHole" parameterType="Dept" resultMap="DeptResult"> |
|
|
<include refid="selectDeptVo"/> |
|
|
<include refid="selectDeptVo"/> |
|
|
where d.del_flag = '0' |
|
|
where d.del_flag = '0' |
|
|
<if test="deptId != null and deptId != 0"> |
|
|
<if test="deptId != null and deptId != ''"> |
|
|
AND find_in_set(#{deptId}, ancestors) |
|
|
AND find_in_set(#{deptId}, ancestors) |
|
|
</if> |
|
|
</if> |
|
|
</select> |
|
|
</select> |
|
|
|