GhDetailMapper.xml 10 KB

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