AchievementPublishMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  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.goafanti.common.dao.AchievementPublishMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.AchievementPublish">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Tue Jan 30 11:16:40 CST 2018.
  9. -->
  10. <id column="id" jdbcType="VARCHAR" property="id" />
  11. <result column="achievement_id" jdbcType="VARCHAR" property="achievementId" />
  12. <result column="publish_platform" jdbcType="INTEGER" property="publishPlatform" />
  13. <result column="publish_client" jdbcType="INTEGER" property="publishClient" />
  14. <result column="publish_page" jdbcType="VARCHAR" property="publishPage" />
  15. <result column="if_top" jdbcType="INTEGER" property="ifTop" />
  16. <result column="top_number" jdbcType="INTEGER" property="topNumber" />
  17. <result column="show_number" jdbcType="INTEGER" property="showNumber" />
  18. <result column="publisher" jdbcType="VARCHAR" property="publisher" />
  19. <result column="publish_time" jdbcType="TIMESTAMP" property="publishTime" />
  20. </resultMap>
  21. <sql id="Example_Where_Clause">
  22. <!--
  23. WARNING - @mbg.generated
  24. This element is automatically generated by MyBatis Generator, do not modify.
  25. This element was generated on Tue Jan 30 11:16:40 CST 2018.
  26. -->
  27. <where>
  28. <foreach collection="oredCriteria" item="criteria" separator="or">
  29. <if test="criteria.valid">
  30. <trim prefix="(" prefixOverrides="and" suffix=")">
  31. <foreach collection="criteria.criteria" item="criterion">
  32. <choose>
  33. <when test="criterion.noValue">
  34. and ${criterion.condition}
  35. </when>
  36. <when test="criterion.singleValue">
  37. and ${criterion.condition} #{criterion.value}
  38. </when>
  39. <when test="criterion.betweenValue">
  40. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  41. </when>
  42. <when test="criterion.listValue">
  43. and ${criterion.condition}
  44. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  45. #{listItem}
  46. </foreach>
  47. </when>
  48. </choose>
  49. </foreach>
  50. </trim>
  51. </if>
  52. </foreach>
  53. </where>
  54. </sql>
  55. <sql id="Update_By_Example_Where_Clause">
  56. <!--
  57. WARNING - @mbg.generated
  58. This element is automatically generated by MyBatis Generator, do not modify.
  59. This element was generated on Tue Jan 30 11:16:40 CST 2018.
  60. -->
  61. <where>
  62. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  63. <if test="criteria.valid">
  64. <trim prefix="(" prefixOverrides="and" suffix=")">
  65. <foreach collection="criteria.criteria" item="criterion">
  66. <choose>
  67. <when test="criterion.noValue">
  68. and ${criterion.condition}
  69. </when>
  70. <when test="criterion.singleValue">
  71. and ${criterion.condition} #{criterion.value}
  72. </when>
  73. <when test="criterion.betweenValue">
  74. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  75. </when>
  76. <when test="criterion.listValue">
  77. and ${criterion.condition}
  78. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  79. #{listItem}
  80. </foreach>
  81. </when>
  82. </choose>
  83. </foreach>
  84. </trim>
  85. </if>
  86. </foreach>
  87. </where>
  88. </sql>
  89. <sql id="Base_Column_List">
  90. <!--
  91. WARNING - @mbg.generated
  92. This element is automatically generated by MyBatis Generator, do not modify.
  93. This element was generated on Tue Jan 30 11:16:40 CST 2018.
  94. -->
  95. id, achievement_id, publish_platform, publish_client, publish_page, if_top, top_number,
  96. show_number, publisher, publish_time
  97. </sql>
  98. <select id="selectByExample" parameterType="com.goafanti.common.model.AchievementPublishExample" resultMap="BaseResultMap">
  99. <!--
  100. WARNING - @mbg.generated
  101. This element is automatically generated by MyBatis Generator, do not modify.
  102. This element was generated on Tue Jan 30 11:16:40 CST 2018.
  103. -->
  104. select
  105. <if test="distinct">
  106. distinct
  107. </if>
  108. <include refid="Base_Column_List" />
  109. from achievement_publish
  110. <if test="_parameter != null">
  111. <include refid="Example_Where_Clause" />
  112. </if>
  113. <if test="orderByClause != null">
  114. order by ${orderByClause}
  115. </if>
  116. </select>
  117. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  118. <!--
  119. WARNING - @mbg.generated
  120. This element is automatically generated by MyBatis Generator, do not modify.
  121. This element was generated on Tue Jan 30 11:16:40 CST 2018.
  122. -->
  123. select
  124. <include refid="Base_Column_List" />
  125. from achievement_publish
  126. where id = #{id,jdbcType=VARCHAR}
  127. </select>
  128. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  129. <!--
  130. WARNING - @mbg.generated
  131. This element is automatically generated by MyBatis Generator, do not modify.
  132. This element was generated on Tue Jan 30 11:16:40 CST 2018.
  133. -->
  134. delete from achievement_publish
  135. where id = #{id,jdbcType=VARCHAR}
  136. </delete>
  137. <delete id="deleteByExample" parameterType="com.goafanti.common.model.AchievementPublishExample">
  138. <!--
  139. WARNING - @mbg.generated
  140. This element is automatically generated by MyBatis Generator, do not modify.
  141. This element was generated on Tue Jan 30 11:16:40 CST 2018.
  142. -->
  143. delete from achievement_publish
  144. <if test="_parameter != null">
  145. <include refid="Example_Where_Clause" />
  146. </if>
  147. </delete>
  148. <insert id="insert" parameterType="com.goafanti.common.model.AchievementPublish">
  149. <!--
  150. WARNING - @mbg.generated
  151. This element is automatically generated by MyBatis Generator, do not modify.
  152. This element was generated on Tue Jan 30 11:16:40 CST 2018.
  153. -->
  154. insert into achievement_publish (id, achievement_id, publish_platform,
  155. publish_client, publish_page, if_top,
  156. top_number, show_number, publisher,
  157. publish_time)
  158. values (#{id,jdbcType=VARCHAR}, #{achievementId,jdbcType=VARCHAR}, #{publishPlatform,jdbcType=INTEGER},
  159. #{publishClient,jdbcType=INTEGER}, #{publishPage,jdbcType=VARCHAR}, #{ifTop,jdbcType=INTEGER},
  160. #{topNumber,jdbcType=INTEGER}, #{showNumber,jdbcType=INTEGER}, #{publisher,jdbcType=VARCHAR},
  161. #{publishTime,jdbcType=TIMESTAMP})
  162. </insert>
  163. <insert id="insertSelective" parameterType="com.goafanti.common.model.AchievementPublish">
  164. <!--
  165. WARNING - @mbg.generated
  166. This element is automatically generated by MyBatis Generator, do not modify.
  167. This element was generated on Tue Jan 30 11:16:40 CST 2018.
  168. -->
  169. insert into achievement_publish
  170. <trim prefix="(" suffix=")" suffixOverrides=",">
  171. <if test="id != null">
  172. id,
  173. </if>
  174. <if test="achievementId != null">
  175. achievement_id,
  176. </if>
  177. <if test="publishPlatform != null">
  178. publish_platform,
  179. </if>
  180. <if test="publishClient != null">
  181. publish_client,
  182. </if>
  183. <if test="publishPage != null">
  184. publish_page,
  185. </if>
  186. <if test="ifTop != null">
  187. if_top,
  188. </if>
  189. <if test="topNumber != null">
  190. top_number,
  191. </if>
  192. <if test="showNumber != null">
  193. show_number,
  194. </if>
  195. <if test="publisher != null">
  196. publisher,
  197. </if>
  198. <if test="publishTime != null">
  199. publish_time,
  200. </if>
  201. </trim>
  202. <trim prefix="values (" suffix=")" suffixOverrides=",">
  203. <if test="id != null">
  204. #{id,jdbcType=VARCHAR},
  205. </if>
  206. <if test="achievementId != null">
  207. #{achievementId,jdbcType=VARCHAR},
  208. </if>
  209. <if test="publishPlatform != null">
  210. #{publishPlatform,jdbcType=INTEGER},
  211. </if>
  212. <if test="publishClient != null">
  213. #{publishClient,jdbcType=INTEGER},
  214. </if>
  215. <if test="publishPage != null">
  216. #{publishPage,jdbcType=VARCHAR},
  217. </if>
  218. <if test="ifTop != null">
  219. #{ifTop,jdbcType=INTEGER},
  220. </if>
  221. <if test="topNumber != null">
  222. #{topNumber,jdbcType=INTEGER},
  223. </if>
  224. <if test="showNumber != null">
  225. #{showNumber,jdbcType=INTEGER},
  226. </if>
  227. <if test="publisher != null">
  228. #{publisher,jdbcType=VARCHAR},
  229. </if>
  230. <if test="publishTime != null">
  231. #{publishTime,jdbcType=TIMESTAMP},
  232. </if>
  233. </trim>
  234. </insert>
  235. <select id="countByExample" parameterType="com.goafanti.common.model.AchievementPublishExample" resultType="java.lang.Long">
  236. <!--
  237. WARNING - @mbg.generated
  238. This element is automatically generated by MyBatis Generator, do not modify.
  239. This element was generated on Tue Jan 30 11:16:40 CST 2018.
  240. -->
  241. select count(*) from achievement_publish
  242. <if test="_parameter != null">
  243. <include refid="Example_Where_Clause" />
  244. </if>
  245. </select>
  246. <update id="updateByExampleSelective" parameterType="map">
  247. <!--
  248. WARNING - @mbg.generated
  249. This element is automatically generated by MyBatis Generator, do not modify.
  250. This element was generated on Tue Jan 30 11:16:40 CST 2018.
  251. -->
  252. update achievement_publish
  253. <set>
  254. <if test="record.id != null">
  255. id = #{record.id,jdbcType=VARCHAR},
  256. </if>
  257. <if test="record.achievementId != null">
  258. achievement_id = #{record.achievementId,jdbcType=VARCHAR},
  259. </if>
  260. <if test="record.publishPlatform != null">
  261. publish_platform = #{record.publishPlatform,jdbcType=INTEGER},
  262. </if>
  263. <if test="record.publishClient != null">
  264. publish_client = #{record.publishClient,jdbcType=INTEGER},
  265. </if>
  266. <if test="record.publishPage != null">
  267. publish_page = #{record.publishPage,jdbcType=VARCHAR},
  268. </if>
  269. <if test="record.ifTop != null">
  270. if_top = #{record.ifTop,jdbcType=INTEGER},
  271. </if>
  272. <if test="record.topNumber != null">
  273. top_number = #{record.topNumber,jdbcType=INTEGER},
  274. </if>
  275. <if test="record.showNumber != null">
  276. show_number = #{record.showNumber,jdbcType=INTEGER},
  277. </if>
  278. <if test="record.publisher != null">
  279. publisher = #{record.publisher,jdbcType=VARCHAR},
  280. </if>
  281. <if test="record.publishTime != null">
  282. publish_time = #{record.publishTime,jdbcType=TIMESTAMP},
  283. </if>
  284. </set>
  285. <if test="_parameter != null">
  286. <include refid="Update_By_Example_Where_Clause" />
  287. </if>
  288. </update>
  289. <update id="updateByExample" parameterType="map">
  290. <!--
  291. WARNING - @mbg.generated
  292. This element is automatically generated by MyBatis Generator, do not modify.
  293. This element was generated on Tue Jan 30 11:16:40 CST 2018.
  294. -->
  295. update achievement_publish
  296. set id = #{record.id,jdbcType=VARCHAR},
  297. achievement_id = #{record.achievementId,jdbcType=VARCHAR},
  298. publish_platform = #{record.publishPlatform,jdbcType=INTEGER},
  299. publish_client = #{record.publishClient,jdbcType=INTEGER},
  300. publish_page = #{record.publishPage,jdbcType=VARCHAR},
  301. if_top = #{record.ifTop,jdbcType=INTEGER},
  302. top_number = #{record.topNumber,jdbcType=INTEGER},
  303. show_number = #{record.showNumber,jdbcType=INTEGER},
  304. publisher = #{record.publisher,jdbcType=VARCHAR},
  305. publish_time = #{record.publishTime,jdbcType=TIMESTAMP}
  306. <if test="_parameter != null">
  307. <include refid="Update_By_Example_Where_Clause" />
  308. </if>
  309. </update>
  310. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AchievementPublish">
  311. <!--
  312. WARNING - @mbg.generated
  313. This element is automatically generated by MyBatis Generator, do not modify.
  314. This element was generated on Tue Jan 30 11:16:40 CST 2018.
  315. -->
  316. update achievement_publish
  317. <set>
  318. <if test="achievementId != null">
  319. achievement_id = #{achievementId,jdbcType=VARCHAR},
  320. </if>
  321. <if test="publishPlatform != null">
  322. publish_platform = #{publishPlatform,jdbcType=INTEGER},
  323. </if>
  324. <if test="publishClient != null">
  325. publish_client = #{publishClient,jdbcType=INTEGER},
  326. </if>
  327. <if test="publishPage != null">
  328. publish_page = #{publishPage,jdbcType=VARCHAR},
  329. </if>
  330. <if test="ifTop != null">
  331. if_top = #{ifTop,jdbcType=INTEGER},
  332. </if>
  333. <if test="topNumber != null">
  334. top_number = #{topNumber,jdbcType=INTEGER},
  335. </if>
  336. <if test="showNumber != null">
  337. show_number = #{showNumber,jdbcType=INTEGER},
  338. </if>
  339. <if test="publisher != null">
  340. publisher = #{publisher,jdbcType=VARCHAR},
  341. </if>
  342. <if test="publishTime != null">
  343. publish_time = #{publishTime,jdbcType=TIMESTAMP},
  344. </if>
  345. </set>
  346. where id = #{id,jdbcType=VARCHAR}
  347. </update>
  348. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.AchievementPublish">
  349. <!--
  350. WARNING - @mbg.generated
  351. This element is automatically generated by MyBatis Generator, do not modify.
  352. This element was generated on Tue Jan 30 11:16:40 CST 2018.
  353. -->
  354. update achievement_publish
  355. set achievement_id = #{achievementId,jdbcType=VARCHAR},
  356. publish_platform = #{publishPlatform,jdbcType=INTEGER},
  357. publish_client = #{publishClient,jdbcType=INTEGER},
  358. publish_page = #{publishPage,jdbcType=VARCHAR},
  359. if_top = #{ifTop,jdbcType=INTEGER},
  360. top_number = #{topNumber,jdbcType=INTEGER},
  361. show_number = #{showNumber,jdbcType=INTEGER},
  362. publisher = #{publisher,jdbcType=VARCHAR},
  363. publish_time = #{publishTime,jdbcType=TIMESTAMP}
  364. where id = #{id,jdbcType=VARCHAR}
  365. </update>
  366. <select id="findAchievementPublishByPage" parameterType="String" resultType="com.goafanti.achievement.bo.AchievementPublishBo">
  367. select ap.id,ap.achievement_id as achievementId, a.serial_number as serialNumber,a.name as name ,a.owner_name as userName,ap.publish_platform as publishPlatform,bi.platform_name as platformName,ap.publish_client as publishClient,
  368. ap.publish_page as publishPage,ap.if_top as ifTop,ap.show_number as showNumber,ap.top_number as topNumber,ap.publisher,ad.name as publisherName,ap.publish_time as publishTime
  369. from achievement_publish ap
  370. left join achievement a on ap.achievement_id=a.id
  371. left join admin ad on ap.publisher=ad.id
  372. left join branch_information bi on ap.publish_platform=bi.id
  373. where 1=1
  374. <if test="name != null">
  375. and a.name like "%"#{name,jdbcType=VARCHAR}"%"
  376. </if>
  377. <if test="userName != null">
  378. and a.owner_name = #{userName,jdbcType=VARCHAR}
  379. </if>
  380. <if test="publishPage != null">
  381. and ap.publish_page = #{publishPage,jdbcType=VARCHAR}
  382. </if>
  383. <if test="publishPlatform != null">
  384. and ap.publish_platform = #{publishPlatform,jdbcType=VARCHAR}
  385. </if>
  386. <if test="publishClient != null">
  387. and ap.publish_client = #{publishClient,jdbcType=INTEGER}
  388. </if>
  389. <if test="ifTop != null">
  390. and ap.if_top =#{ifTop,jdbcType=INTEGER}
  391. </if>
  392. <if test="ownerName != null">
  393. and a.owner_name like #{ownerName,jdbcType=INTEGER}"%"
  394. </if>
  395. order by ap.if_top, ap.top_number,ap.show_number asc
  396. <if test="page_sql!=null">
  397. ${page_sql}
  398. </if>
  399. </select>
  400. <select id="findAchievementPublishCount" parameterType="String" resultType="java.lang.Integer">
  401. select count(1)
  402. from achievement_publish ap
  403. left join achievement a on ap.achievement_id=a.id
  404. left join admin ad on ap.publisher=ad.id
  405. left join branch_information bi on ap.publish_platform=bi.id
  406. where 1=1
  407. <if test="name != null">
  408. and a.name like "%"#{name,jdbcType=VARCHAR}"%"
  409. </if>
  410. <if test="userName != null">
  411. and a.owner_name = = #{userName,jdbcType=VARCHAR}
  412. </if>
  413. <if test="publishPage != null">
  414. and ap.publish_page = #{publishPage,jdbcType=VARCHAR}
  415. </if>
  416. <if test="publishPlatform != null">
  417. and ap.publish_platform = #{publishPlatform,jdbcType=VARCHAR}
  418. </if>
  419. <if test="publishClient != null">
  420. and ap.publish_client = #{publishClient,jdbcType=INTEGER}
  421. </if>
  422. <if test="ifTop != null">
  423. and ap.if_top=#{ifTop,jdbcType=INTEGER}
  424. </if>
  425. </select>
  426. <select id="checkExisting" resultType="java.lang.Integer">
  427. select count(1)
  428. from achievement_publish
  429. where 1=1
  430. and achievement_id= #{achievementId,jdbcType=VARCHAR}
  431. and publish_platform= #{publishPlatform,jdbcType=VARCHAR}
  432. and publish_client= #{publishClient,jdbcType=INTEGER}
  433. and publish_page= #{publishPage,jdbcType=VARCHAR}
  434. </select>
  435. <delete id="deleteByAchievementId" parameterType="java.lang.String">
  436. delete from achievement_publish where achievement_id = #{id,jdbcType=VARCHAR}
  437. </delete>
  438. <delete id="batchDeleteByAchievementIds" parameterType="java.util.List">
  439. delete from achievement_publish where achievement_id in
  440. <foreach item="item" collection="list" open="(" separator="," close=")">
  441. #{item}
  442. </foreach>
  443. </delete>
  444. <select id="getPublishPagesById" resultType="java.lang.String">
  445. select publish_page from achievement_publish ap
  446. where ap.achievement_id = #{id}
  447. </select>
  448. </mapper>