@ -303,10 +303,10 @@
LEFT JOIN qc_sampling_inspection_level as qsil ON qsip.sampling_level_no = qsil.sampling_level_no and qsip.site = qsil.site and qsip.bu_no = qsil.bu_no
<where >
qsip.site = #{query.site}
and (qsip.bu_no) in (select * from dbo.query_bu(#{query.userName}))
<if test= "query.buDesc != null and query.buDesc != ''" >
AND dbo.get_bu_desc ( qsip.site, qsip.bu_no ) = #{query.buDesc}
</if >
<!-- and (qsip.bu_no) in (select * from dbo.query_bu(#{query.userName})) -->
<!-- <if test="query.buDesc != null and query.buDesc != ''"> -- >
<!-- AND dbo.get_bu_desc ( qsip.site, qsip.bu_no ) = #{query.buDesc} -->
<!-- </if> -- >
<if test= "query.samplingQtyDesc != null and query.samplingQtyDesc != ''" >
AND qsiq.sampling_qty_desc LIKE '%' + #{query.samplingQtyDesc}+'%'
</if>
@ -4966,35 +4966,65 @@
</select>
<select id= "getCheckerList" resultType= "com.xujie.modules.qms.data.EamAdminData" parameterType= "com.xujie.modules.qms.data.EamAdminData" >
SELECT
a.user_id,
a.username as adminID,
a.email,
a.mobile as phone,
a.user_display as adminName,
dbo.get_bu_desc(c.site,c.bu_no) as buDesc,
d.role_id,
e.role_name
FROM sys_user as a
LEFT JOIN eam_access_site as b on a.username = b.username
LEFT JOIN AccessBu as c on b.username = c.username and b.site = c.site
LEFT JOIN sys_user_role as d on a.user_id = d.user_id
LEFT JOIN sys_role as e on d.role_id = e.role_id
<where >
b.site = #{site} and c.bu_no = #{buNo}
<if test= "adminID != null and adminID != ''" >
AND a.username LIKE '%' + #{adminID}+'%'
</if>
<if test= "adminName != null and adminName != ''" >
AND a.user_display LIKE '%' + #{adminName}+'%'
</if>
<if test= "buDesc != null and buDesc != ''" >
AND dbo.get_bu_desc(a.site,c.bu_no) LIKE '%' + #{buDesc} + '%'
</if>
<if test= "roleId != null and roleId != ''" >
AND d.role_id = #{roleId}
</if>
</where>
<choose >
<!-- 协同人员:按部门成员,不关联角色,避免一人多角色重复 -->
<when test= "department != null and department != ''" >
SELECT
a.user_id,
a.username as adminID,
a.email,
a.mobile as phone,
a.user_display as adminName,
dbo.get_bu_desc(ad.site, ad.bu_no) as buDesc,
ad.department_id as department,
ISNULL(dept.department_name, '') as departmentName
FROM Access_dept ad
INNER JOIN sys_user a ON a.username = ad.username
LEFT JOIN sys_department dept ON dept.site = ad.site AND dept.bu_no = ad.bu_no AND dept.department_id = ad.department_id
WHERE ad.site = #{site}
AND ad.department_id = #{department}
<if test= "adminID != null and adminID != ''" >
AND a.username LIKE '%' + #{adminID}+'%'
</if>
<if test= "adminName != null and adminName != ''" >
AND a.user_display LIKE '%' + #{adminName}+'%'
</if>
ORDER BY a.username
</when>
<otherwise >
SELECT DISTINCT
a.user_id,
a.username as adminID,
a.email,
a.mobile as phone,
a.user_display as adminName,
dbo.get_bu_desc(c.site,c.bu_no) as buDesc,
d.role_id,
e.role_name
FROM sys_user as a
LEFT JOIN eam_access_site as b on a.username = b.username
LEFT JOIN AccessBu as c on b.username = c.username and b.site = c.site
LEFT JOIN sys_user_role as d on a.user_id = d.user_id
LEFT JOIN sys_role as e on d.role_id = e.role_id
<where >
b.site = #{site} and c.bu_no = #{buNo}
<if test= "adminID != null and adminID != ''" >
AND a.username LIKE '%' + #{adminID}+'%'
</if>
<if test= "adminName != null and adminName != ''" >
AND a.user_display LIKE '%' + #{adminName}+'%'
</if>
<if test= "buDesc != null and buDesc != ''" >
AND dbo.get_bu_desc(a.site,c.bu_no) LIKE '%' + #{buDesc} + '%'
</if>
<if test= "roleId != null and roleId != ''" >
AND d.role_id = #{roleId}
</if>
</where>
</otherwise>
</choose>
</select>
<select id= "getUserRoleList" resultType= "com.xujie.modules.sys.entity.SysRoleEntity" >