<?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.guns.modular.business.mapper.MentalAppointmentMapper">
|
|
<select id="myMentalAppointment" resultType="cn.stylefeng.guns.modular.business.dto.MentalTestMyMentalAppointmentDTO">
|
SELECT
|
o.*,
|
wu.nick_name workerNickName
|
FROM
|
t_mental_appointment o
|
LEFT JOIN toc_customer wu ON o.worker_id = wu.customer_id
|
<where>
|
o.`type` is null
|
<if test="statusFlagList != null and statusFlagList.size != 0">
|
AND o.status_flag IN
|
<foreach item="item" collection="statusFlagList" index="index" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="userId != null">
|
AND o.user_id = #{userId}
|
</if>
|
<if test="consultantName != null">
|
AND wu.nick_name LIKE CONCAT('%', #{consultantName}, '%')
|
</if>
|
</where>
|
ORDER BY o.create_time DESC
|
</select>
|
|
<select id="mentalAnalysisTimeConfigSchedule" resultType="cn.stylefeng.guns.modular.business.dto.MentalAppointmentPageDTO">
|
SELECT
|
o.id,
|
o.type,
|
o.status_flag,
|
o.appointment_day,
|
o.begin_time_point,
|
o.end_time_point,
|
o.user_id user_id,
|
o.user_name userNickName,
|
o.phone userTelephone,
|
wu.customer_id worker_id,
|
wu.nick_name worker_nick_name,
|
wu.telephone worker_telephone
|
FROM
|
t_mental_appointment o
|
LEFT JOIN toc_customer wu ON o.worker_id = wu.customer_id
|
<where>
|
o.`type` is null AND o.is_delete = 0
|
<if test="counsellingInfoId != null">
|
AND o.worker_id = #{counsellingInfoId}
|
</if>
|
<if test="statusFlag != null">
|
AND o.status_flag = #{statusFlag}
|
</if>
|
<if test="statusFlag == null and statusFlagList != null and statusFlagList.size != 0">
|
AND o.status_flag IN
|
<foreach item="item" collection="statusFlagList" index="index" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="searchBeginTime != null and searchBeginTime != ''">
|
AND o.appointment_day <![CDATA[ >= ]]> #{searchBeginTime}
|
</if>
|
<if test="searchEndTime != null and searchEndTime != ''">
|
AND o.appointment_day <![CDATA[ <= ]]> #{searchEndTime}
|
</if>
|
<if test="workerNickName != null and workerNickName != ''">
|
AND wu.nick_name LIKE CONCAT( '%', #{workerNickName}, '%' )
|
</if>
|
<if test="userNickName != null and userNickName != ''">
|
AND o.user_name LIKE CONCAT( '%', #{userNickName}, '%' )
|
</if>
|
<if test="userTelephone != null and userTelephone != ''">
|
AND o.phone LIKE CONCAT( '%', #{userTelephone}, '%' )
|
</if>
|
</where>
|
ORDER BY
|
o.create_time DESC
|
</select>
|
|
<select id="userMentalAppointmentPage" resultType="cn.stylefeng.guns.modular.business.dto.UserMentalAppointmentPageResponseDTO">
|
SELECT * FROM t_mental_appointment o
|
LEFT JOIN toc_customer tw ON tw.customer_id = o.worker_id
|
<where>
|
o.`type` is null
|
<if test="userId != null">
|
AND o.user_id = #{userId}
|
</if>
|
<if test="userId != null">
|
AND o.status_flag = #{statusFlag}
|
</if>
|
<if test="name != null and name != ''">
|
AND tw.nick_name LIKE CONCAT('%',#{name},'%')
|
</if>
|
<if test="telephone != null and telephone != ''">
|
AND tw.telephone LIKE CONCAT('%',#{telephone},'%')
|
</if>
|
</where>
|
ORDER BY o.create_time DESC
|
</select>
|
|
</mapper>
|