RuleChannelConfigDao.xml
6.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<?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.sy.mapper.RuleChannelConfigDao">
<resultMap id="BaseResultMap" type="com.sy.model.RuleChannelConfig">
<id column="config_id" jdbcType="INTEGER" property="configId" />
<result column="channel_num" jdbcType="VARCHAR" property="channelNum" />
<result column="business_type" jdbcType="VARCHAR" property="businessType" />
<result column="goods_type" jdbcType="VARCHAR" property="goodsType" />
<result column="rule_id" jdbcType="INTEGER" property="ruleId" />
<result column="config_order" jdbcType="TINYINT" property="configOrder" />
<result column="creat_time" jdbcType="TIMESTAMP" property="creatTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<resultMap id="WithRuleConf" extends="BaseResultMap" type="com.sy.model.RuleChannelConfig">
<association property="ruleConfig" javaType="com.sy.model.RuleConfig">
<result column="script_key" jdbcType="VARCHAR" property="scriptKey" />
<result column="script_method_name" jdbcType="VARCHAR" property="scriptMethodName" />
<result column="script_method_return" jdbcType="VARCHAR" property="scriptMethodReturn" />
<result column="rule_name" jdbcType="VARCHAR" property="ruleName" />
<result column="rule_type" jdbcType="VARCHAR" property="ruleType" />
</association>
</resultMap>
<sql id="Base_Column_List">
config_id, channel_num, business_type, goods_type, rule_id, config_order, creat_time,
update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from rule_channel_config
where config_id = #{configId,jdbcType=INTEGER}
</select>
<select id="selectByChannelAndBusiTypeAndGoodsType" parameterType="com.sy.model.RuleChannelConfig" resultMap="WithRuleConf">
SELECT
conf.channel_num,
conf.business_type,
conf.goods_type,
conf.config_order,
conf.rule_id,
rule.script_key,
rule.script_method_name,
rule.script_method_return,
rule.rule_name,
rule.rule_type
FROM
(
SELECT
channel_num,
business_type,
goods_type,
config_order,
rule_id
FROM
rule_channel_config
WHERE
channel_num = #{channelNum,jdbcType=VARCHAR}
AND business_type = #{businessType,jdbcType=VARCHAR}
AND goods_type = #{goodsType,jdbcType=VARCHAR}
) conf
LEFT JOIN
rule_config rule
ON
conf.rule_id = rule.rule_id
ORDER BY config_order
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from rule_channel_config
where config_id = #{configId,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="config_id" keyProperty="configId" parameterType="com.sy.model.RuleChannelConfig" useGeneratedKeys="true">
insert into rule_channel_config (channel_num, business_type, goods_type,
rule_id, config_order, creat_time,
update_time)
values (#{channelNum,jdbcType=VARCHAR}, #{businessType,jdbcType=VARCHAR}, #{goodsType,jdbcType=VARCHAR},
#{ruleId,jdbcType=INTEGER}, #{configOrder,jdbcType=TINYINT}, #{creatTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" keyColumn="config_id" keyProperty="configId" parameterType="com.sy.model.RuleChannelConfig" useGeneratedKeys="true">
insert into rule_channel_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="channelNum != null">
channel_num,
</if>
<if test="businessType != null">
business_type,
</if>
<if test="goodsType != null">
goods_type,
</if>
<if test="ruleId != null">
rule_id,
</if>
<if test="configOrder != null">
config_order,
</if>
<if test="creatTime != null">
creat_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="channelNum != null">
#{channelNum,jdbcType=VARCHAR},
</if>
<if test="businessType != null">
#{businessType,jdbcType=VARCHAR},
</if>
<if test="goodsType != null">
#{goodsType,jdbcType=VARCHAR},
</if>
<if test="ruleId != null">
#{ruleId,jdbcType=INTEGER},
</if>
<if test="configOrder != null">
#{configOrder,jdbcType=TINYINT},
</if>
<if test="creatTime != null">
#{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.sy.model.RuleChannelConfig">
update rule_channel_config
<set>
<if test="channelNum != null">
channel_num = #{channelNum,jdbcType=VARCHAR},
</if>
<if test="businessType != null">
business_type = #{businessType,jdbcType=VARCHAR},
</if>
<if test="goodsType != null">
goods_type = #{goodsType,jdbcType=VARCHAR},
</if>
<if test="ruleId != null">
rule_id = #{ruleId,jdbcType=INTEGER},
</if>
<if test="configOrder != null">
config_order = #{configOrder,jdbcType=TINYINT},
</if>
<if test="creatTime != null">
creat_time = #{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where config_id = #{configId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.sy.model.RuleChannelConfig">
update rule_channel_config
set channel_num = #{channelNum,jdbcType=VARCHAR},
business_type = #{businessType,jdbcType=VARCHAR},
goods_type = #{goodsType,jdbcType=VARCHAR},
rule_id = #{ruleId,jdbcType=INTEGER},
config_order = #{configOrder,jdbcType=TINYINT},
creat_time = #{creatTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where config_id = #{configId,jdbcType=INTEGER}
</update>
</mapper>