BizChannelMapper.xml
5.91 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
166
167
168
169
170
171
172
<?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="cn.runsa.portal.base.dao.BizChannelMapper">
<resultMap id="BaseResultMap" type="cn.runsa.portal.base.entity.BizChannel">
<id column="becId" property="id" jdbcType="INTEGER" />
<result column="beId" property="beid" jdbcType="INTEGER" />
<result column="chId" property="chid" jdbcType="INTEGER" />
<result column="becLimit" property="limit" jdbcType="BIT" />
<result column="beParent" property="beparent" jdbcType="INTEGER" />
<result column="ptValid" property="valid" jdbcType="SMALLINT" />
<!-- 添加属性 -->
<result column="chName" property="chname" jdbcType="VARCHAR" />
<result column="chDesc" property="chdesc" jdbcType="VARCHAR" />
<result column="brName" property="brname" jdbcType="VARCHAR" />
<result column="brId" property="brid" jdbcType="VARCHAR" />
<result column="beName" property="bename" jdbcType="VARCHAR" />
<collection property="brandList" ofType="cn.runsa.portal.base.entity.Brand" column="brandList">
<id column="brId" jdbcType="INTEGER" property="id" />
<result column="brName" jdbcType="VARCHAR" property="name" />
<!-- 后续需要在增加 -->
</collection>
</resultMap>
<resultMap id="BizBrandResultMap" type="cn.runsa.portal.base.entity.BizBrand">
<id column="becId" property="becid" jdbcType="INTEGER" />
<result column="brId" property="brid" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
bec.becId, bec.beId, bec.chId, bec.becLimit, bec.beParent, bec.ptValid
</sql>
<select id="findById" resultMap="BaseResultMap" parameterType="cn.runsa.portal.base.entity.BizChannel">
select
<include refid="Base_Column_List" />
from mtBizChannel bec
where becId = #{id,jdbcType=INTEGER}
</select>
<select id="findByBecId" resultMap="BaseResultMap" parameterType="java.lang.Integer">
SELECT
t1.becId,
t1.beId,
t1.beParent,
t1.ptValid,
t1.chId,
GROUP_CONCAT(DISTINCT t2.brId) brId,
t3.chName,
t3.chDesc,
GROUP_CONCAT(DISTINCT t4.brName) brName,
t5.beName
FROM
mtBizChannel t1
LEFT JOIN mtBizBrand t2 ON t1.becId = t2.becId
LEFT JOIN mtchannel t3 ON t3.chId=t1.chId
LEFT JOIN mtbrand t4 on t4.brId=t2.brId
LEFT JOIN mtbizentity t5 on t5.beId=t1.beParent
where t1.becId=#{becid,jdbcType=INTEGER}
GROUP BY t1.becId
</select>
<select id="findBecId" parameterType="java.lang.Integer" resultType="java.lang.Integer">
select becId from mtBizChannel where beId = #{beid,jdbcType=INTEGER}
</select>
<select id="findList" resultMap="BaseResultMap" parameterType="cn.runsa.portal.base.entity.BizChannel">
select
<include refid="Base_Column_List" />
,
br.brId,
br.brName
FROM
mtBizChannel bec,
mtBizBrand bb,
mtBrand br
WHERE
bec.becId=bb.becId
AND bb.brId = br.brId
AND bec.beId = #{beid,jdbcType=INTEGER}
</select>
<delete id="delete" parameterType="java.lang.Integer">
delete from mtBizChannel
where becId = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteBybeId" parameterType="java.lang.Integer">
delete from mtBizChannel
where beId = #{beid,jdbcType=INTEGER}
</delete>
<insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="cn.runsa.portal.base.entity.BizChannel">
insert into mtBizChannel (beId, chId, becLimit,
beParent, ptValid)
values (#{beid,jdbcType=INTEGER}, #{chid,jdbcType=INTEGER}, #{limit,jdbcType=BIT},
#{beparent,jdbcType=INTEGER}, #{valid,jdbcType=SMALLINT})
</insert>
<insert id="insertSelective" useGeneratedKeys="true" keyProperty="id" parameterType="cn.runsa.portal.base.entity.BizChannel">
insert into mtBizChannel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="beid != null">
beId,
</if>
<if test="chid != null">
chId,
</if>
<if test="limit != null">
becLimit,
</if>
<if test="beparent != null">
beParent,
</if>
<if test="valid != null">
ptValid,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="beid != null">
#{beid,jdbcType=INTEGER},
</if>
<if test="chid != null">
#{chid,jdbcType=INTEGER},
</if>
<if test="limit != null">
#{limit,jdbcType=BIT},
</if>
<if test="beparent != null">
#{beparent,jdbcType=INTEGER},
</if>
<if test="valid != null">
#{valid,jdbcType=SMALLINT},
</if>
</trim>
</insert>
<update id="updateBrank" parameterType="java.util.Map">
update mtBizBrand set becId=#{becId,jdbcType=INTEGER} where becId=#{be,jdbcType=INTEGER}
</update>
<update id="updateSelective" parameterType="cn.runsa.portal.base.entity.BizChannel">
update mtBizChannel
<set>
<if test="beid != null">
beId = #{beid,jdbcType=INTEGER},
</if>
<if test="chid != null">
chId = #{chid,jdbcType=INTEGER},
</if>
<if test="limit != null">
becLimit = #{limit,jdbcType=BIT},
</if>
<if test="beparent != null">
beParent = #{beparent,jdbcType=INTEGER},
</if>
<if test="valid != null">
ptValid = #{valid,jdbcType=SMALLINT},
</if>
</set>
where becId = #{id,jdbcType=INTEGER}
</update>
<update id="update" parameterType="cn.runsa.portal.base.entity.BizChannel">
update mtBizChannel
set beId = #{beid,jdbcType=INTEGER},
chId = #{chid,jdbcType=INTEGER},
becLimit = #{limit,jdbcType=BIT},
beParent = #{beparent,jdbcType=INTEGER},
ptValid = #{valid,jdbcType=SMALLINT}
where becId = #{id,jdbcType=INTEGER}
</update>
<insert id="insertBizBr" parameterType="java.util.Map">
insert into mtBizBrand (becId,brId) values (#{id,jdbcType=INTEGER},#{brId,jdbcType=INTEGER})
</insert>
<delete id="deleteBizBr" parameterType="java.lang.Integer">
delete from mtBizBrand
where becId = #{id,jdbcType=INTEGER}
</delete>
<select id="findBizBrandByBeid" parameterType="java.lang.Integer" resultMap="BizBrandResultMap">
select t1.becId from mtBizBrand t1 left join mtBizChannel t2 on t1.becId=t2.becId where t2.beId = #{beid,jdbcType=INTEGER}
</select>
</mapper>