员工加角色完成
This commit is contained in:
parent
3addbe0b9b
commit
f6bc245454
@ -25,45 +25,47 @@
|
||||
<result property="roleNames" column="role_names"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_SQL">
|
||||
SELECT cs.id AS cs_id,
|
||||
cs.corp_id AS cs_corp_id,
|
||||
cs.user_id AS cs_user_id,
|
||||
cs.dept_id AS cs_dept_id,
|
||||
cs.work_no AS cs_work_no,
|
||||
cs.name AS cs_name,
|
||||
cs.tel AS cs_tel,
|
||||
cs.sex AS cs_sex,
|
||||
cs.address AS cs_address,
|
||||
cs.work_date AS cs_work_date,
|
||||
cs.work_year AS cs_work_year,
|
||||
cs.joined_date AS cs_joined_date,
|
||||
cs.joined_year AS cs_joined_year,
|
||||
cs.education AS cs_education,
|
||||
cs.content AS cs_content,
|
||||
cs.unique_code AS cs_unique_code,
|
||||
cs.file_urls AS cs_file_urls,
|
||||
rn.role_names AS role_names
|
||||
FROM company_staff cs
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT cs.user_id,
|
||||
sr.id,
|
||||
GROUP_CONCAT(DISTINCT sr.name ORDER BY sr.name SEPARATOR ',') AS role_names
|
||||
FROM company_staff cs
|
||||
LEFT JOIN
|
||||
system_user_role sur ON cs.user_id = sur.user_id
|
||||
LEFT JOIN
|
||||
system_role sr ON sur.role_id = sr.id
|
||||
WHERE cs.deleted = '0'
|
||||
AND sur.deleted = '0'
|
||||
GROUP BY cs.user_id
|
||||
) rn ON cs.user_id = rn.user_id
|
||||
WHERE cs.deleted = '0'
|
||||
</sql>
|
||||
|
||||
<select id="selectListPage" resultMap="BaseResultMap">
|
||||
<include refid="Base_SQL"/>
|
||||
SELECT cs.id AS cs_id,
|
||||
cs.corp_id AS cs_corp_id,
|
||||
cs.user_id AS cs_user_id,
|
||||
cs.dept_id AS cs_dept_id,
|
||||
cs.work_no AS cs_work_no,
|
||||
cs.name AS cs_name,
|
||||
cs.tel AS cs_tel,
|
||||
cs.sex AS cs_sex,
|
||||
cs.address AS cs_address,
|
||||
cs.work_date AS cs_work_date,
|
||||
cs.work_year AS cs_work_year,
|
||||
cs.joined_date AS cs_joined_date,
|
||||
cs.joined_year AS cs_joined_year,
|
||||
cs.education AS cs_education,
|
||||
cs.content AS cs_content,
|
||||
cs.unique_code AS cs_unique_code,
|
||||
cs.file_urls AS cs_file_urls,
|
||||
rn.role_names AS role_names
|
||||
FROM company_staff cs
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT cs.user_id,
|
||||
sr.id,
|
||||
GROUP_CONCAT(DISTINCT sr.name ORDER BY sr.name SEPARATOR ',') AS role_names
|
||||
FROM company_staff cs
|
||||
LEFT JOIN
|
||||
system_user_role sur ON cs.user_id = sur.user_id
|
||||
LEFT JOIN
|
||||
system_role sr ON sur.role_id = sr.id
|
||||
WHERE cs.deleted = '0'
|
||||
AND sur.deleted = '0'
|
||||
<if test="map.roleIds != null and map.roleIds.size > 0">
|
||||
and sr.id in
|
||||
<foreach collection="map.roleIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY cs.user_id
|
||||
) rn ON cs.user_id = rn.user_id
|
||||
WHERE cs.deleted = '0'
|
||||
<if test="map.name != null and map.name != ''">
|
||||
and cs.name like concat('%', #{map.name}, '%')
|
||||
</if>
|
||||
@ -98,10 +100,7 @@
|
||||
and cs.joined_date between #{map.joinedDateArray[0]} and #{map.joinedDateArray[1]}
|
||||
</if>
|
||||
<if test="map.roleIds != null and map.roleIds.size > 0">
|
||||
and rn.id in
|
||||
<foreach collection="map.roleIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
and rn.role_names is not null
|
||||
</if>
|
||||
order by cs.create_time desc
|
||||
</select>
|
||||
|
Loading…
Reference in New Issue
Block a user