PoTetherMapper.xml 14 KB

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