<?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>