ResourcesContentDataMapper.xml
5.8 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
<?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.yoho.ufo.dal.ResourcesContentDataMapper">
<resultMap id="BaseResultMap" type="com.yoho.ufo.model.resource.ResourcesContentData" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="platform_id" property="platformId" jdbcType="INTEGER" />
<result column="sort_id" property="sortId" jdbcType="INTEGER" />
<result column="resource_content_id" property="resourceContentId" jdbcType="INTEGER" />
<result column="template_key" property="templateKey" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="publish_time" property="publishTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="pre_content_id" property="preContentId" jdbcType="INTEGER" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="content_data" property="contentData" jdbcType="VARCHAR" />
<result column="type" property="type" jdbcType="TINYINT" />
</resultMap>
<sql id="Base_Column_List">
id, platform_id, sort_id, resource_content_id, template_key, create_time, publish_time,update_time
, pre_content_id, status,content_data,type
</sql>
<insert id="insertOrUpdate">
INSERT INTO resources_content_data (id,
platform_id,
sort_id,
resource_content_id,
template_key,
content_data,
create_time,
publish_time,
pre_content_id,
status,
type
) VALUES (
#{param.id},
#{param.platformId},
#{param.sortId},
#{param.resourceContentId},
#{param.templateKey},
#{param.contentData},
#{param.createTime},
#{param.publishTime},
#{param.preContentId},
#{param.status},
#{param.type}) ON DUPLICATE KEY UPDATE
<if test="null != param.contentData">
content_data=#{param.contentData},
</if>
<if test="null != param.platformId">
platform_id=#{param.platformId},
</if>
<if test="null != param.sortId">
sort_id=#{param.sortId},
</if>
<if test="null != param.resourceContentId">
resource_content_id=#{param.resourceContentId},
</if>
<if test="null != param.templateKey">
template_key=#{param.templateKey},
</if>
<if test="null != param.publishTime">
publish_time=#{param.publishTime},
</if>
<if test="null != param.preContentId">
pre_content_id=#{param.preContentId},
</if>
<if test="null != param.status">
status=#{param.status},
</if>
<if test="null != param.type">
type=#{param.type},
</if>
update_time=#{param.updateTime}
</insert>
<update id="updateByResContentBo">
update resources_content_data set
<if test="null != param.contentData">
content_data=#{param.contentData},
</if>
<if test="null != param.platformId">
platform_id=#{param.platformId},
</if>
<if test="null != param.sortId">
sort_id=#{param.sortId},
</if>
<if test="null != param.resourceContentId">
resource_content_id=#{param.resourceContentId},
</if>
<if test="null != param.templateKey">
template_key=#{param.templateKey},
</if>
<if test="null != param.publishTime">
publish_time=#{param.publishTime},
</if>
<if test="null != param.preContentId">
pre_content_id=#{param.preContentId},
</if>
<if test="null != param.status">
status=#{param.status},
</if>
<if test="null != param.type">
type=#{param.type},
</if>
update_time=#{param.updateTime}
where id=#{param.id}
</update>
<select id="selectByContentIds" resultType="com.yoho.ufo.model.resource.ResourcesContentData">
select <include refid="Base_Column_List" /> from resources_content_data
where resource_content_id in
<foreach collection="list" open="(" close=")" item="id" separator=",">
#{id}
</foreach>
</select>
<select id="selectCodeById" resultType="java.lang.String">
select r.code from resources_content_data rcd left join resources_content rc on rcd.resource_content_id = rc.id inner join resources r on r.id=rc.resources_id
where rcd.id =#{id}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from resources_content_data
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.ufo.model.resource.ResourcesContentData" >
insert into resources_content_data (id, platform_id, sort_id,
resource_content_id, template_key, create_time,
publish_time, update_time, pre_content_id,
status, type, content_data
)
values (#{id,jdbcType=INTEGER}, #{platformId,jdbcType=INTEGER}, #{sortId,jdbcType=INTEGER},
#{resourceContentId,jdbcType=INTEGER}, #{templateKey,jdbcType=VARCHAR}, #{createTime,jdbcType=INTEGER},
#{publishTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER}, #{preContentId,jdbcType=INTEGER},
#{status,jdbcType=TINYINT}, #{type,jdbcType=TINYINT}, #{contentData,jdbcType=LONGVARCHAR}
)
</insert>
<delete id="deleteByContentIds">
delete from resources_content_data
where resource_content_id in
<foreach collection="resourceContentIds" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
</delete>
</mapper>