<?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.ruoyi.other.mapper.TechnicianSubscribeMapper">
|
|
<select id="getTechnicianSubscribeByUserAndShop" resultType="com.ruoyi.other.vo.TechnicianSubscribeVO">
|
SELECT
|
CAST(tts.id AS CHAR) id,
|
tts.user_address,
|
ts.`name` shopName,
|
ts.address shopAddress,
|
tt.name technicianName,
|
ts.longitude,
|
ts.latitude,
|
tts.subscribe_time,
|
tts.service_mode,
|
tts.status
|
FROM
|
t_technician_subscribe tts
|
LEFT JOIN t_technician tt ON tts.technician_id = tt.id AND tt.del_flag = 0
|
LEFT JOIN t_shop ts ON tt.shop_id = ts.id AND ts.del_flag = 0
|
WHERE
|
ts.id = #{shopId}
|
AND tts.del_flag = 0
|
<if test="status != null">
|
AND tts.status = #{status}
|
</if>
|
ORDER BY tts.create_time DESC
|
</select>
|
<select id="getTechnicianSubscribeByUserAndShop1" resultType="com.ruoyi.other.vo.TechnicianSubscribeVO">
|
SELECT
|
CAST(tts.id AS CHAR) id,
|
tts.user_address,
|
ts.`name` shopName,
|
ts.address shopAddress,
|
tt.name technicianName,
|
ts.longitude,
|
ts.latitude,
|
tts.subscribe_time,
|
tts.service_mode,
|
tts.status
|
FROM
|
t_technician_subscribe tts
|
LEFT JOIN t_technician tt ON tts.technician_id = tt.id AND tt.del_flag = 0
|
LEFT JOIN t_shop ts ON tt.shop_id = ts.id AND ts.del_flag = 0
|
WHERE
|
ts.id = #{shopId}
|
AND tts.del_flag = 0
|
<if test="status != null">
|
AND tts.status = #{status}
|
</if>
|
<if test="name != null and name != ''">
|
AND tt.`name` LIKE concat('%', #{name}, '%')
|
</if>
|
<if test="phone != null and phone != ''">
|
AND tt.`phone` LIKE concat('%', #{phone}, '%')
|
</if>
|
<if test="serviceMode != null">
|
AND tts.service_mode = #{serviceMode}
|
</if>
|
|
ORDER BY tts.create_time DESC
|
</select>
|
|
<select id="getTechnicianSubscribeByUser" resultType="com.ruoyi.other.vo.TechnicianSubscribeVO">
|
SELECT * from (
|
SELECT
|
CAST(tts.id AS CHAR) id,
|
tts.user_address,
|
ts.`name` shopName,
|
ts.address shopAddress,
|
tt.name technicianName,
|
ts.longitude,
|
ts.latitude,
|
tts.subscribe_time,
|
tts.service_mode,
|
CASE
|
WHEN tts.subscribe_time <![CDATA[<]]> NOW() THEN 4
|
ELSE tts.status
|
END AS status
|
FROM
|
t_technician_subscribe tts
|
LEFT JOIN t_technician tt ON tts.technician_id = tt.id AND tt.del_flag = 0
|
LEFT JOIN t_shop ts ON tt.shop_id = ts.id AND ts.del_flag = 0
|
WHERE
|
tts.app_user_id = #{userId}
|
AND tts.del_flag = 0
|
ORDER BY tts.create_time DESC
|
|
) o
|
<where>
|
<if test="status !=null">
|
o.status = #{status}
|
</if>
|
</where>
|
|
</select>
|
</mapper>
|