|
@@ -75,9 +75,9 @@
|
|
|
<!-- SQL片段:getUserByOrgCode 的 FROM 和 WHERE 部分 -->
|
|
|
<sql id="getUserByOrgCodeFromSql">
|
|
|
FROM
|
|
|
- sys_depart
|
|
|
- INNER JOIN sys_user_depart ON sys_user_depart.dep_id = sys_depart.id
|
|
|
- INNER JOIN sys_user ON sys_user.id = sys_user_depart.user_id
|
|
|
+ sys_user
|
|
|
+ INNER JOIN sys_user_depart ON sys_user.id = sys_user_depart.user_id
|
|
|
+ INNER JOIN sys_depart ON sys_user_depart.dep_id = sys_depart.id
|
|
|
WHERE
|
|
|
<if test="orgCode == null">
|
|
|
<bind name="bindOrgCode" value="'%'"/>
|
|
@@ -100,21 +100,43 @@
|
|
|
<!-- 根据 orgCode 查询用户,包括子部门下的用户 -->
|
|
|
<select id="getUserByOrgCode" resultType="org.jeecg.modules.system.model.SysUserSysDepartModel">
|
|
|
SELECT
|
|
|
- sys_user.id AS id,
|
|
|
- sys_user.realname AS realname,
|
|
|
- sys_user.avatar AS avatar,
|
|
|
- sys_user.sex AS sex,
|
|
|
- sys_user.birthday AS birthday,
|
|
|
- sys_user.work_no AS workNo,
|
|
|
- sys_user.post AS post,
|
|
|
- sys_user.telephone AS telephone,
|
|
|
- sys_user.email AS email,
|
|
|
- sys_user.phone AS phone,
|
|
|
- sys_depart.id AS departId,
|
|
|
- sys_depart.depart_name AS departName
|
|
|
+ id,
|
|
|
+ realname,
|
|
|
+ avatar,
|
|
|
+ sex,
|
|
|
+ birthday,
|
|
|
+ workNo,
|
|
|
+ post,
|
|
|
+ telephone,
|
|
|
+ email,
|
|
|
+ phone,
|
|
|
+ GROUP_CONCAT( DISTINCT departName ORDER BY orgCode ASC SEPARATOR ' | ' ) AS departName,
|
|
|
+ GROUP_CONCAT( DISTINCT departId ORDER BY orgCode ASC SEPARATOR ' | ' ) AS departId
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ sys_user.id AS id,
|
|
|
+ sys_user.realname AS realname,
|
|
|
+ sys_user.avatar AS avatar,
|
|
|
+ sys_user.sex AS sex,
|
|
|
+ sys_user.birthday AS birthday,
|
|
|
+ sys_user.work_no AS workNo,
|
|
|
+ sys_user.post AS post,
|
|
|
+ sys_user.telephone AS telephone,
|
|
|
+ sys_user.email AS email,
|
|
|
+ sys_user.phone AS phone,
|
|
|
+ sys_user.create_time AS createTime,
|
|
|
+ sys_depart.id AS departId,
|
|
|
+ sys_depart.depart_name AS departName,
|
|
|
+ sys_depart.org_code orgCode
|
|
|
<include refid="getUserByOrgCodeFromSql"/>
|
|
|
+ ) u
|
|
|
+ GROUP BY
|
|
|
+ u.id,
|
|
|
+ u.realname,
|
|
|
+ u.createTime
|
|
|
ORDER BY
|
|
|
- sys_depart.org_code ASC
|
|
|
+ u.createTime DESC
|
|
|
</select>
|
|
|
|
|
|
<!-- 查询 getUserByOrgCode 的总数-->
|