CatalogMapper.xml
1.71 KB
<?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.CatalogMapper">
<resultMap id="CatalogMap" type="com.sincere.wechatbusiness.model.Catalog">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="channelId" jdbcType="INTEGER" property="channelId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="state" jdbcType="INTEGER" property="state"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<select id="getList" parameterType="java.lang.Integer" resultMap="CatalogMap">
select * from catalog where channelId=#{channelId} and state=1 and sort!=6 order by sort
</select>
<select id="getDetail" parameterType="com.sincere.wechatbusiness.model.Catalog" resultMap="CatalogMap">
select * from catalog where channelId=#{channelId} and sort=#{sort} and state=1
</select>
<insert id="insert" parameterType="com.sincere.wechatbusiness.model.Catalog" useGeneratedKeys="true" keyProperty="id">
insert into catalog (channelId, name,sort)
values (#{channelId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}
)
</insert>
<update id="update" parameterType="com.sincere.wechatbusiness.model.Catalog">
update catalog
<trim prefix="set" suffixOverrides=",">
<if test="name!=null and name!=''">
name=#{name},
</if>
</trim>
where id = #{id}
</update>
</mapper>