|
|
@@ -9,6 +9,7 @@
|
|
|
su.id as "userId",
|
|
|
su.name as "userName",
|
|
|
sd.id as "deptId",
|
|
|
+ su.leader_name as "leaderName",
|
|
|
IFNULL(a.sumpremium,0) as "sumpremium",
|
|
|
IFNULL(a.jqpremium,0) as "jqpremium",
|
|
|
IFNULL(a.sypremium,0) as "sypremium",
|
|
|
@@ -17,6 +18,7 @@
|
|
|
sd.management_source as "managementSource"
|
|
|
from sys_user su
|
|
|
left join sys_dept sd on sd.id =su.dept_id
|
|
|
+ LEFT JOIN sys_user_role sur ON sur.user_id = su.id
|
|
|
left join (
|
|
|
select
|
|
|
io.userid as "userId",
|
|
|
@@ -56,6 +58,17 @@
|
|
|
and sd.management_source=#{vo.managementSource}
|
|
|
</if>
|
|
|
|
|
|
+ <choose>
|
|
|
+ <when test='vo.managementSource == "2"'>
|
|
|
+ and (sur.role_id = 20 or sur.role_id = 21)
|
|
|
+ </when>
|
|
|
+ <when test='vo.managementSource == "1"'>
|
|
|
+ and (sur.role_id = 19 or sur.role_id = 21)
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
<if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
|
|
|
AND sd.id in
|
|
|
<foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
|
|
|
@@ -75,6 +88,7 @@
|
|
|
COUNT(0)
|
|
|
from sys_user su
|
|
|
left join sys_dept sd on sd.id =su.dept_id
|
|
|
+ LEFT JOIN sys_user_role sur ON sur.user_id = su.id
|
|
|
<where>
|
|
|
1=1
|
|
|
<if test="vo.userId !=null and vo.userId!=''">
|
|
|
@@ -104,6 +118,16 @@
|
|
|
<if test="vo.deptId !=null and vo.deptId!=''">
|
|
|
and sd.id like concat('%',#{vo.deptId},'%')
|
|
|
</if>
|
|
|
+ <choose>
|
|
|
+ <when test='vo.managementSource == "2"'>
|
|
|
+ and (sur.role_id = 20 or sur.role_id = 21)
|
|
|
+ </when>
|
|
|
+ <when test='vo.managementSource == "1"'>
|
|
|
+ and (sur.role_id = 19 or sur.role_id = 21)
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
</where>
|
|
|
</select>
|
|
|
|