DynamicRuleDetailsMapper.xml 2.06 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.DynamicRuleDetailsMapper">
	<resultMap id="DynamicRuleDetailsResultMap" type="com.yoho.search.dal.model.DynamicRuleDetails">
		<id column="id" property="id" jdbcType="INTEGER" />
		<result column="rule_id" property="ruleId" 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="DynamicRuleDetails_Column_List">
		id, rule_id, field, field_values, boost
	</sql>

	<insert id="insert" parameterType="com.yoho.search.dal.model.DynamicRuleDetails">
		insert ignore into dynamic_rule_details (id, rule_id, field, field_values, boost)
		values (#{id, jdbcType=INTEGER},
		#{ruleId, jdbcType=INTEGER},
		#{field, jdbcType=VARCHAR},
		#{fieldValues, jdbcType=VARCHAR},
		#{boost, jdbcType=INTEGER})
	</insert>

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

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

	<update id="updateById" parameterType="com.yoho.search.dal.model.DynamicRuleDetails">
		update dynamic_rule_details
		set rule_id = #{ruleId, 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_details where id = #{id, jdbcType=INTEGER}
	</delete>
</mapper>