ArticleUserGroupMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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.ArticleUserGroupMapper">
  4. <resultMap id="BaseResultMap" type="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroup">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Thu Aug 22 20:53:08 CST 2024.
  9. -->
  10. <id column="id" jdbcType="BIGINT" property="id" />
  11. <result column="gzh_id" jdbcType="VARCHAR" property="gzhId" />
  12. <result column="user_group_id" jdbcType="INTEGER" property="userGroupId" />
  13. <result column="open_id" jdbcType="VARCHAR" property="openId" />
  14. <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
  15. </resultMap>
  16. <sql id="Example_Where_Clause">
  17. <!--
  18. WARNING - @mbg.generated
  19. This element is automatically generated by MyBatis Generator, do not modify.
  20. This element was generated on Thu Aug 22 20:53:08 CST 2024.
  21. -->
  22. <where>
  23. <foreach collection="oredCriteria" item="criteria" separator="or">
  24. <if test="criteria.valid">
  25. <trim prefix="(" prefixOverrides="and" suffix=")">
  26. <foreach collection="criteria.criteria" item="criterion">
  27. <choose>
  28. <when test="criterion.noValue">
  29. and ${criterion.condition}
  30. </when>
  31. <when test="criterion.singleValue">
  32. and ${criterion.condition} #{criterion.value}
  33. </when>
  34. <when test="criterion.betweenValue">
  35. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  36. </when>
  37. <when test="criterion.listValue">
  38. and ${criterion.condition}
  39. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  40. #{listItem}
  41. </foreach>
  42. </when>
  43. </choose>
  44. </foreach>
  45. </trim>
  46. </if>
  47. </foreach>
  48. </where>
  49. </sql>
  50. <sql id="Update_By_Example_Where_Clause">
  51. <!--
  52. WARNING - @mbg.generated
  53. This element is automatically generated by MyBatis Generator, do not modify.
  54. This element was generated on Thu Aug 22 20:53:08 CST 2024.
  55. -->
  56. <where>
  57. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  58. <if test="criteria.valid">
  59. <trim prefix="(" prefixOverrides="and" suffix=")">
  60. <foreach collection="criteria.criteria" item="criterion">
  61. <choose>
  62. <when test="criterion.noValue">
  63. and ${criterion.condition}
  64. </when>
  65. <when test="criterion.singleValue">
  66. and ${criterion.condition} #{criterion.value}
  67. </when>
  68. <when test="criterion.betweenValue">
  69. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  70. </when>
  71. <when test="criterion.listValue">
  72. and ${criterion.condition}
  73. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  74. #{listItem}
  75. </foreach>
  76. </when>
  77. </choose>
  78. </foreach>
  79. </trim>
  80. </if>
  81. </foreach>
  82. </where>
  83. </sql>
  84. <sql id="Base_Column_List">
  85. <!--
  86. WARNING - @mbg.generated
  87. This element is automatically generated by MyBatis Generator, do not modify.
  88. This element was generated on Thu Aug 22 20:53:08 CST 2024.
  89. -->
  90. id, gzh_id, user_group_id, open_id, is_delete
  91. </sql>
  92. <select id="selectByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroupExample" resultMap="BaseResultMap">
  93. <!--
  94. WARNING - @mbg.generated
  95. This element is automatically generated by MyBatis Generator, do not modify.
  96. This element was generated on Thu Aug 22 20:53:08 CST 2024.
  97. -->
  98. select
  99. <if test="distinct">
  100. distinct
  101. </if>
  102. <include refid="Base_Column_List" />
  103. from article_user_group
  104. <if test="_parameter != null">
  105. <include refid="Example_Where_Clause" />
  106. </if>
  107. <if test="orderByClause != null">
  108. order by ${orderByClause}
  109. </if>
  110. </select>
  111. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  112. <!--
  113. WARNING - @mbg.generated
  114. This element is automatically generated by MyBatis Generator, do not modify.
  115. This element was generated on Thu Aug 22 20:53:08 CST 2024.
  116. -->
  117. select
  118. <include refid="Base_Column_List" />
  119. from article_user_group
  120. where id = #{id,jdbcType=BIGINT}
  121. </select>
  122. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  123. <!--
  124. WARNING - @mbg.generated
  125. This element is automatically generated by MyBatis Generator, do not modify.
  126. This element was generated on Thu Aug 22 20:53:08 CST 2024.
  127. -->
  128. delete from article_user_group
  129. where id = #{id,jdbcType=BIGINT}
  130. </delete>
  131. <delete id="deleteByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroupExample">
  132. <!--
  133. WARNING - @mbg.generated
  134. This element is automatically generated by MyBatis Generator, do not modify.
  135. This element was generated on Thu Aug 22 20:53:08 CST 2024.
  136. -->
  137. delete from article_user_group
  138. <if test="_parameter != null">
  139. <include refid="Example_Where_Clause" />
  140. </if>
  141. </delete>
  142. <insert id="insert" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroup">
  143. <!--
  144. WARNING - @mbg.generated
  145. This element is automatically generated by MyBatis Generator, do not modify.
  146. This element was generated on Thu Aug 22 20:53:08 CST 2024.
  147. -->
  148. <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
  149. SELECT LAST_INSERT_ID()
  150. </selectKey>
  151. insert into article_user_group (gzh_id, user_group_id, open_id,
  152. is_delete)
  153. values (#{gzhId,jdbcType=VARCHAR}, #{userGroupId,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR},
  154. #{isDelete,jdbcType=INTEGER})
  155. </insert>
  156. <insert id="insertSelective" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroup">
  157. <!--
  158. WARNING - @mbg.generated
  159. This element is automatically generated by MyBatis Generator, do not modify.
  160. This element was generated on Thu Aug 22 20:53:08 CST 2024.
  161. -->
  162. <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
  163. SELECT LAST_INSERT_ID()
  164. </selectKey>
  165. insert into article_user_group
  166. <trim prefix="(" suffix=")" suffixOverrides=",">
  167. <if test="gzhId != null">
  168. gzh_id,
  169. </if>
  170. <if test="userGroupId != null">
  171. user_group_id,
  172. </if>
  173. <if test="openId != null">
  174. open_id,
  175. </if>
  176. <if test="isDelete != null">
  177. is_delete,
  178. </if>
  179. </trim>
  180. <trim prefix="values (" suffix=")" suffixOverrides=",">
  181. <if test="gzhId != null">
  182. #{gzhId,jdbcType=VARCHAR},
  183. </if>
  184. <if test="userGroupId != null">
  185. #{userGroupId,jdbcType=INTEGER},
  186. </if>
  187. <if test="openId != null">
  188. #{openId,jdbcType=VARCHAR},
  189. </if>
  190. <if test="isDelete != null">
  191. #{isDelete,jdbcType=INTEGER},
  192. </if>
  193. </trim>
  194. </insert>
  195. <select id="countByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroupExample" resultType="java.lang.Long">
  196. <!--
  197. WARNING - @mbg.generated
  198. This element is automatically generated by MyBatis Generator, do not modify.
  199. This element was generated on Thu Aug 22 20:53:08 CST 2024.
  200. -->
  201. select count(*) from article_user_group
  202. <if test="_parameter != null">
  203. <include refid="Example_Where_Clause" />
  204. </if>
  205. </select>
  206. <update id="updateByExampleSelective" parameterType="map">
  207. <!--
  208. WARNING - @mbg.generated
  209. This element is automatically generated by MyBatis Generator, do not modify.
  210. This element was generated on Thu Aug 22 20:53:08 CST 2024.
  211. -->
  212. update article_user_group
  213. <set>
  214. <if test="row.id != null">
  215. id = #{row.id,jdbcType=BIGINT},
  216. </if>
  217. <if test="row.gzhId != null">
  218. gzh_id = #{row.gzhId,jdbcType=VARCHAR},
  219. </if>
  220. <if test="row.userGroupId != null">
  221. user_group_id = #{row.userGroupId,jdbcType=INTEGER},
  222. </if>
  223. <if test="row.openId != null">
  224. open_id = #{row.openId,jdbcType=VARCHAR},
  225. </if>
  226. <if test="row.isDelete != null">
  227. is_delete = #{row.isDelete,jdbcType=INTEGER},
  228. </if>
  229. </set>
  230. <if test="example != null">
  231. <include refid="Update_By_Example_Where_Clause" />
  232. </if>
  233. </update>
  234. <update id="updateByExample" parameterType="map">
  235. <!--
  236. WARNING - @mbg.generated
  237. This element is automatically generated by MyBatis Generator, do not modify.
  238. This element was generated on Thu Aug 22 20:53:08 CST 2024.
  239. -->
  240. update article_user_group
  241. set id = #{row.id,jdbcType=BIGINT},
  242. gzh_id = #{row.gzhId,jdbcType=VARCHAR},
  243. user_group_id = #{row.userGroupId,jdbcType=INTEGER},
  244. open_id = #{row.openId,jdbcType=VARCHAR},
  245. is_delete = #{row.isDelete,jdbcType=INTEGER}
  246. <if test="example != null">
  247. <include refid="Update_By_Example_Where_Clause" />
  248. </if>
  249. </update>
  250. <update id="updateByPrimaryKeySelective" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroup">
  251. <!--
  252. WARNING - @mbg.generated
  253. This element is automatically generated by MyBatis Generator, do not modify.
  254. This element was generated on Thu Aug 22 20:53:08 CST 2024.
  255. -->
  256. update article_user_group
  257. <set>
  258. <if test="gzhId != null">
  259. gzh_id = #{gzhId,jdbcType=VARCHAR},
  260. </if>
  261. <if test="userGroupId != null">
  262. user_group_id = #{userGroupId,jdbcType=INTEGER},
  263. </if>
  264. <if test="openId != null">
  265. open_id = #{openId,jdbcType=VARCHAR},
  266. </if>
  267. <if test="isDelete != null">
  268. is_delete = #{isDelete,jdbcType=INTEGER},
  269. </if>
  270. </set>
  271. where id = #{id,jdbcType=BIGINT}
  272. </update>
  273. <update id="updateByPrimaryKey" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroup">
  274. <!--
  275. WARNING - @mbg.generated
  276. This element is automatically generated by MyBatis Generator, do not modify.
  277. This element was generated on Thu Aug 22 20:53:08 CST 2024.
  278. -->
  279. update article_user_group
  280. set gzh_id = #{gzhId,jdbcType=VARCHAR},
  281. user_group_id = #{userGroupId,jdbcType=INTEGER},
  282. open_id = #{openId,jdbcType=VARCHAR},
  283. is_delete = #{isDelete,jdbcType=INTEGER}
  284. where id = #{id,jdbcType=BIGINT}
  285. </update>
  286. <insert id="insertBatch" parameterType="list">
  287. INSERT INTO article_user_group (gzh_id, user_group_id, open_id, is_delete)
  288. VALUES
  289. <foreach collection="list" item="item" separator=",">
  290. (#{item.gzhId}, #{item.userGroupId}, #{item.openId}, #{item.isDelete})
  291. </foreach>
  292. </insert>
  293. <select id="selectByGzhIdAndOpenId" resultMap="BaseResultMap">
  294. select
  295. <include refid="Base_Column_List" />
  296. from article_user_group
  297. where gzh_id = #{gzhId}
  298. and open_id = #{openId}
  299. </select>
  300. <select id="selectUserGroupIdByGzhId" parameterType="java.lang.String" resultType="integer">
  301. select
  302. distinct user_group_id
  303. from article_user_group
  304. where gzh_id = #{gzhId}
  305. </select>
  306. <select id="selectOpenIdByGzhIdAndUserGroupId" resultType="string">
  307. select
  308. distinct open_id
  309. from article_user_group
  310. where gzh_id = #{gzhId}
  311. and user_group_id = #{userGroupId}
  312. and is_delete = 0
  313. </select>
  314. </mapper>