SettingPaymentMethodMapper.xml
6.53 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?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.diligrp.etrade.admin.dao.SettingPaymentMethodMapper">
<resultMap id="BaseResultMap" type="com.diligrp.etrade.admin.model.SettingPaymentMethod">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="marketId" column="market_id" jdbcType="BIGINT"/>
<result property="methodCode" column="method_code" jdbcType="BIGINT"/>
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
<result property="modifiedTime" column="modified_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,market_id,method_code,
created_time,modified_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from setting_payment_method
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from setting_payment_method
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.diligrp.etrade.admin.model.SettingPaymentMethod" useGeneratedKeys="true">
insert into setting_payment_method
( id,market_id,method_code
,created_time,modified_time)
values (#{id,jdbcType=BIGINT},#{marketId,jdbcType=BIGINT},#{methodCode,jdbcType=BIGINT}
,#{createdTime,jdbcType=TIMESTAMP},#{modifiedTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.diligrp.etrade.admin.model.SettingPaymentMethod" useGeneratedKeys="true">
insert into setting_payment_method
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="marketId != null">market_id,</if>
<if test="methodCode != null">method_code,</if>
<if test="createdTime != null">created_time,</if>
<if test="modifiedTime != null">modified_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id,jdbcType=BIGINT},</if>
<if test="marketId != null">#{marketId,jdbcType=BIGINT},</if>
<if test="methodCode != null">#{methodCode,jdbcType=BIGINT},</if>
<if test="createdTime != null">#{createdTime,jdbcType=TIMESTAMP},</if>
<if test="modifiedTime != null">#{modifiedTime,jdbcType=TIMESTAMP},</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.diligrp.etrade.admin.model.SettingPaymentMethod">
update setting_payment_method
<set>
<if test="marketId != null">
market_id = #{marketId,jdbcType=BIGINT},
</if>
<if test="methodCode != null">
method_code = #{methodCode,jdbcType=BIGINT},
</if>
<if test="createdTime != null">
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedTime != null">
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.diligrp.etrade.admin.model.SettingPaymentMethod">
update setting_payment_method
set
market_id = #{marketId,jdbcType=BIGINT},
method_code = #{methodCode,jdbcType=BIGINT},
created_time = #{createdTime,jdbcType=TIMESTAMP},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="selectAllType" resultType="com.diligrp.etrade.admin.domain.SettingPaymentMethodDto">
select spmt.code methodCode,
spmt.name methodName,
spmc.code classificationCode,
spmc.name classificationName
from setting_payment_method_type spmt
left join setting_payment_method_classification spmc on
spmt.classification_code = spmc.code;
</select>
<select id="selectTypeByMarketId" resultType="com.diligrp.etrade.admin.domain.SettingPaymentMethodDto">
select spmt.code methodCode,
spmt.name methodName,
spm.market_id marketId,
spmc.name classificationName,
spmc.code classificationCode
from setting_payment_method_type spmt
inner join setting_payment_method_classification spmc on spmt.classification_code = spmc.code
inner join setting_payment_method spm on spmt.code = spm.method_code
where 1 = 1
<if test="marketId != null">
and market_id = #{marketId,jdbcType=BIGINT}
</if>
</select>
<select id="selectTypeByMarketIds" resultType="com.diligrp.etrade.admin.domain.SettingPaymentMethodDto">
select spmt.code methodCode,
spmt.name methodName,
spm.market_id marketId,
spmc.name classificationName,
spmc.code classificationCode
from setting_payment_method_type spmt
inner join setting_payment_method_classification spmc on spmt.classification_code = spmc.code
inner join setting_payment_method spm on spmt.code = spm.method_code
where 1 = 1
<if test="marketIds != null and marketIds.size()>0">
and spm.market_id in
<foreach collection="marketIds" open="(" separator="," close=")" item="marketId">
#{marketId}
</foreach>
</if>
</select>
<!-- 批量新增数据 -->
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into setting_payment_method(market_id,method_code)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.marketId},#{entity.methodCode})
</foreach>
</insert>
<delete id="deleteBy" parameterType="java.lang.Long">
delete from setting_payment_method
where 1 = 1
<if test="marketId != null">
and market_id = #{marketId,jdbcType=BIGINT}
</if>
<if test="methodCode != null">
and method_code = #{methodCode,jdbcType=BIGINT}
</if>
</delete>
</mapper>