kongdeqiang
2024-11-12 552c700f584700316e8d1919dd1ad7f551c53ec4
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?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.OutParkMapper">
 
  <resultMap id="outParkMap" type="com.boying.entity.OutPark">
        <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="code" column="code"/>
        <result property="enterTime" column="enter_time"/>
        <result property="parkId" column="park_id"/>
        <result property="payCode" column="pay_code"/>
        <result property="price" column="price"/>
        <result property="remark" column="remark"/>
        <result property="status" column="status"/>
        <result property="status2" column="status2"/>
        <result property="status3" column="status3"/>
        <result property="time" column="time"/>
        <result property="code2" column="code2"/>
        <result property="txnOrderId" column="txn_order_id"/>
        <result property="txnOrderTime" column="txn_order_time"/>
        <result property="respTxnTime" column="resp_txn_time"/>
        <result property="qrCode" column="qr_code"/>
  </resultMap>
    <select id="getList" resultType="com.boying.entity.OutPark">
          select * from  out_park
          <where>
                1=1
                <if test="carNo != null and carNo != ''">
                      and car_no like concat('%',#{carNo},'%')
                </if>
                <if test="payCode != null and payCode != ''">
                      and pay_code = #{payCode}
                </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  out_park
            <where>
                  1=1
                  <if test="carNo != null and carNo != ''">
                        and car_no = #{carNo}
                  </if>
                  <if test="payCode != null and payCode != ''">
                        and pay_code = #{payCode}
                  </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>
    <select id="getOneByBarrierId" resultType="com.boying.entity.OutPark">
          select id,car_no,status2 from  out_park
          where barrier_id = #{barrierId} and `status` = 1 and status2 = 0 and del_flag = 0 limit 1;
    </select>
 
    <select id="getVoList" resultType="com.boying.entity.vo.OutParkVo">
          SELECT SUM(price) price,IFNULL(count( id ),0) num,park_id,DATE_FORMAT(update_time, '%Y-%m-%d') ti FROM out_park
          WHERE `status` = 1 AND pay_code IS NOT NULL
                <if test="parkId != null and parkId != ''">
                      and park_id = #{parkId}
                </if>
            AND DATE_FORMAT(update_time,'%Y-%m-%d') &gt;= DATE_FORMAT(#{startDate},'%Y-%m-%d')
            AND DATE_FORMAT(update_time,'%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate},'%Y-%m-%d')
          GROUP BY ti,park_id
    </select>
</mapper>