AlgGhAutoreplyVideoRankDataMapper.xml 12 KB

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