ArticleContentLinkMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.tzld.longarticle.recommend.server.repository.mapper.crawler.ArticleContentLinkMapper">
  4. <resultMap id="BaseResultMap" type="com.tzld.longarticle.recommend.server.repository.model.ArticleContentLink">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="gzh_id" jdbcType="VARCHAR" property="gzhId" />
  7. <result column="idx" jdbcType="INTEGER" property="idx" />
  8. <result column="content_link" jdbcType="VARCHAR" property="contentLink" />
  9. <result column="create_time" jdbcType="BIGINT" property="createTime" />
  10. <result column="title" jdbcType="VARCHAR" property="title" />
  11. <result column="view_count" jdbcType="BIGINT" property="viewCount" />
  12. <result column="update_time" jdbcType="BIGINT" property="updateTime" />
  13. </resultMap>
  14. <sql id="Example_Where_Clause">
  15. <where>
  16. <foreach collection="oredCriteria" item="criteria" separator="or">
  17. <if test="criteria.valid">
  18. <trim prefix="(" prefixOverrides="and" suffix=")">
  19. <foreach collection="criteria.criteria" item="criterion">
  20. <choose>
  21. <when test="criterion.noValue">
  22. and ${criterion.condition}
  23. </when>
  24. <when test="criterion.singleValue">
  25. and ${criterion.condition} #{criterion.value}
  26. </when>
  27. <when test="criterion.betweenValue">
  28. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  29. </when>
  30. <when test="criterion.listValue">
  31. and ${criterion.condition}
  32. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  33. #{listItem}
  34. </foreach>
  35. </when>
  36. </choose>
  37. </foreach>
  38. </trim>
  39. </if>
  40. </foreach>
  41. </where>
  42. </sql>
  43. <sql id="Update_By_Example_Where_Clause">
  44. <where>
  45. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  46. <if test="criteria.valid">
  47. <trim prefix="(" prefixOverrides="and" suffix=")">
  48. <foreach collection="criteria.criteria" item="criterion">
  49. <choose>
  50. <when test="criterion.noValue">
  51. and ${criterion.condition}
  52. </when>
  53. <when test="criterion.singleValue">
  54. and ${criterion.condition} #{criterion.value}
  55. </when>
  56. <when test="criterion.betweenValue">
  57. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  58. </when>
  59. <when test="criterion.listValue">
  60. and ${criterion.condition}
  61. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  62. #{listItem}
  63. </foreach>
  64. </when>
  65. </choose>
  66. </foreach>
  67. </trim>
  68. </if>
  69. </foreach>
  70. </where>
  71. </sql>
  72. <sql id="Base_Column_List">
  73. id, gzh_id, idx, content_link, create_time, title, view_count, update_time
  74. </sql>
  75. <select id="selectByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleContentLinkExample" resultMap="BaseResultMap">
  76. select
  77. <if test="distinct">
  78. distinct
  79. </if>
  80. <include refid="Base_Column_List" />
  81. from article_content_link
  82. <if test="_parameter != null">
  83. <include refid="Example_Where_Clause" />
  84. </if>
  85. <if test="orderByClause != null">
  86. order by ${orderByClause}
  87. </if>
  88. </select>
  89. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  90. select
  91. <include refid="Base_Column_List" />
  92. from article_content_link
  93. where id = #{id,jdbcType=BIGINT}
  94. </select>
  95. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  96. delete from article_content_link
  97. where id = #{id,jdbcType=BIGINT}
  98. </delete>
  99. <delete id="deleteByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleContentLinkExample">
  100. delete from article_content_link
  101. <if test="_parameter != null">
  102. <include refid="Example_Where_Clause" />
  103. </if>
  104. </delete>
  105. <insert id="insert" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleContentLink">
  106. <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
  107. SELECT LAST_INSERT_ID()
  108. </selectKey>
  109. insert into article_content_link (gzh_id, idx, content_link,
  110. create_time, title, view_count,
  111. update_time)
  112. values (#{gzhId,jdbcType=VARCHAR}, #{idx,jdbcType=INTEGER}, #{contentLink,jdbcType=VARCHAR},
  113. #{createTime,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, #{viewCount,jdbcType=BIGINT},
  114. #{updateTime,jdbcType=BIGINT})
  115. </insert>
  116. <insert id="insertSelective" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleContentLink">
  117. <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
  118. SELECT LAST_INSERT_ID()
  119. </selectKey>
  120. insert into article_content_link
  121. <trim prefix="(" suffix=")" suffixOverrides=",">
  122. <if test="gzhId != null">
  123. gzh_id,
  124. </if>
  125. <if test="idx != null">
  126. idx,
  127. </if>
  128. <if test="contentLink != null">
  129. content_link,
  130. </if>
  131. <if test="createTime != null">
  132. create_time,
  133. </if>
  134. <if test="title != null">
  135. title,
  136. </if>
  137. <if test="viewCount != null">
  138. view_count,
  139. </if>
  140. <if test="updateTime != null">
  141. update_time,
  142. </if>
  143. </trim>
  144. <trim prefix="values (" suffix=")" suffixOverrides=",">
  145. <if test="gzhId != null">
  146. #{gzhId,jdbcType=VARCHAR},
  147. </if>
  148. <if test="idx != null">
  149. #{idx,jdbcType=INTEGER},
  150. </if>
  151. <if test="contentLink != null">
  152. #{contentLink,jdbcType=VARCHAR},
  153. </if>
  154. <if test="createTime != null">
  155. #{createTime,jdbcType=BIGINT},
  156. </if>
  157. <if test="title != null">
  158. #{title,jdbcType=VARCHAR},
  159. </if>
  160. <if test="viewCount != null">
  161. #{viewCount,jdbcType=BIGINT},
  162. </if>
  163. <if test="updateTime != null">
  164. #{updateTime,jdbcType=BIGINT},
  165. </if>
  166. </trim>
  167. </insert>
  168. <select id="countByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleContentLinkExample" resultType="java.lang.Long">
  169. select count(*) from article_content_link
  170. <if test="_parameter != null">
  171. <include refid="Example_Where_Clause" />
  172. </if>
  173. </select>
  174. <update id="updateByExampleSelective" parameterType="map">
  175. update article_content_link
  176. <set>
  177. <if test="row.id != null">
  178. id = #{row.id,jdbcType=BIGINT},
  179. </if>
  180. <if test="row.gzhId != null">
  181. gzh_id = #{row.gzhId,jdbcType=VARCHAR},
  182. </if>
  183. <if test="row.idx != null">
  184. idx = #{row.idx,jdbcType=INTEGER},
  185. </if>
  186. <if test="row.contentLink != null">
  187. content_link = #{row.contentLink,jdbcType=VARCHAR},
  188. </if>
  189. <if test="row.createTime != null">
  190. create_time = #{row.createTime,jdbcType=BIGINT},
  191. </if>
  192. <if test="row.title != null">
  193. title = #{row.title,jdbcType=VARCHAR},
  194. </if>
  195. <if test="row.viewCount != null">
  196. view_count = #{row.viewCount,jdbcType=BIGINT},
  197. </if>
  198. <if test="row.updateTime != null">
  199. update_time = #{row.updateTime,jdbcType=BIGINT},
  200. </if>
  201. </set>
  202. <if test="example != null">
  203. <include refid="Update_By_Example_Where_Clause" />
  204. </if>
  205. </update>
  206. <update id="updateByExample" parameterType="map">
  207. update article_content_link
  208. set id = #{row.id,jdbcType=BIGINT},
  209. gzh_id = #{row.gzhId,jdbcType=VARCHAR},
  210. idx = #{row.idx,jdbcType=INTEGER},
  211. content_link = #{row.contentLink,jdbcType=VARCHAR},
  212. create_time = #{row.createTime,jdbcType=BIGINT},
  213. title = #{row.title,jdbcType=VARCHAR},
  214. view_count = #{row.viewCount,jdbcType=BIGINT},
  215. update_time = #{row.updateTime,jdbcType=BIGINT}
  216. <if test="example != null">
  217. <include refid="Update_By_Example_Where_Clause" />
  218. </if>
  219. </update>
  220. <update id="updateByPrimaryKeySelective" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleContentLink">
  221. update article_content_link
  222. <set>
  223. <if test="gzhId != null">
  224. gzh_id = #{gzhId,jdbcType=VARCHAR},
  225. </if>
  226. <if test="idx != null">
  227. idx = #{idx,jdbcType=INTEGER},
  228. </if>
  229. <if test="contentLink != null">
  230. content_link = #{contentLink,jdbcType=VARCHAR},
  231. </if>
  232. <if test="createTime != null">
  233. create_time = #{createTime,jdbcType=BIGINT},
  234. </if>
  235. <if test="title != null">
  236. title = #{title,jdbcType=VARCHAR},
  237. </if>
  238. <if test="viewCount != null">
  239. view_count = #{viewCount,jdbcType=BIGINT},
  240. </if>
  241. <if test="updateTime != null">
  242. update_time = #{updateTime,jdbcType=BIGINT},
  243. </if>
  244. </set>
  245. where id = #{id,jdbcType=BIGINT}
  246. </update>
  247. <update id="updateByPrimaryKey" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleContentLink">
  248. update article_content_link
  249. set gzh_id = #{gzhId,jdbcType=VARCHAR},
  250. idx = #{idx,jdbcType=INTEGER},
  251. content_link = #{contentLink,jdbcType=VARCHAR},
  252. create_time = #{createTime,jdbcType=BIGINT},
  253. title = #{title,jdbcType=VARCHAR},
  254. view_count = #{viewCount,jdbcType=BIGINT},
  255. update_time = #{updateTime,jdbcType=BIGINT}
  256. where id = #{id,jdbcType=BIGINT}
  257. </update>
  258. <insert id="insertBatch" parameterType="list">
  259. INSERT INTO article_content_link (gzh_id, idx, content_link, create_time, title, view_count, update_time)
  260. VALUES
  261. <foreach collection="list" item="item" separator=",">
  262. (#{item.gzhId}, #{item.idx}, #{item.contentLink}, #{item.createTime}, #{item.title}, #{item.viewCount},
  263. #{item.updateTime})
  264. </foreach>
  265. </insert>
  266. </mapper>