Blame view

parking-module-bill/src/main/resources/mybatis/smapper/TBillingRuleCollectSMapper.xml 5.24 KB
55f68655   王彪总   新项目
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
  <?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.zteits.bill.mapper.smapper.TBillingRuleCollectSMapper">
      <resultMap id="BaseResultMap" type="com.zteits.bill.domain.TBillingRuleCollect">
          <id column="id" property="id" jdbcType="INTEGER"/>
          <result column="rule_collect_no" property="ruleCollectNo" jdbcType="VARCHAR"/>
          <result column="rule_no" property="ruleNo" jdbcType="VARCHAR"/>
          <result column="rule_collect_name" property="ruleCollectName" jdbcType="VARCHAR"/>
          <result column="free_time_type" property="freeTimeType" jdbcType="INTEGER"/>
          <result column="day_start_time" property="dayStartTime" jdbcType="TIME"/>
          <result column="day_end_time" property="dayEndTime" jdbcType="TIME"/>
          <result column="org_id" property="orgId" jdbcType="BIGINT"/>
          <result column="data_state" property="dataState" jdbcType="INTEGER"/>
          <result column="create_op" property="createOp" jdbcType="BIGINT"/>
          <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
          <result column="modify_op" property="modifyOp" jdbcType="BIGINT"/>
          <result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
      </resultMap>
  
  
      <resultMap id="queryBillingRuleCollectsByOrgIdResultMap" type="com.zteits.bill.domain.TBillingRuleCollect">
          <id column="id" property="id" jdbcType="INTEGER"/>
          <result column="rule_collect_no" property="ruleCollectNo" jdbcType="VARCHAR"/>
          <result column="rule_no" property="ruleNo" jdbcType="VARCHAR"/>
          <result column="rule_collect_name" property="ruleCollectName" jdbcType="VARCHAR"/>
          <result column="free_time_type" property="freeTimeType" jdbcType="INTEGER"/>
          <result column="day_start_time" property="dayStartTime" javaType="DATE"/>
          <result column="day_end_time" property="dayEndTime" javaType="DATE"/>
          <result column="org_id" property="orgId" jdbcType="BIGINT"/>
          <result column="data_state" property="dataState" jdbcType="INTEGER"/>
          <result column="create_op" property="createOp" jdbcType="BIGINT"/>
          <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
          <result column="modify_op" property="modifyOp" jdbcType="BIGINT"/>
          <result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
          <result column="frist_free_time" property="freeTime" jdbcType="BIGINT"/>
          <result column="max_charge" property="maxCharge" jdbcType="BIGINT"/>
          <result column="day_max_charge" property="dayMaxCharge" jdbcType="BIGINT"/>
      </resultMap>
  
      <sql id="Base_Column_List">
          id,
          rule_collect_no,
          rule_no,
          rule_collect_name,
          free_time_type,
          day_start_time,
          day_end_time,
          org_id,
          data_state,
          create_op,
          create_time,
          modify_op,
          modify_time
      </sql>
      <update id="deleteBillingRuleCollect">
          UPDATE t_billing_rule_collect
          set data_state = 0
          WHERE data_state = 1
          AND rule_collect_no IN
          <foreach collection="collectionNos" item="collectionNo" open="(" close=")" separator=",">
              #{collectionNo}
          </foreach>
      </update>
  
      <select id="queryBillingRuleCollectsByOrgId" resultMap="queryBillingRuleCollectsByOrgIdResultMap">
  
          SELECT
          m.*,
          n.frist_free_time,
          n.max_charge,
          n.day_max_charge
          FROM (
          SELECT *
          FROM t_billing_rule_collect
          WHERE id IN (
          SELECT max(id)
          FROM t_billing_rule_collect
          <if test="null!=orgId">
              WHERE org_id = #{orgId}
          </if>
          and data_state = 1
          GROUP BY rule_collect_no)) m, t_billing_rule n
          WHERE m.rule_no = n.rule_no
  
          ORDER BY n.frist_free_time DESC ;
  
  
      </select>
  
  
      <select id="queryBillingRuleCollectByPlNo" resultMap="BaseResultMap">
          SELECT n.id,
                 n.rule_collect_no,
                 n.rule_no,
                 n.rule_collect_name,
                 n.free_time_type,
                 n.day_start_time,
                 n.day_end_time,
                 n.org_id,
                 n.data_state,
                 n.create_op,
                 n.create_time,
                 n.modify_op,
                 n.modify_time
          FROM t_billing_park_rule_rel m,
               t_billing_rule_collect n
          WHERE m.data_state = 1
            AND n.data_state = 1
            AND m.check_state = 3
            AND #{inTime} &gt;= m.effect_time
            AND #{inTime} &lt;= m.expire_time
            AND m.rule_collect_no = n.rule_collect_no
            AND m.pl_no = #{plNo}
  
      </select>
      <select id="queryBillingRuleCollectByCollectionNo" resultMap="BaseResultMap">
          select
          <include refid="Base_Column_List"/>
          from t_billing_rule_collect
          where rule_collect_no = #{collectionNo}
          and data_state = 1
  
  
      </select>
      <select id="queryEffectRuleCollect" resultType="java.lang.Integer">
          SELECT count(DISTINCT pl_no)
          FROM t_billing_park_rule_rel
          WHERE rule_collect_no = #{collectionNo}
            AND data_state = 1
            AND expire_time >= #{queryDate}
      </select>
  
  
  </mapper>