TActivityAbcbankDiscountDescSMapper.xml
5.32 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
<?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.TActivityAbcbankDiscountDescSMapper">
<resultMap id="BaseResultMap" type="com.zteits.bill.domain.TActivityAbcbankDiscountDesc">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="disc_no" jdbcType="VARCHAR" property="discNo" />
<result column="recharge_amount" jdbcType="BIGINT" property="rechargeAmount" />
<result column="Fixed_disc" jdbcType="INTEGER" property="fixedDisc" />
<result column="subsidy_disc" jdbcType="INTEGER" property="subsidyDisc" />
<result column="remarks" jdbcType="VARCHAR" property="remarks" />
<result column="data_state" jdbcType="INTEGER" property="dataState" />
<result column="create_emp_id" jdbcType="VARCHAR" property="createEmpId" />
<result column="create_name" jdbcType="VARCHAR" property="createName" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="modify_emp_id" jdbcType="VARCHAR" property="modifyEmpId" />
<result column="modify_name" jdbcType="VARCHAR" property="modifyName" />
<result column="modify_date" jdbcType="TIMESTAMP" property="modifyDate" />
<result column="org_id" jdbcType="BIGINT" property="orgId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, disc_no, recharge_amount, Fixed_disc, subsidy_disc, remarks, data_state, create_emp_id,
create_name, create_date, modify_emp_id, modify_name, modify_date, org_id
</sql>
<!-- 修改保存时先删除原来的规则详情 -->
<delete id="deleteTActivityAbcbankDiscountDesc" parameterType="java.lang.String">
delete from t_activity_abcbank_discount_desc
where disc_no = #{discNo}
</delete>
<select id="queryTActivityAbcbankDiscountDescInfo" parameterType="com.zteits.clouds.api.dto.bill.param.TActivityAbcbankDiscountDescRequest"
resultType="com.zteits.bill.domain.TActivityAbcbankDiscountDesc">
select
id as id,
disc_no as discNo,
recharge_amount as rechargeAmount,
Fixed_disc as FixedDisc,
subsidy_disc as subsidyDisc
from t_activity_abcbank_discount_desc
where data_state = 1
and disc_no = #{discNo}
</select>
<!-- 获取具体折扣 -->
<select id="queryDescInfo" parameterType="com.zteits.clouds.api.dto.bill.param.TActivityAbcbankDiscountDescRequest"
resultType="com.zteits.bill.domain.TActivityAbcbankDiscountDesc">
SELECT
sc.id AS id,
sc.disc_no AS discNo,
sc.recharge_amount AS rechargeAmount,
sc.Fixed_disc AS FixedDisc,
sc.subsidy_disc AS subsidyDisc
FROM
t_activity_abcbank_discount_desc sc
LEFT JOIN t_activity_abcbank_discount t ON sc.disc_no = t.disc_no
WHERE
sc.data_state = 1
AND t.data_state =1
AND t.disc_state =1
AND sc.recharge_amount = #{rechargeAmount}
AND t.residue_limit_fee >= sc.recharge_amount * sc.Fixed_disc/100 * sc.subsidy_disc/100
limit 1
</select>
</mapper>