CatalogContentMapper.xml
2.66 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
<?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" />
</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>
<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>