DynamicRuleMapper.xml 2.21 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.DynamicRuleMapper">
	<resultMap id="DynamicRuleResultMap" type="com.yoho.search.dal.model.DynamicRule">
		<id column="id" property="id" jdbcType="INTEGER" />
		<result column="name" property="name" jdbcType="VARCHAR" />
		<result column="status" property="status" jdbcType="INTEGER" />
		<result column="type" property="type" jdbcType="INTEGER" />
		<result column="field" property="field" jdbcType="VARCHAR" />
		<result column="field_values" property="fieldValues" jdbcType="VARCHAR" />
		<result column="boost" property="boost" jdbcType="INTEGER" />
	</resultMap>
	<sql id="DynamicRule_Column_List">
		id, name, status, type, field, field_values, boost
	</sql>

	<insert id="insert" parameterType="com.yoho.search.dal.model.DynamicRule">
		insert ignore into dynamic_rule (id, name, status, type, field, field_values, boost)
		values (#{id, jdbcType=INTEGER},
		#{name, jdbcType=VARCHAR},
		#{status, jdbcType=INTEGER},
		#{type, jdbcType=INTEGER},
		#{field, jdbcType=VARCHAR},
		#{fieldValues, jdbcType=VARCHAR},
		#{boost, jdbcType=INTEGER})
	</insert>

	<select id="selectById" resultMap="DynamicRuleResultMap" parameterType="java.lang.Integer">
		select <include refid="DynamicRule_Column_List"/> from dynamic_rule where id = #{id, jdbcType=INTEGER}
	</select>

	<select id="selectByRuleIdList" resultMap="DynamicRuleResultMap">
		select <include refid="DynamicRule_Column_List"/> from dynamic_rule where id in
		<foreach item="item" index="index" collection="list" open="("
				 separator="," close=")">
			#{item}
		</foreach>
	</select>

	<update id="updateById" parameterType="com.yoho.search.dal.model.DynamicRule">
		update dynamic_rule
		set name = #{name,jdbcType=VARCHAR},
		status = #{status, jdbcType=INTEGER},
		type = #{type, jdbcType=INTEGER},
		field = #{field,jdbcType=VARCHAR},
		field_values = #{fieldValues,jdbcType=VARCHAR},
		boost = #{boost, jdbcType=INTEGER}
		where id = #{id, jdbcType=INTEGER}
	</update>

	<delete id="delete" parameterType="java.lang.Integer">
		delete from dynamic_rule where id = #{id, jdbcType=INTEGER}
	</delete>
</mapper>