<?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="cn.stylefeng.roses.kernel.customer.modular.mapper.CustomerMapper">
|
|
<sql id="getWorkerByLineStatusAndPostType">
|
toc_customer o
|
LEFT JOIN im_user_status ius ON o.customer_id = ius.userid
|
<where>
|
AND o.status_flag = 1
|
<if test="lineStatus != null and lineStatus != ''">
|
AND ius.`status` = #{lineStatus}
|
</if>
|
<if test="postType != null">
|
AND FIND_IN_SET( #{postType}, post_types )
|
</if>
|
<if test="postId != null">
|
AND FIND_IN_SET( #{postId}, post_ids )
|
</if>
|
<if test="workStatus != null">
|
AND o.work_status = #{workStatus}
|
</if>
|
</where>
|
GROUP BY o.customer_id
|
</sql>
|
|
<select id="getWorkerIdByLineStatusAndPostType" resultType="java.lang.Long">
|
SELECT customer_id FROM <include refid="getWorkerByLineStatusAndPostType"/>
|
</select>
|
|
<select id="randomWorkerByLineStatusAndPostNeWorkerId" resultType="java.lang.Long">
|
SELECT customer_id FROM toc_customer o
|
LEFT JOIN im_user_status ius ON o.customer_id = ius.userid
|
<where>
|
AND o.status_flag = 1
|
<if test="lineStatus != null and lineStatus != ''">
|
AND ius.`status` = #{lineStatus}
|
</if>
|
<if test="postType != null">
|
AND FIND_IN_SET( #{postType}, post_types )
|
</if>
|
<if test="postId != null">
|
AND FIND_IN_SET( #{postId}, post_ids )
|
</if>
|
<if test="workStatus != null">
|
AND o.work_status = #{workStatus}
|
</if>
|
<if test="mentalAnalysisStatus != null">
|
AND o.mental_analysis_status = #{mentalAnalysisStatus}
|
</if>
|
<if test="eqWorkerIdList != null and eqWorkerIdList.size != 0">
|
AND o.customer_id IN
|
<foreach collection="eqWorkerIdList" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="neWorkerIdList != null and neWorkerIdList.size != 0">
|
AND o.customer_id NOT IN
|
<foreach collection="neWorkerIdList" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
</where>
|
GROUP BY o.customer_id
|
</select>
|
|
<select id="getWorkerListByLineStatusAndPostType" resultType="cn.stylefeng.roses.kernel.customer.modular.entity.Customer">
|
SELECT * FROM <include refid="getWorkerByLineStatusAndPostType"/>
|
</select>
|
|
<select id="getCustomerPage" resultType="cn.stylefeng.roses.kernel.customer.api.pojo.UserManagePageResponseDTO">
|
SELECT
|
o.*,
|
o1.nick_name AS classWorkerName,
|
o2.nick_name AS consultWorkerName
|
FROM toc_customer o
|
LEFT JOIN toc_customer o1 ON o1.customer_id = o.class_worker_id
|
LEFT JOIN toc_customer o2 ON o2.customer_id = o.consult_worker_id
|
<where>
|
o.status_flag <![CDATA[ <> ]]> 3
|
<if test="userType != null">
|
AND o.user_type = #{userType}
|
</if>
|
<if test="id != null">
|
AND o.customer_id = #{id}
|
</if>
|
<if test="name != null and name != ''">
|
AND o.nick_name LIKE CONCAT('%', #{name}, '%')
|
</if>
|
<if test="telephone != null and telephone != ''">
|
AND o.telephone LIKE CONCAT('%', #{telephone}, '%')
|
</if>
|
<if test="statusFlag != null">
|
AND o.status_flag = #{statusFlag}
|
</if>
|
</where>
|
ORDER BY o.create_time DESC
|
</select>
|
|
</mapper>
|