SalesCategoryMapper.xml 6.28 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}
	</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>
	<insert id="insertSelective" parameterType="com.yoho.search.dal.model.SalesCategory">
		insert into sales_category
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="categoryId != null">
				category_id,
			</if>
			<if test="categoryName != null">
				category_name,
			</if>
			<if test="relationParameter != null">
				relation_parameter,
			</if>
			<if test="relationUrl != null">
				relation_url,
			</if>
			<if test="parentId != null">
				parent_id,
			</if>
			<if test="orderBy != null">
				order_by,
			</if>
			<if test="icon != null">
				icon,
			</if>
			<if test="categoryCode != null">
				category_code,
			</if>
			<if test="state != null">
				state,
			</if>
			<if test="levelNumber != null">
				level_number,
			</if>
			<if test="createTime != null">
				create_time,
			</if>
			<if test="appType != null">
				app_type,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="categoryId != null">
				#{categoryId,jdbcType=INTEGER},
			</if>
			<if test="categoryName != null">
				#{categoryName,jdbcType=VARCHAR},
			</if>
			<if test="relationParameter != null">
				#{relationParameter,jdbcType=VARCHAR},
			</if>
			<if test="relationUrl != null">
				#{relationUrl,jdbcType=VARCHAR},
			</if>
			<if test="parentId != null">
				#{parentId,jdbcType=INTEGER},
			</if>
			<if test="orderBy != null">
				#{orderBy,jdbcType=INTEGER},
			</if>
			<if test="icon != null">
				#{icon,jdbcType=VARCHAR},
			</if>
			<if test="categoryCode != null">
				#{categoryCode,jdbcType=VARCHAR},
			</if>
			<if test="state != null">
				#{state,jdbcType=INTEGER},
			</if>
			<if test="levelNumber != null">
				#{levelNumber,jdbcType=INTEGER},
			</if>
			<if test="createTime != null">
				#{createTime,jdbcType=INTEGER},
			</if>
			<if test="appType != null">
				#{appType,jdbcType=TINYINT},
			</if>
		</trim>
	</insert>
	<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.SalesCategory">
		update sales_category
		<set>
			<if test="categoryName != null">
				category_name = #{categoryName,jdbcType=VARCHAR},
			</if>
			<if test="relationParameter != null">
				relation_parameter =
				#{relationParameter,jdbcType=VARCHAR},
			</if>
			<if test="relationUrl != null">
				relation_url = #{relationUrl,jdbcType=VARCHAR},
			</if>
			<if test="parentId != null">
				parent_id = #{parentId,jdbcType=INTEGER},
			</if>
			<if test="orderBy != null">
				order_by = #{orderBy,jdbcType=INTEGER},
			</if>
			<if test="icon != null">
				icon = #{icon,jdbcType=VARCHAR},
			</if>
			<if test="categoryCode != null">
				category_code = #{categoryCode,jdbcType=VARCHAR},
			</if>
			<if test="state != null">
				state = #{state,jdbcType=INTEGER},
			</if>
			<if test="levelNumber != null">
				level_number = #{levelNumber,jdbcType=INTEGER},
			</if>
			<if test="createTime != null">
				create_time = #{createTime,jdbcType=INTEGER},
			</if>
			<if test="appType != null">
				app_type = #{appType,jdbcType=TINYINT},
			</if>
		</set>
		where category_id = #{categoryId,jdbcType=INTEGER}
	</update>
	<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>