<?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.jeecg.modules.base.mapper.WorkCenterUserMapper">
|
<select id="listByWorkCenterId" resultType="Map">
|
select
|
t1.id id,
|
t2.id userId,
|
t2.realname realName,
|
t3.depart_name departName
|
from mom_base_work_center_user t1
|
left join (select * from sys_user where del_flag=0) t2
|
on t1.user_id = t2.id
|
left join (select * from sys_depart where del_flag=0) t3
|
on t2.depart_id = t3.id
|
where t1.work_center_id =#{workCenterId}
|
and t1.del_flag=0
|
</select>
|
<select id="listByEnterpriseId" resultType="Map">
|
select
|
t1.id id,
|
t1.username userName,
|
t1.realname realName,
|
t2.depart_name departName
|
from sys_user t1
|
left join (select * from sys_depart where del_flag=0) t2
|
on t1.depart_id=t2.id
|
where t1.del_flag=0
|
and t1.enterprise_id=#{enterpriseId}
|
<if test="userIdList != null and userIdList.size > 0">
|
and t1.id not in (
|
select id from sys_user where del_flag=0 and id in
|
<foreach collection="userIdList" open="(" separator="," close=")" item="uid">
|
#{uid}
|
</foreach>
|
)
|
</if>
|
<if test="departIds != null and departIds.size > 0">
|
and t1.depart_id not in
|
<foreach collection="departIds" open="(" separator="," close=")" item="did">
|
#{did}
|
</foreach>
|
</if>
|
</select>
|
<select id="getAddUserList" resultType="Map">
|
select
|
t1.id id,
|
t1.username userName,
|
t1.realname realName,
|
t2.depart_name departName
|
from sys_user t1
|
left join (select * from sys_depart where del_flag=0) t2
|
on t1.depart_id=t2.id
|
where t1.del_flag=0
|
and t1.depart_id=#{departId}
|
<if test="userIdList != null and userIdList.size > 0">
|
and t1.id not in (
|
select id from sys_user where del_flag=0 and id in
|
<foreach collection="userIdList" open="(" separator="," close=")" item="uid">
|
#{uid}
|
</foreach>
|
)
|
</if>
|
</select>
|
<select id="getUserList" resultType="Map">
|
select
|
t1.id id,
|
t1.username userName,
|
t1.realname realName,
|
t2.depart_name departName
|
from sys_user t1
|
left join (select * from sys_depart where del_flag=0) t2
|
on t1.depart_id=t2.id
|
where t1.del_flag=0
|
and t1.depart_id in
|
(
|
SELECT
|
id
|
FROM
|
(
|
SELECT
|
t4.id,
|
IF
|
( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), - 1 ) AS ischild
|
FROM
|
( SELECT id, parent_id FROM sys_depart WHERE del_flag = 0 ) t4,
|
( SELECT @pids := #{parentId} ) t5
|
) t6
|
WHERE
|
ischild != -1
|
)
|
and t1.id in (#{parentId})
|
<if test="userIdList != null and userIdList.size > 0">
|
and t1.id not in (
|
select id from sys_user where del_flag=0 and id in
|
<foreach collection="userIdList" open="(" separator="," close=")" item="uid">
|
#{uid}
|
</foreach>
|
)
|
</if>
|
</select>
|
<select id="getAddDepartTree" resultType="org.jeecg.common.system.vo.SelectTreeModel">
|
select
|
id as "key",
|
depart_name as "title",
|
parent_id as parentId
|
from sys_depart
|
where parent_id = #{parentId}
|
and id != #{departId}
|
and version = #{version}
|
and del_flag='0'
|
</select>
|
</mapper>
|