TActivityDiscountSMapper.xml
4.63 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.TActivityDiscountSMapper">
<resultMap id="BaseResultMap" type="com.zteits.bill.domain.TActivityDiscount">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="pl_no" jdbcType="VARCHAR" property="plNo"/>
<result column="disc_no" jdbcType="VARCHAR" property="discNo"/>
<result column="disc_name" jdbcType="VARCHAR" property="discName"/>
<result column="begin_time" jdbcType="TIMESTAMP" property="beginTime"/>
<result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
<result column="disc_res" jdbcType="INTEGER" property="discRes"/>
<result column="disc_type" jdbcType="INTEGER" property="discType"/>
<result column="disc_state" jdbcType="INTEGER" property="discState"/>
<result column="auditor_status" jdbcType="INTEGER" property="auditorStatus"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="data_state" jdbcType="INTEGER" property="dataState"/>
<result column="create_empid" jdbcType="VARCHAR" property="createEmpid"/>
<result column="create_name" jdbcType="VARCHAR" property="createName"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="modify_empid" jdbcType="VARCHAR" property="modifyEmpid"/>
<result column="modify_name" jdbcType="VARCHAR" property="modifyName"/>
<result column="modify_date" jdbcType="TIMESTAMP" property="modifyDate"/>
</resultMap>
<sql id="Base_Column_List">
id,
pl_no,
disc_no,
disc_name,
begin_time,
end_time,
disc_res,
disc_type,
disc_state,
auditor_status,
remarks,
data_state,
create_empid,
create_name,
create_date,
modify_empid,
modify_name,
modify_date
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_activity_discount
where id = #{id,jdbcType=BIGINT}
</select>
<!-- 分页查询 -->
<select id="queryDiscountRuleForPage" resultMap="BaseResultMap"
parameterType="com.zteits.clouds.api.dto.bill.discount.param.DiscountRuleForPageRequest">
select
a.id,
a.disc_no,
a.disc_name,
a.pl_no,
a.disc_type,
a.begin_time,
a.end_time,
a.disc_state
FROM t_activity_discount a
where a.data_state = 1
<if test="discName != null and discName !=''">
and a.disc_name like CONCAT('%','${discName}','%' )
</if>
<if test="plNos != null and plNos.size >0">
and a.pl_no in
<foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
#{plNo}
</foreach>
</if>
<if test="discState != null and discState != 3 ">
and a.disc_state = #{discState}
</if>
<if test="endDate != null ">
and DATE(a.end_time) = #{endDate}
</if>
Order by a.create_date desc
</select>
<!--通过停车场编码校验折扣唯一性-->
<select id="checkDiscountUniqueByPlNo"
parameterType="com.zteits.clouds.api.dto.bill.discount.param.CheckDiscountUniqueByPlNoRequest"
resultType="java.lang.Integer">
SELECT
count(1)
FROM
t_activity_discount a
WHERE
a.data_state = 1
and a.pl_no = #{plNo}
and a.disc_type = #{discType}
</select>
<select id="queryDiscountByPlNos" resultType="com.zteits.bill.domain.TActivityDiscount">
SELECT
a.pl_no AS plNo,
a.disc_no AS discNo,
a.disc_name AS discName,
a.begin_time AS beginTime,
a.end_time AS endTime,
a.disc_res AS discRes,
a.disc_type AS discType,
a.disc_state AS discState,
a.auditor_status AS auditorStatus,
a.data_state AS dataState
FROM
t_activity_discount a
WHERE
a.data_state = 1
AND a.pl_no = #{plNo}
</select>
<update id="updateDiscountRuleExpireDateByPlNos">
UPDATE t_activity_discount
SET data_state = 0,
modify_date = #{nowDate}
WHERE data_state = 1
and disc_type = #{discType}
and disc_no = #{discNo}
</update>
</mapper>