SpiderContentMapper.xml 1.79 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.SpiderContentMapper">
	<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.SpiderContent">
		<id column="id" property="id" jdbcType="INTEGER" />
		<result column="subject" property="subject" jdbcType="VARCHAR" />
		<result column="summary" property="summary" jdbcType="VARCHAR" />
		<result column="content" property="content" jdbcType="VARCHAR" />
		<result column="url" property="url" jdbcType="VARCHAR" />
		<result column="create_time" property="createTime" jdbcType="INTEGER" />
		<result column="update_time" property="updateTime" jdbcType="INTEGER" />
	</resultMap>
	<sql id="Base_Column_List">
		id, subject, summary, content, url, create_time, update_time
	</sql>

	<select id="selectAllSubjects" resultType="java.lang.String" timeout="20000">
		select subject from spider_content
	</select>

	<select id="selectTotalCount" resultType="java.lang.Integer" timeout="20000">
		SELECT count(1) FROM spider_content
	</select>

	<select id="selectPageList" resultMap="BaseResultMap" timeout="20000">
		select
		<include refid="Base_Column_List" />
		from spider_content limit #{offset},#{pageSize}
	</select>

	<insert id="insertBatch" parameterType="java.util.List" timeout="20000">
		insert ignore into spider_content (subject, summary, content, url, create_time, update_time)
		values
		<foreach collection="list" item="item" index="index"
				 separator=",">
			(#{item.subject, jdbcType=VARCHAR},
			#{item.summary, jdbcType=VARCHAR},
			#{item.content, jdbcType=VARCHAR},
			#{item.url, jdbcType=VARCHAR},
			#{item.createTime, jdbcType=INTEGER},
			#{item.updateTime, jdbcType=INTEGER})
		</foreach>
	</insert>
</mapper>