Blame view

src/main/resources/mapper/CatalogContentMapper.xml 2.66 KB
f318719c   louyao   渠道商后台
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?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.sincere.wechatbusiness.mapper.CatalogContentMapper">
    <resultMap id="CatalogContentMap" type="com.sincere.wechatbusiness.model.CatalogContent">
        <id column="id" jdbcType="INTEGER" property="id" />
        <result column="catalogId" jdbcType="INTEGER" property="catalogId" />
        <result column="title" jdbcType="VARCHAR" property="title" />
        <result column="subtitle" jdbcType="VARCHAR" property="subtitle" />
        <result column="start_time" jdbcType="VARCHAR" property="startTime" />
        <result column="end_time" jdbcType="VARCHAR" property="endTime" />
        <result column="img_url" jdbcType="VARCHAR" property="imgUrl" />
        <result column="link_url" jdbcType="VARCHAR" property="linkUrl" />
        <result column="state" jdbcType="INTEGER" property="state"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
962b0bfd   louyao   渠道商移动端
15
    </resultMap>
f318719c   louyao   渠道商后台
16
17
18
19
20
21

    <select id="getList" parameterType="java.lang.Integer" resultMap="CatalogContentMap">
        select * from catalog_content where catalogId=#{id} and state=1 order by create_time
    </select>

    <insert id="insert" parameterType="com.sincere.wechatbusiness.model.CatalogContent">
962b0bfd   louyao   渠道商移动端
22
23
24
25
26
27
28
29
30
    insert into catalog_content (catalogId, title,subtitle,start_time,end_time,img_url,link_url)
    values (#{catalogId,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{subtitle,jdbcType=VARCHAR},
    #{startTime,jdbcType=VARCHAR}, #{endTime,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}, #{linkUrl,jdbcType=VARCHAR})
    </insert>

    <update id="update" parameterType="com.sincere.wechatbusiness.model.CatalogContent">
        update catalog_content
        <trim prefix="set" suffixOverrides=",">
            <if test="title!=null and title!=''">
9a842bee   louyao   微信分享accesstoken做缓存处理
31
32
                title=#{title},
            </if>
962b0bfd   louyao   渠道商移动端
33
34
35
36
37
            <if test="subtitle!=null and subtitle!=''">
                subtitle=#{subtitle},
            </if>
            <if test="startTime!=null and startTime!=''">
                start_time=#{startTime},
f318719c   louyao   渠道商后台
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
            </if>
            <if test="endTime!=null and endTime!=''">
                end_time=#{endTime},
            </if>
            <if test="imgUrl!=null and imgUrl!=''">
                img_url=#{imgUrl},
            </if>
            <if test="linkUrl!=null and linkUrl!=''">
                link_url=#{linkUrl},
            </if>
        </trim>
        where id = #{id}
    </update>

    <update id="deleteCatalogContent" parameterType="java.lang.Integer">
        update catalog_content set state=0 where id = #{id}
    </update>
</mapper>