|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
|
|
|
<mapper namespace="com.epmet.dao.CustomerStaffDao">
|
|
|
|
|
|
|
|
<!-- 根据手机号查询工作人员信息 -->
|
|
|
|
<select id="selectListCustomerStaffDTO" parameterType="java.lang.String" resultType="com.epmet.dto.CustomerStaffDTO">
|
|
|
|
select * from customer_staff cs
|
|
|
|
where cs.MOBILE=#{mobile}
|
|
|
|
and cs.DEL_FLAG='0'
|
|
|
|
order by cs.ACTIVE_TIME desc,cs.CREATED_TIME asc
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 根据手机号+客户id获取工作人员基本信息 -->
|
|
|
|
<select id="selectListCustomerStaffInfo" parameterType="com.epmet.dto.form.CustomerStaffFormDTO" resultType="com.epmet.dto.CustomerStaffDTO">
|
|
|
|
select * from customer_staff cs
|
|
|
|
where cs.MOBILE=#{mobile}
|
|
|
|
and cs.CUSTOMER_ID=#{customerId}
|
|
|
|
and cs.DEL_FLAG='0'
|
|
|
|
</select>
|
|
|
|
<select id="selectStaffInfoByUserId" parameterType="com.epmet.dto.CustomerStaffDTO" resultType="com.epmet.dto.CustomerStaffDTO">
|
|
|
|
select * from customer_staff cs
|
|
|
|
where cs.USER_ID=#{userId}
|
|
|
|
and cs.DEL_FLAG='0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 根据userId查询网格下的用户信息 -->
|
|
|
|
<select id="selectStaffGridListByUserId" parameterType="com.epmet.dto.CustomerStaffGridDTO" resultType="com.epmet.dto.StaffGridListDTO">
|
|
|
|
SELECT
|
|
|
|
cs.id AS staffId,
|
|
|
|
cs.real_name AS staffName,
|
|
|
|
cs.head_photo AS staffHeadPhoto,
|
|
|
|
gsr.role_name AS roleName
|
|
|
|
FROM
|
|
|
|
customer_staff cs
|
|
|
|
LEFT JOIN gov_staff_role gsr ON cs.user_id = gsr.id
|
|
|
|
WHERE
|
|
|
|
cs.user_id in
|
|
|
|
<foreach collection="list" item="staff" open="(" separator="," close=")">
|
|
|
|
#{staff.userId}
|
|
|
|
</foreach>
|
|
|
|
AND cs.del_flag = 0
|
|
|
|
</select>
|
|
|
|
<select id="selectCustomerStaffList" resultType="com.epmet.dto.result.StaffInfoResultDTO" parameterType="com.epmet.dto.form.StaffsInAgencyFromDTO">
|
|
|
|
SELECT
|
|
|
|
cs.USER_ID AS "staffId",
|
|
|
|
cs.REAL_NAME AS "staffName",
|
|
|
|
cs.GENDER AS "gender",
|
|
|
|
cs.HEAD_PHOTO AS "staffHeadPhoto",
|
|
|
|
cs.ENABLE_FLAG AS "enableFlag",
|
|
|
|
gsr.ROLE_NAME AS "roleName"
|
|
|
|
FROM
|
|
|
|
customer_staff cs
|
|
|
|
LEFT JOIN staff_role sr ON cs.USER_ID = sr.STAFF_ID
|
|
|
|
AND sr.DEL_FLAG = '0'
|
|
|
|
AND sr.ORG_ID = #{agencyId}
|
|
|
|
LEFT JOIN gov_staff_role gsr ON sr.ROLE_ID = gsr.ID
|
|
|
|
AND gsr.DEL_FLAG = '0'
|
|
|
|
AND gsr.CUSTOMER_ID = #{customerId}
|
|
|
|
AND gsr.ROLE_KEY = 'agency_leader'
|
|
|
|
WHERE
|
|
|
|
cs.DEL_FLAG = '0'
|
|
|
|
AND
|
|
|
|
cs.USER_ID in
|
|
|
|
<foreach item="userId" collection="staffList" separator="," open="(" close=")" index="">
|
|
|
|
#{userId}
|
|
|
|
</foreach>
|
|
|
|
ORDER BY gsr.ROLE_NAME DESC, cs.CREATED_TIME DESC
|
|
|
|
LIMIT 12
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 根据staffid查询用户基本信息 -->
|
|
|
|
<select id="selectByUserId" parameterType="java.lang.String" resultType="com.epmet.entity.CustomerStaffEntity">
|
|
|
|
SELECT
|
|
|
|
*
|
|
|
|
FROM
|
|
|
|
customer_staff CS
|
|
|
|
WHERE
|
|
|
|
cs.DEL_FLAG = '0'
|
|
|
|
AND CS.USER_ID =#{userId}
|
|
|
|
</select>
|
|
|
|
</mapper>
|