Blame view

src/main/resources/mapper/CatalogContentMapper.xml 3.4 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
        <result column="is_start" jdbcType="INTEGER" property="isStart"/>
f318719c   louyao   渠道商后台
16
17
18
19
20
21
    </resultMap>

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

962b0bfd   louyao   渠道商移动端
22
23
24
25
26
27
28
29
30
    <select id="getListByDate" resultMap="CatalogContentMap">
        select *,(case when start_time <![CDATA[>]]> getdate() then 0 when end_time <![CDATA[<]]> getdate() then 2 else 1 end ) as is_start from catalog_content
        <where>
            <if test="state != 0">
                and state=#{state}
            </if>
            <if test="catalogId != 0">
                and catalogId=#{catalogId}
            </if>
9a842bee   louyao   微信分享accesstoken做缓存处理
31
32
            <if test="date1 != null and date1!='' and date2!='' and date2!=null">
                and start_time <![CDATA[<=]]>#{date1} and end_time <![CDATA[>=]]>#{date2}
962b0bfd   louyao   渠道商移动端
33
34
35
36
37
            </if>
        </where>
        order by create_time
    </select>

f318719c   louyao   渠道商后台
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
    <insert id="insert" parameterType="com.sincere.wechatbusiness.model.CatalogContent">
    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!=''">
                title=#{title},
            </if>
            <if test="subtitle!=null and subtitle!=''">
                subtitle=#{subtitle},
            </if>
            <if test="startTime!=null and startTime!=''">
                start_time=#{startTime},
            </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>