|
|
@ -41,58 +41,62 @@ |
|
|
|
|
|
|
|
<!-- 查询当前网格所属机构下的不在此网格的工作人员Id --> |
|
|
|
<select id="getSelectableStaffsForGrid" parameterType="string" resultType="string"> |
|
|
|
SELECT |
|
|
|
agency.USER_ID |
|
|
|
FROM |
|
|
|
CUSTOMER_STAFF_AGENCY agency |
|
|
|
WHERE |
|
|
|
agency.DEL_FLAG = '0' |
|
|
|
AND agency.AGENCY_ID = ( |
|
|
|
SELECT |
|
|
|
PID |
|
|
|
agency.user_id |
|
|
|
FROM |
|
|
|
CUSTOMER_GRID |
|
|
|
customer_staff_agency agency |
|
|
|
INNER JOIN staff_org_relation sor ON agency.user_id = sor.staff_id AND sor.org_type = 'agency' |
|
|
|
WHERE |
|
|
|
DEL_FLAG = '0' |
|
|
|
AND ID = #{gridId}) |
|
|
|
|
|
|
|
AND agency.USER_ID NOT IN ( |
|
|
|
SELECT |
|
|
|
USER_ID |
|
|
|
FROM |
|
|
|
CUSTOMER_STAFF_GRID |
|
|
|
WHERE |
|
|
|
DEL_FLAG = '0' |
|
|
|
AND |
|
|
|
GRID_ID = #{gridId} ) |
|
|
|
agency.del_flag = '0' |
|
|
|
AND agency.agency_id = ( |
|
|
|
SELECT |
|
|
|
pid |
|
|
|
FROM |
|
|
|
customer_grid |
|
|
|
WHERE |
|
|
|
del_flag = '0' |
|
|
|
AND id = #{gridId} |
|
|
|
) |
|
|
|
AND agency.user_id NOT IN ( |
|
|
|
SELECT |
|
|
|
user_id |
|
|
|
FROM |
|
|
|
customer_staff_grid |
|
|
|
WHERE |
|
|
|
del_flag = '0' |
|
|
|
AND |
|
|
|
grid_id = #{gridId} |
|
|
|
) |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- 查询当前部门所属机构下的不在此部门的工作人员Id --> |
|
|
|
<select id="getSelectableStaffsForDept" parameterType="string" resultType="string"> |
|
|
|
SELECT |
|
|
|
agency.USER_ID |
|
|
|
agency.user_id |
|
|
|
FROM |
|
|
|
CUSTOMER_STAFF_AGENCY agency |
|
|
|
customer_staff_agency agency |
|
|
|
INNER JOIN staff_org_relation sor ON agency.user_id = sor.staff_id AND sor.org_type = 'agency' |
|
|
|
WHERE |
|
|
|
agency.DEL_FLAG = '0' |
|
|
|
AND agency.AGENCY_ID = ( |
|
|
|
SELECT |
|
|
|
AGENCY_ID |
|
|
|
FROM |
|
|
|
CUSTOMER_DEPARTMENT |
|
|
|
WHERE |
|
|
|
DEL_FLAG = '0' |
|
|
|
AND ID = #{departmentId}) |
|
|
|
|
|
|
|
AND agency.USER_ID NOT IN ( |
|
|
|
SELECT |
|
|
|
USER_ID |
|
|
|
FROM |
|
|
|
CUSTOMER_STAFF_DEPARTMENT |
|
|
|
WHERE |
|
|
|
DEL_FLAG = '0' |
|
|
|
AND |
|
|
|
DEPARTMENT_ID = #{departmentId} ) |
|
|
|
agency.del_flag = '0' |
|
|
|
AND agency.agency_id = ( |
|
|
|
SELECT |
|
|
|
agency_id |
|
|
|
FROM |
|
|
|
customer_department |
|
|
|
WHERE |
|
|
|
del_flag = '0' |
|
|
|
AND id = #{departmentId} |
|
|
|
) |
|
|
|
AND agency.user_id NOT IN ( |
|
|
|
SELECT |
|
|
|
user_id |
|
|
|
FROM |
|
|
|
customer_staff_department |
|
|
|
WHERE |
|
|
|
del_flag = '0' |
|
|
|
AND |
|
|
|
department_id = #{departmentId} |
|
|
|
) |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="selectAgencyStaffList" resultType="com.epmet.dto.result.StaffListResultDTO"> |
|
|
|