TBillingRuleSMapper.xml
4.76 KB
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
<?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.TBillingRuleSMapper">
<resultMap id="BaseResultMap" type="com.zteits.bill.domain.TBillingRule">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="rule_no" property="ruleNo" jdbcType="VARCHAR"/>
<result column="org_id" property="orgId" jdbcType="BIGINT"/>
<result column="rule_type" property="ruleType" jdbcType="INTEGER"/>
<result column="cross_time_rule_type" property="crossTimeRuleType" jdbcType="INTEGER"/>
<result column="car_type" property="carType" jdbcType="INTEGER"/>
<result column="frist_free_time" property="fristFreeTime" jdbcType="INTEGER"/>
<result column="free_time_type" property="freeTimeType" jdbcType="INTEGER"/>
<result column="day_max_charge" property="dayMaxCharge" jdbcType="INTEGER"/>
<result column="max_charge" property="maxCharge" jdbcType="INTEGER"/>
<result column="apply_date_type" property="applyDateType" jdbcType="INTEGER"/>
<result column="check_state" property="checkState" jdbcType="INTEGER"/>
<result column="data_state" property="dataState" jdbcType="INTEGER"/>
<result column="create_op" property="createOp" jdbcType="BIGINT"/>
<result column="create_op_name" property="createOpName" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="modify_op" property="modifyOp" jdbcType="BIGINT"/>
<result column="modify_op_name" property="modifyOpName" jdbcType="VARCHAR"/>
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,
rule_no,
org_id,
rule_type,
cross_time_rule_type,
car_type,
frist_free_time,
day_max_charge,
max_charge,
apply_date_type,
check_state,
data_state,
create_op,
create_op_name,
create_time,
modify_op,
modify_op_name,
modify_time
</sql>
<update id="deleteBillingRuleByRuleNos">
UPDATE t_billing_rule
SET data_state = 0
WHERE
data_state = 1
AND rule_no IN
<foreach collection="ruleNos" item="ruleNo" open="(" close=")" separator="," index="index">
#{ruleNo}
</foreach>
</update>
<select id="queryBillingRuleByPlNos" resultType="com.zteits.bill.domain.TBillingRule">
SELECT
y.rule_collect_no ruleCollectNo,
y.rule_collect_name ruleCollectName,
y.modify_time ruleCollectModifyDate,
y.free_time_type freeTimeType,
y.day_start_time dayStartTime,
y.day_end_time dayEndTime,
x.modify_time ruleCollectParkRelModifyDate,
z.id id,
z.rule_no ruleNo,
z.org_id orgId,
z.rule_type ruleType,
z.cross_time_rule_type crossTimeRuleType,
z.car_type carType,
z.frist_free_time fristFreeTime,
z.day_max_charge dayMaxCharge,
z.max_charge maxCharge,
z.apply_date_type applyDateType,
z.check_state checkState,
z.data_state dataState,
z.create_op createOp,
z.create_op_name createOpName,
z.create_time createTime,
z.modify_op modifyOp,
z.modify_op_name modifyOpName,
z.modify_time modifyTime
FROM (SELECT * from t_billing_park_rule_rel where pl_no in
<foreach collection="plNos" index="index" item="plNo" separator="," open="(" close=")">
#{plNo}
</foreach>
AND effect_time <= now() AND expire_time >= now()
) x
LEFT JOIN t_billing_rule_collect y ON x.rule_collect_no = y.rule_collect_no AND x.data_state = 1 AND
y.data_state = 1
LEFT JOIN t_billing_rule z ON y.rule_no = z.rule_no AND z.data_state = 1
ORDER BY y.rule_collect_name ;
</select>
<select id="queryBillingRuleByRuleNos" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_billing_rule WHERE data_state = 1 AND check_state = 3 AND rule_no IN
<foreach collection="ruleNos" item="ruleNo" open="(" close=")" separator="," index="index">
#{ruleNo}
</foreach>
</select>
<select id="queryBillingRuleByCollectNo" resultMap="BaseResultMap">
SELECT n.*,
m.free_time_type
FROM t_billing_rule_collect m,
t_billing_rule n
WHERE m.data_state = 1
AND n.data_state = 1
AND n.check_state = 3
AND m.rule_no = n.rule_no
AND m.rule_collect_no = #{collectNo}
</select>
</mapper>