DynSegWordMapper.xml 1.42 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.DynSegWordMapper">
	<resultMap id="DynSegWordResultMap" type="com.yoho.search.dal.model.DynSegWord">
		<id column="id" property="id" jdbcType="INTEGER" />
		<result column="word_type" property="wordType" jdbcType="INTEGER" />
		<result column="word" property="word" jdbcType="VARCHAR" />
		<result column="last_update_time" property="lastUpdateTime"
			jdbcType="INTEGER" />
	</resultMap>
	<sql id="DynSegWord_Column_List">
		id, word_type, word, last_update_time
	</sql>

	<insert id="insertBatch" parameterType="java.util.List" timeout="20000">
		insert ignore into dyn_seg_word (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="selectByWordType" resultMap="DynSegWordResultMap"
		timeout="20000">
		select
		<include refid="DynSegWord_Column_List" />
		from dyn_seg_word where word_type = #{wordType,jdbcType=INTEGER}
	</select>

	<select id="selectWordsCount" resultType="java.lang.Integer"
		timeout="20000">
		SELECT count(1) FROM dyn_seg_word where
		last_update_time >=
		#{updateSinceThisTime,jdbcType=INTEGER} LIMIT 1
	</select>
</mapper>