PoTetherMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.system.mapper.PoTetherMapper">
  6. <resultMap type="PoTether" id="PoTetherResult">
  7. <result property="tetherId" column="tether_id" />
  8. <result property="tetherName" column="tether_name" />
  9. <result property="showTimeStart" column="show_time_start" />
  10. <result property="showTimeEnd" column="show_time_end"/>
  11. <result property="createBy" column="create_by" />
  12. <result property="createTime" column="create_time" />
  13. <result property="updateBy" column="update_by" />
  14. <result property="updateTime" column="update_time" />
  15. <result property="total" column="total" />
  16. <result property="status" column="status" />
  17. <result property="remark" column="remark" />
  18. <result property="sellStatus" column="sell_status"/>
  19. <result property="delFlag" column="del_flag"/>
  20. <result property="image" column="image" />
  21. <result property="exchange" column="exchange"/>
  22. <result property="grounding" column="grounding" />
  23. <result property="cochain" column="cochain" />
  24. </resultMap>
  25. <resultMap type="PoTetherandcollection" id="PoTetherandcollectionResult">
  26. <result property="collectionId" column="collection_id" />
  27. <result property="collectionTitle" column="collection_title" />
  28. <result property="status" column="status" />
  29. <result property="collectionType" column="collection_type" />
  30. <result property="createTime" column="create_time" />
  31. <result property="createBy" column="create_by" />
  32. <result property="updateTime" column="update_time" />
  33. <result property="updateBy" column="update_by" />
  34. <result property="delFlag" column="del_flag" />
  35. <result property="total" column="total" />
  36. <result property="remark" column="remark" />
  37. <result property="image" column="image" />
  38. <result property="formwork" column="formwork" />
  39. <result property="price" column="price" />
  40. <result property="publisherName" column="publisher_name" />
  41. <result property="story" column="story" />
  42. <result property="grounding" column="grounding" />
  43. <result property="cochain" column="cochain" />
  44. <result property="tetherId" column="tether_id" />
  45. </resultMap>
  46. <sql id="selectPoTetherVo">
  47. select tether_id, tether_name, show_time_start, show_time_end, create_by, create_time, update_by, update_time, total, status, remark ,sell_status,del_flag,image,exchange ,grounding,cochain ,tether_id from po_tether
  48. </sql>
  49. <!--在售-->
  50. <select id="selectPoTetherSellingList" parameterType="PoTether" resultMap="PoTetherResult">
  51. <include refid="selectPoTetherVo"/>
  52. <where>
  53. <if test="tetherName != null and tetherName != ''"> and tether_name like concat('%', #{tetherName}, '%')</if>
  54. <if test="showTimeStart != null "> and show_time_start = #{showTimeStart}</if>
  55. <if test="showTimeEnd != null">and show_time_end = #{showTimeEnd}</if>
  56. <if test="total != null "> and total = #{total}</if>
  57. <if test="status != null and status != ''"> and status = #{status}</if>
  58. <if test="image != null and image != '' ">and image = #{image}</if>
  59. <if test="exchange != null">and exchange = #{exchange}</if>
  60. <if test="grounding != null">and grounding = #{grounding}</if>
  61. <if test="cochain != null">and cochain = #{cochain}</if>
  62. <if test="tetherId != null">and tether_id = #{tetherId}</if>
  63. and del_flag = '0'
  64. and sell_status = 0
  65. </where>
  66. </select>
  67. <!--获取详细信息-->
  68. <select id="selectPoTetherByTetherId" parameterType="Long" resultMap="PoTetherResult">
  69. <include refid="selectPoTetherVo"/>
  70. where tether_id = #{tetherId}
  71. </select>
  72. <!-- 标题时间都不为空-->
  73. <select id="selectPoTetherListByTitleAndTetherTimeStartAndTetherTimeEnd"
  74. resultType="PoTether" resultMap="PoTetherResult">
  75. <include refid="selectPoTetherVo"></include>
  76. <where>
  77. <if test="tetherName != null and tetherName != ''"> and tether_name like concat('%', #{tetherName}, '%')</if>
  78. <if test="tetherTimeStart != null "> and show_time_start = #{tetherTimeStart}</if>
  79. <if test="tetherTimeEnd != null">and show_time_end = #{tetherTimeEnd}</if>
  80. </where>
  81. </select>
  82. <!--预售-->
  83. <select id="selectPoTetherAdvanceList" resultType="PoTether" resultMap="PoTetherResult">
  84. <include refid="selectPoTetherVo"/>
  85. <where>
  86. <if test="tetherName != null and tetherName != ''"> and tether_name like concat('%', #{tetherName}, '%')</if>
  87. <if test="showTimeStart != null "> and show_time_start = #{showTimeStart}</if>
  88. <if test="showTimeEnd != null">and show_time_end = #{showTimeEnd}</if>
  89. <if test="total != null "> and total = #{total}</if>
  90. <if test="status != null and status != ''"> and status = #{status}</if>
  91. <if test="image != null and image != '' ">and image = #{image}</if>
  92. <if test="exchange != null">and exchange = #{exchange}</if>
  93. <if test="grounding != null">and grounding = #{grounding}</if>
  94. <if test="cochain != null">and cochain = #{cochain}</if>
  95. <if test="tetherId != null">and tether_id = #{tetherId}</if>
  96. and del_flag = '0'
  97. and sell_status = 1
  98. </where>
  99. </select>
  100. <!--已过期-->
  101. <select id="selectPoTetherSelledList" resultType="PoTether" resultMap="PoTetherResult">
  102. <include refid="selectPoTetherVo"/>
  103. <where>
  104. <if test="tetherName != null and tetherName != ''"> and tether_name like concat('%', #{tetherName}, '%')</if>
  105. <if test="showTimeStart != null "> and show_time_start = #{showTimeStart}</if>
  106. <if test="showTimeEnd != null">and show_time_end = #{showTimeEnd}</if>
  107. <if test="total != null "> and total = #{total}</if>
  108. <if test="status != null and status != ''"> and status = #{status}</if>
  109. <if test="image != null and image != '' ">and image = #{image}</if>
  110. <if test="exchange != null">and exchange = #{exchange}</if>
  111. <if test="grounding != null">and grounding = #{grounding}</if>
  112. <if test="cochain != null">and cochain = #{cochain}</if>
  113. <if test="tetherId != null">and tether_id = #{tetherId}</if>
  114. and del_flag = '0'
  115. and sell_status = 2
  116. </where>
  117. </select>
  118. <!--全为空时-->
  119. <select id="selectPoTetherList" resultType="PoTether" resultMap="PoTetherResult">
  120. <include refid="selectPoTetherVo"/>
  121. <where>
  122. <if test="tetherName != null and tetherName != ''"> and tether_name like concat('%', #{tetherName}, '%')</if>
  123. <if test="showTimeStart != null "> and show_time_start = #{showTimeStart}</if>
  124. <if test="showTimeEnd != null">and show_time_end = #{showTimeEnd}</if>
  125. <if test="total != null "> and total = #{total}</if>
  126. <if test="status != null and status != ''"> and status = #{status}</if>
  127. <if test="image != null and image != '' ">and image = #{image}</if>
  128. <if test="exchange != null">and exchange = #{exchange}</if>
  129. <if test="grounding != null">and grounding = #{grounding}</if>
  130. <if test="cochain != null">and cochain = #{cochain}</if>
  131. <if test="tetherId != null">and tether_id = #{tetherId}</if>
  132. and del_flag = '0'
  133. </where>
  134. </select>
  135. <!-- 根据套系id 查询对应藏品按钮里面的藏品信息-->
  136. <select id="selectPoCollectionListById" resultMap="PoTetherandcollectionResult" >
  137. select c.collection_title , c.image , c.collection_type , c.create_time , c.create_by
  138. , c.total , c.status , c.price , c.story , c.grounding , c.cochain ,c.tether_id from po_Tetherandcollection c
  139. left join po_tether t on t.tether_id = c.tether_id where t.tether_id = #{tetherId}
  140. </select>
  141. <!-- 检验标题是否重复-->
  142. <select id="checkPostTetherTitleUnique" resultType="String" resultMap="PoTetherResult">
  143. select tether_id, tether_name from po_tether where tether_name = #{tetherName} and del_flag = '0' limit 1
  144. </select>
  145. <!-- 检验图片是否重复-->
  146. <select id="checkPostTetherImageUnique" resultType="String" resultMap="PoTetherResult">
  147. select tether_id,image from po_tether where image = #{image} and del_flag = '0' limit 1
  148. </select>
  149. <!-- 通过id批量查询套系信息-->
  150. <select id="selectPoTetherByTetherIds" resultType="PoTether">
  151. <include refid="selectPoTetherVo"/>
  152. where tether_id in
  153. <foreach item="tetherId" collection="array" open="(" separator="," close=")">
  154. #{tetherId}
  155. </foreach>
  156. </select>
  157. <!-- 查询更新完种类数的套系信息-->
  158. <select id="selectPoTetherCollectionList" resultType="PoTether" resultMap="PoTetherResult">
  159. <include refid="selectPoTetherVo"/>
  160. <if test="tetherName != null and tetherName != ''"> and tether_name like concat('%', #{tetherName}, '%')</if>
  161. <if test="showTimeStart != null "> and show_time_start = #{showTimeStart}</if>
  162. <if test="showTimeEnd != null">and show_time_end = #{showTimeEnd}</if>
  163. <if test="total != null "> and total = #{total}</if>
  164. <if test="status != null and status != ''"> and status = #{status}</if>
  165. <if test="image != null and image != '' ">and image = #{image}</if>
  166. <if test="exchange != null">and exchange = #{exchange}</if>
  167. <if test="grounding != null">and grounding = #{grounding}</if>
  168. <if test="cochain != null">and cochain = #{cochain}</if>
  169. <if test="tetherId != null">and tether_id = #{tetherId}</if>
  170. </select>
  171. <!--新增-->
  172. <insert id="insertPoTether" parameterType="PoTether" useGeneratedKeys="true" keyProperty="tetherId">
  173. insert into po_tether
  174. <trim prefix="(" suffix=")" suffixOverrides=",">
  175. <if test="tetherName != null">tether_name,</if>
  176. <if test="showTimeStart != null">show_time_start,</if>
  177. <if test="showTimeEnd != null">show_time_end,</if>
  178. <if test="createBy != null">create_by,</if>
  179. <if test="createTime != null">create_time,</if>
  180. <if test="updateBy != null">update_by,</if>
  181. <if test="updateTime != null">update_time,</if>
  182. <if test="total != null">total,</if>
  183. <if test="status != null">status,</if>
  184. <if test="remark != null">remark,</if>
  185. <if test="sellStatus != null">sell_status,</if>
  186. <if test="image != null and image != ''">image,</if>
  187. <if test="exchange != null">exchange,</if>
  188. <if test="grounding != null">grounding,</if>
  189. <if test="cochain != null">cochain,</if>
  190. <if test="tetherId != null ">tether_id,</if>
  191. </trim>
  192. <trim prefix="values (" suffix=")" suffixOverrides=",">
  193. <if test="tetherName != null">#{tetherName},</if>
  194. <if test="showTimeStart != null">#{showTimeStart},</if>
  195. <if test="showTimeEnd != null">#{showTimeEnd},</if>
  196. <if test="createBy != null">#{createBy},</if>
  197. <if test="createTime != null">#{createTime},</if>
  198. <if test="updateBy != null">#{updateBy},</if>
  199. <if test="updateTime != null">#{updateTime},</if>
  200. <if test="total != null">#{total},</if>
  201. <if test="status != null">#{status},</if>
  202. <if test="remark != null">#{remark},</if>
  203. <if test="sellStatus != null">#{sellStatus},</if>
  204. <if test="image != null and image != ''">#{image},</if>
  205. <if test="exchange != null ">#{exchange},</if>
  206. <if test="grounding != null">#{grounding},</if>
  207. <if test="cochain != null">#{cochain},</if>
  208. <if test="tetherId != null">#{tetherId},</if>
  209. </trim>
  210. </insert>
  211. <update id="updatePoTether" parameterType="PoTether">
  212. update po_tether
  213. <trim prefix="SET" suffixOverrides=",">
  214. <if test="tetherName != null and tetherName != ''">tether_name = #{tetherName},</if>
  215. <if test="showTimeStart != null">show_time_start = #{showTimeStart},</if>
  216. <if test="showTimeEnd != null">show_time_end = #{showTimeEnd},</if>
  217. <if test="createBy != null">create_by = #{createBy},</if>
  218. <if test="createTime != null">create_time = #{createTime},</if>
  219. <if test="updateBy != null">update_by = #{updateBy},</if>
  220. <if test="updateTime != null">update_time = #{updateTime},</if>
  221. <if test="total != null">total = #{total},</if>
  222. <if test="status != null">status = #{status},</if>
  223. <if test="remark != null">remark = #{remark},</if>
  224. <if test="sellStatus != null">sell_status = #{sellStatus},</if>
  225. <if test="delFlag != null">del_flag = #{delFlag},</if>
  226. <if test="image != null">image = #{image},</if>
  227. <if test="exchange != null">exchange = #{exchange},</if>
  228. <if test="grounding != null">grounding = #{grounding},</if>
  229. <if test="cochain != null">cochain = #{cochain},</if>
  230. </trim>
  231. where tether_id = #{tetherId}
  232. </update>
  233. <!--通过Id删除-->
  234. <delete id="deletePoTetherByTetherId" parameterType="Long">
  235. delete from po_tether where tether_id = #{tetherId}
  236. </delete>
  237. <!-- 逻辑删除接口-->
  238. <update id="deletePoTetherByTetherIds" parameterType="String">
  239. update po_tether set del_flag = '1' where tether_id in
  240. <foreach item="tetherId" collection="array" open="(" separator="," close=")">
  241. #{tetherId}
  242. </foreach>
  243. </update>
  244. <!-- 修改状态 是否上链-->
  245. <update id="updatePoTetherIsCochain" parameterType="PoTether">
  246. update po_tether set cochain = #{cochain} where tether_id = #{tetherId}
  247. </update>
  248. <!-- 修改状态 是否上架-->
  249. <update id="updatePoTetherIsGrounding" parameterType="PoTether">
  250. update po_tether set grounding = #{grounding} where tether_id = #{tetherId}
  251. </update>
  252. <!-- 更新种类-->
  253. <update id="updatePostTetherCollection" parameterType="PoTether">
  254. UPDATE po_tether INNER JOIN (
  255. SELECT
  256. po_tether.tether_id,
  257. ( SELECT COUNT( po_Tetherandcollection.tether_id )
  258. FROM po_Tetherandcollection WHERE po_tether.tether_id = po_Tetherandcollection.tether_id ) AS total
  259. FROM
  260. po_tether
  261. ) a
  262. ON po_tether.tether_id = a.tether_id
  263. SET po_tether.total = a.total
  264. </update>
  265. <!-- 只修改展示结束时间-->
  266. <update id="updateShowTimeEnd" parameterType="PoTether">
  267. update po_tether
  268. <trim prefix="SET" suffixOverrides=",">
  269. <if test="showTimeEnd != null">show_time_end = #{showTimeEnd},</if>
  270. </trim>
  271. where tether_id = #{tetherId}
  272. </update>
  273. </mapper>