AccDiscountsProportionDetailMapper.xml
5.2 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
<?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.sibu.orderHelper.integral.web.dao.AccDiscountsProportionDao">
<sql id="Base_Column_List">
id,start_amount,end_amount,rate,create_sys_user_id,update_sys_user_id,create_date,update_date
</sql>
<resultMap id="BaseResultMap" type="com.sibu.orderHelper.integral.model.AccDiscountsProportionDetail">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="start_amount" jdbcType="DECIMAL" property="startAmount"/>
<result column="end_amount" jdbcType="DECIMAL" property="endAmount"/>
<result column="rate" jdbcType="DECIMAL" property="rate"/>
<result column="create_sys_user_id" jdbcType="VARCHAR" property="createSysUserId" />
<result column="update_sys_user_id" jdbcType="VARCHAR" property="updateSysUserId" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDt"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDt"/>
</resultMap>
<select id="getAccDiscountsProportionDetail" parameterType="java.lang.String" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from acc_discounts_proportion_detail
where id = #{id}
</select>
<delete id="deleteAccDiscountsProportionDetail" parameterType="java.lang.String">
delete from acc_discounts_proportion_detail where id = #{id}
</delete>
<insert id="insertAccDiscountsProportionDetail" parameterType="com.sibu.orderHelper.integral.model.AccDiscountsProportionDetail">
insert into acc_discounts_proportion_detail (id, start_amount,end_amount,rate,create_sys_user_id,update_sys_user_id,
create_date,update_date)
values (#{id,jdbcType=VARCHAR},#{startAmount,jdbcType=DECIMAL},#{endAmount,jdbcType=DECIMAL},#{rate,jdbcType=DECIMAL},
#{createSysUserId,jdbcType=VARCHAR},#{updateSysUserId,jdbcType=VARCHAR},NOW(),NOW())
</insert>
<update id="updateAccDiscountsProportionDetail" parameterType="com.sibu.orderHelper.integral.model.AccDiscountsProportionDetail">
update acc_discounts_proportion_detail
set start_amount = #{startAmount,jdbcType=DECIMAL},end_amount = #{endAmount,jdbcType=DECIMAL},rate = #{rate,jdbcType=DECIMAL},
update_sys_user_id = #{updateSysUserId,jdbcType=VARCHAR}, update_date = NOW()
where id = #{id,jdbcType=VARCHAR}
</update>
<!-- 批量保存 -->
<insert id="batchSaveDiscountsProportion" parameterType="java.util.List">
INSERT INTO acc_discounts_proportion_detail (
id, start_amount,end_amount,rate,create_sys_user_id,update_sys_user_id, create_date,update_date
) VALUES
<foreach collection="list" item="dp" separator=",">
(#{dp.id},#{dp.startAmount},#{dp.endAmount},#{dp.rate},
#{dp.createSysUserId}, #{dp.updateSysUserId},now(),now())
</foreach>
</insert>
<!-- 批量删除 -->
<delete id="batchDeleteDiscountsProportion" parameterType="java.util.List">
DELETE FROM acc_discounts_proportion_detail WHERE id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<select id="listAccDiscountsProportionDetail" resultMap="BaseResultMap" parameterType="map">
select <include refid="Base_Column_List" />
from acc_discounts_proportion_detail
where 1=1
<if test="startAmount != null and startAmount !=''">
and start_amount > #{startAmount}
</if>
<if test="endAmount != null and endAmount !=''">
<![CDATA[
and end_amount < #{endAmount}
]]>
</if>
<if test="startDate != null and startDate !=''">
and create_date >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
<![CDATA[
and create_date <= #{endDate}
]]>
</if>
order by create_date desc
LIMIT ${pageNow}, ${pageSize}
</select>
<select id="totalAccDiscountsProportionDetail" resultType="java.lang.Integer" parameterType="map">
select COUNT(*) from acc_discounts_proportion_detail
where 1=1
<if test="startAmount != null and startAmount !=''">
and start_amount > #{startAmount}
</if>
<if test="endAmount != null and endAmount !=''">
<![CDATA[
and end_amount < #{endAmount}
]]>
</if>
<if test="startDate != null and startDate !=''">
and create_date >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
<![CDATA[
and create_date <= #{endDate}
]]>
</if>
</select>
<select id="listAcquireDiscountsRateByamount" resultMap="BaseResultMap" parameterType="map">
select <include refid="Base_Column_List" />
from acc_discounts_proportion_detail
where #{amount} >=start_amount
<![CDATA[
and #{amount} < end_amount
]]>
ORDER BY rate asc
</select>
<select id="discountsProportionList" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from acc_discounts_proportion_detail
</select>
</mapper>