huliguo
14 小时以前 c5d38d650d2ac4101b1293a4f17346e7d5420076
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?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.shop.mapper.shop.ShopAppointableTimeMapper">
 
 
    <select id="pageMyAppointmentList" resultType="com.ruoyi.shop.domain.vo.MyAppointmentListVo">
        select * from (
            select
            a.id,
            DATE_FORMAT(a.appointment_time,  '%Y-%m-%d %H:%i') as appointmentTime,
            a.status,
            b.shop_name as shopName,
            a.reason as cancelReason,
            CASE WHEN a.`status` in (1, 2) THEN 1 WHEN a.`status` = 3 THEN 2 ELSE 3 END as sort
            from t_shop_appointable_time a
            left join t_shop b on (a.shop_id = b.shop_id)
            where a.user_id = #{userId}
            <if test="status != null">
                and a.status = #{status}
            </if>
        ) as aa order by aa.sort, aa.appointmentTime
    </select>
    
    
    
    
    <select id="getShopAppointableTimeList" resultType="com.ruoyi.system.api.domain.poji.shop.TShopAppointableTime">
        select * from (
            select
                a.*,
                CASE WHEN a.`status` = 3 THEN 3 WHEN a.`status` = 0 THEN 2 ELSE 1 END as sort
            from t_shop_appointable_time a where shop_id = #{item.shopId}
           <if test="null != item.status">
               and a.status = #{item.status}
           </if>
        ) as aa order by aa.sort,aa.appointment_time
    </select>
    
    
    
    <update id="taskUpdateStatus">
        update t_shop_appointable_time set status = 3 where status in (1, 2) and appointment_time &lt; now()
    </update>
</mapper>