SpiderContentMapper.xml
2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?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="selectSpiderContentBySubject" resultMap="BaseResultMap" timeout="20000">
select
<include refid="Base_Column_List" />
from spider_content where subject = #{subject,jdbcType=VARCHAR}
</select>
<select id="selectSpiderContentBySubjects" resultMap="BaseResultMap" timeout="20000">
select
<include refid="Base_Column_List" />
from spider_content where subject in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</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>