EsWordDefMapper.xml 2.09 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.EsWordDefMapper">
	<insert id="insert" parameterType="com.yoho.search.dal.model.EsWordDef" timeout="20000">
		insert ignore into es_word_def (id, word_type, word, status, last_update_time)
		values (#{id, jdbcType=INTEGER},#{wordType, jdbcType=INTEGER},#{word, jdbcType=VARCHAR},#{status, jdbcType=INTEGER},#{lastUpdateTime, jdbcType=INTEGER})
	</insert>

	<insert id="insertBatch" parameterType="java.util.List" timeout="20000">
		insert ignore into es_word_def (word_type, word, last_update_time)
		values
		<foreach collection="list" item="item" index="index"
			separator=",">
			(#{item.wordType, jdbcType=INTEGER},
			#{item.word, jdbcType=VARCHAR},
			#{item.lastUpdateTime, jdbcType=INTEGER})
		</foreach>
	</insert>

	<select id="selectCountByPrimaryKey" resultType="java.lang.Integer"
			parameterType="java.lang.Integer" timeout="20000">
		select count(id) COUNT from es_word_def where id = #{id, jdbcType=INTEGER} LIMIT 1
	</select>

	<select id="selectByWordType" resultType="java.lang.String"
		timeout="20000">
		select word from es_word_def where word_type = #{wordType, jdbcType=INTEGER}
	</select>

	<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.EsWordDef" timeout="20000">
		update es_word_def
		set word_type = #{wordType,jdbcType=INTEGER},
		word = #{word, jdbcType=VARCHAR},
		status = #{status, jdbcType=INTEGER},
		last_update_time = #{lastUpdateTime, jdbcType=INTEGER}
		where id = #{id, jdbcType=INTEGER}
	</update>

	<update id="updateStatusBatch" timeout="60000">
		update es_word_def set status = #{status, jdbcType=INTEGER},
		last_update_time = #{lastUpdateTime, jdbcType=INTEGER}
		where word in
		<foreach item="item" index="index" collection="list" open="("
			separator="," close=")">
			#{item}
		</foreach>
	</update>

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