ArticleContentLinkMapper.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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. </resultMap>
  11. <sql id="Example_Where_Clause">
  12. <where>
  13. <foreach collection="oredCriteria" item="criteria" separator="or">
  14. <if test="criteria.valid">
  15. <trim prefix="(" prefixOverrides="and" suffix=")">
  16. <foreach collection="criteria.criteria" item="criterion">
  17. <choose>
  18. <when test="criterion.noValue">
  19. and ${criterion.condition}
  20. </when>
  21. <when test="criterion.singleValue">
  22. and ${criterion.condition} #{criterion.value}
  23. </when>
  24. <when test="criterion.betweenValue">
  25. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  26. </when>
  27. <when test="criterion.listValue">
  28. and ${criterion.condition}
  29. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  30. #{listItem}
  31. </foreach>
  32. </when>
  33. </choose>
  34. </foreach>
  35. </trim>
  36. </if>
  37. </foreach>
  38. </where>
  39. </sql>
  40. <sql id="Update_By_Example_Where_Clause">
  41. <where>
  42. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  43. <if test="criteria.valid">
  44. <trim prefix="(" prefixOverrides="and" suffix=")">
  45. <foreach collection="criteria.criteria" item="criterion">
  46. <choose>
  47. <when test="criterion.noValue">
  48. and ${criterion.condition}
  49. </when>
  50. <when test="criterion.singleValue">
  51. and ${criterion.condition} #{criterion.value}
  52. </when>
  53. <when test="criterion.betweenValue">
  54. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  55. </when>
  56. <when test="criterion.listValue">
  57. and ${criterion.condition}
  58. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  59. #{listItem}
  60. </foreach>
  61. </when>
  62. </choose>
  63. </foreach>
  64. </trim>
  65. </if>
  66. </foreach>
  67. </where>
  68. </sql>
  69. <sql id="Base_Column_List">
  70. id, gzh_id, idx, content_link, create_time
  71. </sql>
  72. <select id="selectByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleContentLinkExample" resultMap="BaseResultMap">
  73. select
  74. <if test="distinct">
  75. distinct
  76. </if>
  77. <include refid="Base_Column_List" />
  78. from article_content_link
  79. <if test="_parameter != null">
  80. <include refid="Example_Where_Clause" />
  81. </if>
  82. <if test="orderByClause != null">
  83. order by ${orderByClause}
  84. </if>
  85. </select>
  86. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  87. select
  88. <include refid="Base_Column_List" />
  89. from article_content_link
  90. where id = #{id,jdbcType=BIGINT}
  91. </select>
  92. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  93. delete from article_content_link
  94. where id = #{id,jdbcType=BIGINT}
  95. </delete>
  96. <delete id="deleteByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleContentLinkExample">
  97. delete from article_content_link
  98. <if test="_parameter != null">
  99. <include refid="Example_Where_Clause" />
  100. </if>
  101. </delete>
  102. <insert id="insert" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleContentLink">
  103. <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
  104. SELECT LAST_INSERT_ID()
  105. </selectKey>
  106. insert into article_content_link (gzh_id, idx, content_link,
  107. create_time)
  108. values (#{gzhId,jdbcType=VARCHAR}, #{idx,jdbcType=INTEGER}, #{contentLink,jdbcType=VARCHAR},
  109. #{createTime,jdbcType=BIGINT})
  110. </insert>
  111. <insert id="insertSelective" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleContentLink">
  112. <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
  113. SELECT LAST_INSERT_ID()
  114. </selectKey>
  115. insert into article_content_link
  116. <trim prefix="(" suffix=")" suffixOverrides=",">
  117. <if test="gzhId != null">
  118. gzh_id,
  119. </if>
  120. <if test="idx != null">
  121. idx,
  122. </if>
  123. <if test="contentLink != null">
  124. content_link,
  125. </if>
  126. <if test="createTime != null">
  127. create_time,
  128. </if>
  129. </trim>
  130. <trim prefix="values (" suffix=")" suffixOverrides=",">
  131. <if test="gzhId != null">
  132. #{gzhId,jdbcType=VARCHAR},
  133. </if>
  134. <if test="idx != null">
  135. #{idx,jdbcType=INTEGER},
  136. </if>
  137. <if test="contentLink != null">
  138. #{contentLink,jdbcType=VARCHAR},
  139. </if>
  140. <if test="createTime != null">
  141. #{createTime,jdbcType=BIGINT},
  142. </if>
  143. </trim>
  144. </insert>
  145. <select id="countByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleContentLinkExample" resultType="java.lang.Long">
  146. select count(*) from article_content_link
  147. <if test="_parameter != null">
  148. <include refid="Example_Where_Clause" />
  149. </if>
  150. </select>
  151. <update id="updateByExampleSelective" parameterType="map">
  152. update article_content_link
  153. <set>
  154. <if test="row.id != null">
  155. id = #{row.id,jdbcType=BIGINT},
  156. </if>
  157. <if test="row.gzhId != null">
  158. gzh_id = #{row.gzhId,jdbcType=VARCHAR},
  159. </if>
  160. <if test="row.idx != null">
  161. idx = #{row.idx,jdbcType=INTEGER},
  162. </if>
  163. <if test="row.contentLink != null">
  164. content_link = #{row.contentLink,jdbcType=VARCHAR},
  165. </if>
  166. <if test="row.createTime != null">
  167. create_time = #{row.createTime,jdbcType=BIGINT},
  168. </if>
  169. </set>
  170. <if test="example != null">
  171. <include refid="Update_By_Example_Where_Clause" />
  172. </if>
  173. </update>
  174. <update id="updateByExample" parameterType="map">
  175. update article_content_link
  176. set id = #{row.id,jdbcType=BIGINT},
  177. gzh_id = #{row.gzhId,jdbcType=VARCHAR},
  178. idx = #{row.idx,jdbcType=INTEGER},
  179. content_link = #{row.contentLink,jdbcType=VARCHAR},
  180. create_time = #{row.createTime,jdbcType=BIGINT}
  181. <if test="example != null">
  182. <include refid="Update_By_Example_Where_Clause" />
  183. </if>
  184. </update>
  185. <update id="updateByPrimaryKeySelective" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleContentLink">
  186. update article_content_link
  187. <set>
  188. <if test="gzhId != null">
  189. gzh_id = #{gzhId,jdbcType=VARCHAR},
  190. </if>
  191. <if test="idx != null">
  192. idx = #{idx,jdbcType=INTEGER},
  193. </if>
  194. <if test="contentLink != null">
  195. content_link = #{contentLink,jdbcType=VARCHAR},
  196. </if>
  197. <if test="createTime != null">
  198. create_time = #{createTime,jdbcType=BIGINT},
  199. </if>
  200. </set>
  201. where id = #{id,jdbcType=BIGINT}
  202. </update>
  203. <update id="updateByPrimaryKey" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleContentLink">
  204. update article_content_link
  205. set gzh_id = #{gzhId,jdbcType=VARCHAR},
  206. idx = #{idx,jdbcType=INTEGER},
  207. content_link = #{contentLink,jdbcType=VARCHAR},
  208. create_time = #{createTime,jdbcType=BIGINT}
  209. where id = #{id,jdbcType=BIGINT}
  210. </update>
  211. <insert id="insertBatch" parameterType="list">
  212. INSERT INTO article_content_link (gzh_id, idx, content_link, create_time)
  213. VALUES
  214. <foreach collection="list" item="item" separator=",">
  215. (#{item.gzhId}, #{item.idx}, #{item.contentLink}, #{item.createTime})
  216. </foreach>
  217. </insert>
  218. </mapper>