SalesCategoryMapper.xml 3.29 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.yoho.search.dal.SalesCategoryMapper">

    <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.SalesCategory">
		<id column="category_id" property="categoryId" jdbcType="INTEGER" />
		<result column="category_name" property="categoryName" jdbcType="VARCHAR" />
		<result column="relation_parameter" property="relationParameter" jdbcType="VARCHAR" />
		<result column="relation_url" property="relationUrl" jdbcType="VARCHAR" />
		<result column="parent_id" property="parentId" jdbcType="INTEGER" />
		<result column="order_by" property="orderBy" jdbcType="INTEGER" />
		<result column="icon" property="icon" jdbcType="VARCHAR" />
		<result column="category_code" property="categoryCode" jdbcType="VARCHAR" />
		<result column="state" property="state" jdbcType="INTEGER" />
		<result column="level_number" property="levelNumber" jdbcType="INTEGER" />
		<result column="create_time" property="createTime" jdbcType="INTEGER" />
		<result column="app_type" property="appType" jdbcType="INTEGER" />
	</resultMap>

    <sql id="Base_Column_List">
		category_id, category_name, relation_parameter,
		relation_url, parent_id, order_by,
		icon, category_code, state,
		level_number, create_time, app_type
	</sql>

    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
		parameterType="java.lang.Integer">
		select
		<include refid="Base_Column_List" />
		from sales_category
		where category_id = #{categoryId,jdbcType=INTEGER}
        limit 1
	</select>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
		delete from
		sales_category
		where category_id = #{categoryId,jdbcType=INTEGER}
	</delete>

    <insert id="insert" parameterType="com.yoho.search.dal.model.SalesCategory">
		insert into sales_category
		(category_id, category_name,
		relation_parameter,
		relation_url,
		parent_id, order_by,
		icon, category_code, state,
		level_number,
		create_time, app_type
		)
		values (#{categoryId,jdbcType=INTEGER},
		#{categoryName,jdbcType=VARCHAR},
		#{relationParameter,jdbcType=VARCHAR},
		#{relationUrl,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER},
		#{orderBy,jdbcType=INTEGER},
		#{icon,jdbcType=VARCHAR},
		#{categoryCode,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER},
		#{levelNumber,jdbcType=INTEGER}, #{createTime,jdbcType=INTEGER},
		#{appType,jdbcType=TINYINT}
		)
	</insert>


	<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.SalesCategory">
		update
		sales_category
		set category_name = #{categoryName,jdbcType=VARCHAR},
		relation_parameter = #{relationParameter,jdbcType=VARCHAR},
		relation_url = #{relationUrl,jdbcType=VARCHAR},
		parent_id =
		#{parentId,jdbcType=INTEGER},
		order_by = #{orderBy,jdbcType=INTEGER},
		icon = #{icon,jdbcType=VARCHAR},
		category_code =
		#{categoryCode,jdbcType=VARCHAR},
		state = #{state,jdbcType=INTEGER},
		level_number = #{levelNumber,jdbcType=INTEGER},
		create_time =
		#{createTime,jdbcType=INTEGER},
		app_type = #{appType,jdbcType=TINYINT}
		where category_id = #{categoryId,jdbcType=INTEGER}
	</update>

    <select id="selectAll" resultMap="BaseResultMap" timeout="20000">
		select
		<include refid="Base_Column_List" />
		from sales_category
	</select>

</mapper>