kongdeqiang
2023-08-15 15b3290a092ea16be998d5ce3c1df06ec3752bb5
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
45
46
47
48
49
<?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.boying.mapper.EnterParkMapper">
 
  <resultMap id="enterParkMap" type="com.boying.entity.EnterPark">
        <id property="id" column="id"/>
        <result property="createTime" column="create_time"/>
        <result property="delFlag" column="del_flag"/>
        <result property="updateTime" column="update_time"/>
        <result property="barrierId" column="barrier_id"/>
        <result property="carNo" column="car_no"/>
        <result property="parkId" column="park_id"/>
        <result property="status" column="status"/>
  </resultMap>
    <select id="getList" resultType="com.boying.entity.EnterPark">
        select * from  enter_park
        <where>
            1=1
            <if test="carNo != null and carNo != ''">
                and car_no like concat('%',#{carNo},'%')
            </if>
            <if test="parkId != null and parkId != ''">
                and park_id = #{parkId}
            </if>
            <if test="date != null and date != ''">
                and DATE_FORMAT(create_time,'%Y-%m-%d') &gt;= DATE_FORMAT(#{date},'%Y-%m-%d')
                and DATE_FORMAT(create_time,'%Y-%m-%d') &lt;= DATE_FORMAT(#{date},'%Y-%m-%d')
            </if>
        </where>
        order by create_time desc  limit #{current},#{size}
    </select>
    <select id="getCount" resultType="java.lang.Long">
        select count(*) from  enter_park
        <where>
            1=1
            <if test="carNo != null and carNo != ''">
                and car_no = #{carNo}
            </if>
            <if test="parkId != null and parkId != ''">
                and park_id = #{parkId}
            </if>
            <if test="date != null and date != ''">
                and DATE_FORMAT(create_time,'%Y-%m-%d') &gt;= DATE_FORMAT(#{date},'%Y-%m-%d')
                and DATE_FORMAT(create_time,'%Y-%m-%d') &lt;= DATE_FORMAT(#{date},'%Y-%m-%d')
            </if>
        </where>
    </select>
</mapper>