PortalArticleContentMapper.xml
3.13 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
<?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.credit.cy.business.mapper.PortalArticleContentMapper">
<resultMap type="PortalArticleContent" id="PortalArticleContentResult">
<result property="id" column="id" />
<result property="aid" column="aid" />
<result property="content" column="content" />
</resultMap>
<sql id="selectPortalArticleContentVo">
select id, aid, content from portal_article_content
</sql>
<select id="selectPortalArticleContentList" parameterType="PortalArticleContent" resultMap="PortalArticleContentResult">
<include refid="selectPortalArticleContentVo"/>
<where>
<if test="aid != null "> and aid = #{aid}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
</where>
</select>
<select id="selectPortalArticleContentById" parameterType="Long" resultMap="PortalArticleContentResult">
<include refid="selectPortalArticleContentVo"/>
where id = #{id}
</select>
<select id="selectPortalArticleContentByAid" parameterType="Long" resultMap="PortalArticleContentResult">
<include refid="selectPortalArticleContentVo"/>
where aid = #{id}
</select>
<insert id="insertPortalArticleContent" parameterType="PortalArticleContent" useGeneratedKeys="true" keyProperty="id">
insert into portal_article_content
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="aid != null">aid,</if>
<if test="content != null and content != ''">content,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="aid != null">#{aid},</if>
<if test="content != null and content != ''">#{content},</if>
</trim>
</insert>
<update id="updatePortalArticleContent" parameterType="PortalArticleContent">
update portal_article_content
<trim prefix="SET" suffixOverrides=",">
<if test="aid != null">aid = #{aid},</if>
<if test="content != null and content != ''">content = #{content},</if>
</trim>
where id = #{id}
</update>
<update id="updateArticleContentByAid" parameterType="PortalArticleContent">
update portal_article_content set content = #{content} where aid = #{aid}
</update>
<delete id="deletePortalArticleContentById" parameterType="Long">
delete from portal_article_content where id = #{id}
</delete>
<delete id="deletePortalArticleContentByIds" parameterType="String">
delete from portal_article_content where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deletePortalArticleContentByAidList" parameterType="Long">
delete from portal_article_content where aid in
<foreach item="aid" collection="list" open="(" separator="," close=")">
#{aid}
</foreach>
</delete>
</mapper>