puzhibing
2023-07-19 d85000e8f03740bd68523a36e108065a8168bd6a
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
<?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.dsh.other.mapper.SiteMapper">
 
 
    <select id="querySiteList" resultType="com.dsh.other.model.QuerySiteListVo">
        select
        a.id,
        a.`name`,
        c.`name` as siteTypeName,
        b.`name` as storeName,
        b.address as storeAddress,
        b.lon as storeLon,
        b.lat as storeLat,
        CONCAT(a.appointmentStartTime, '-', a.appointmentEndTime) as times,
        a.cashPrice as price
        from t_site a
        left join t_store b on (a.storeId = b.id)
        left join t_site_type c on (a.siteTypeId = c.id)
        where a.state = 1
        <if test="null != item.startTime and '' != item.startTime and null != item.endTime and '' != item.endTime">
            and CONCAT(DATE_FORMAT(now, '%Y-%m-%d', ' ', a.appointmentStartTime)) &lt;=  CONCAT(DATE_FORMAT(now, '%Y-%m-%d', ' ', #{item.startTime})) and CONCAT(DATE_FORMAT(now, '%Y-%m-%d', ' ', a.appointmentEndTime)) &gt;=  CONCAT(DATE_FORMAT(now, '%Y-%m-%d', ' ', #{item.endTime}))
        </if>
        <if test="null != item.siteTypeId">
            and a.siteTypeId = #{item.siteTypeId}
        </if>
        <if test="null != item.cityCode">
            and b.cityCode = #{item.cityCode}
        </if>
        <if test="null != item.storeId">
            and a.storeId = #{item.storeId}
        </if>
        <if test="null != item.search and '' != item.search">
            and (a.name like CONCAT('%', #{item.search}, '%') or b.name like CONCAT('%', #{item.search}, '%'))
        </if>
        order by a.insertTime desc limit #{item.pageNum}, #{item.pageSize}
    </select>
</mapper>