日照智慧社区接口服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

206 lines
7.3 KiB

<?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.user_id AS staffId,
cs.real_name AS staffName,
IFNULL(cs.head_photo,'') AS staffHeadPhoto,
IFNULL(gsr.role_name,'') AS roleName,
cs.gender
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>
<!-- 根据userId查询网格下未被禁用的人员数量 -->
<select id="selectGridStaffCountByUserId" resultType="com.epmet.dto.GridStaffCountDTO">
SELECT
count(*) AS enableCount
FROM
customer_staff
WHERE
user_id in
<foreach collection="list" item="staff" open="(" separator="," close=")">
#{staff.userId}
</foreach>
AND del_flag = 0
AND enable_flag = 'enable'
</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",
IFNULL( cs.HEAD_PHOTO, "" ) AS "staffHeadPhoto",
cs.ENABLE_FLAG AS "enableFlag",
IFNULL( role.ROLE_NAME, "" ) AS "roleName"
FROM
customer_staff cs
LEFT JOIN (
SELECT
sr.STAFF_ID,
sr.ROLE_ID,
gsr.ROLE_NAME
FROM
staff_role sr
LEFT JOIN gov_staff_role gsr ON sr.ROLE_ID = gsr.ID
AND gsr.DEL_FLAG = '0'
AND gsr.CUSTOMER_ID = #{customerId}
WHERE
sr.DEL_FLAG = '0'
AND sr.ORG_ID = #{agencyId}
AND gsr.ROLE_KEY = 'agency_leader'
) role ON cs.USER_ID = role.STAFF_ID
WHERE
cs.DEL_FLAG = '0'
AND cs.CUSTOMER_ID = #{customerId}
AND cs.ENABLE_FLAG = 'enable'
AND cs.USER_ID IN
<foreach item="userId" collection="staffList" separator="," open="(" close=")" index="">
#{userId}
</foreach>
ORDER BY
role.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>
<select id="selectStaffList" 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",
IFNULL(cs.HEAD_PHOTO, "") AS "staffHeadPhoto",
cs.ENABLE_FLAG AS "enableFlag"
FROM
customer_staff cs
WHERE
cs.DEL_FLAG = '0'
AND cs.CUSTOMER_ID = #{customerId}
<foreach item="userId" collection="staffList" separator="OR" open="AND (" close=")" index="">
cs.USER_ID = #{userId}
</foreach>
ORDER BY convert(cs.REAL_NAME using gbk) ASC
</select>
<select id="selectStaffInfo" resultType="com.epmet.dto.CustomerStaffDTO" parameterType="com.epmet.dto.form.StaffInfoFromDTO">
SELECT
USER_ID,
REAL_NAME,
MOBILE,
GENDER,
IFNULL(HEAD_PHOTO, "") AS "headPhoto",
ENABLE_FLAG,
ACTIVE_FLAG,
ACTIVE_TIME,
WORK_TYPE
FROM
customer_staff
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND USER_ID = #{staffId}
</select>
<select id="selectDepartmentStaffList" resultType="com.epmet.dto.result.DepartInStaffListResultDTO">
SELECT
user_id AS 'staffId',
real_name AS 'staffName',
IF (head_photo IS NULL,'',head_photo) AS 'staffHeadPhoto',
gender AS 'gender'
FROM
customer_staff
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND user_id in
<foreach item="userId" collection="userIdList" separator="," open="(" close=")" index="">
#{userId}
</foreach>
ORDER BY CONVERT (real_name USING gbk) ASC<!--按中文对应的拼音升序排列-->
</select>
<!-- 根据UserId列表查询用户Id、头像、昵称,过滤掉被禁用的,包含未激活的-->
<select id="selectEnableStaffMsg" resultType="com.epmet.dto.result.CommonStaffInfoResultDTO">
SELECT
USER_ID AS staffId,
IFNULL(REAL_NAME,"") AS staffName,
IFNULL(HEAD_PHOTO,"") AS staffHeadPhoto ,
IFNULL(GENDER,0) AS gender
FROM
CUSTOMER_STAFF
WHERE
DEL_FLAG = '0'
AND
CUSTOMER_ID = #{customerId}
AND
ENABLE_FLAG = 'enable'
<foreach collection="userIds" item="userId" open="AND USER_ID IN (" separator="," close=")">
#{userId}
</foreach>
</select>
<select id="selectStaffByIds" resultType="com.epmet.dto.result.StaffListResultDTO">
SELECT
user_id AS staffId,
IFNULL(real_name,"") AS staffName,
IFNULL(head_photo,"") AS staffHeadPhoto ,
IFNULL(gender,0) AS gender
FROM
customer_staff
WHERE
del_flag = '0'
<foreach item="userId" collection="staffIdList" separator="OR" open="AND (" close=")" index="">
user_id = #{userId}
</foreach>
</select>
<select id="selectByStaffId" resultType="com.epmet.dto.CustomerStaffDTO">
SELECT
*
FROM
customer_staff
WHERE
del_flag = '0'
AND user_id = #{staffId}
</select>
</mapper>