PostCollectionsMapper.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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.PostCollectionsMapper">
  6. <resultMap type="PostCollections" id="PostCollectionsResult">
  7. <result property="id" column="id" />
  8. <result property="systemId" column="system_id" />
  9. <result property="issuerId" column="issuer_id" />
  10. <result property="name" column="name" />
  11. <result property="startTime" column="start_time" />
  12. <result property="endTime" column="end_time" />
  13. <result property="price" column="price" />
  14. <result property="status" column="status" />
  15. <result property="collectionsNumber" column="collections_number" />
  16. <result property="collectionsStory" column="collections_story" />
  17. <result property="image" column="image" />
  18. <result property="createTime" column="create_time" />
  19. <result property="updateTime" column="update_time" />
  20. <result property="createBy" column="create_by" />
  21. <result property="updateBy" column="update_by" />
  22. <result property="delFlag" column="del_flag" />
  23. </resultMap>
  24. <sql id="selectPostCollectionsVo">
  25. select id, system_id, issuer_id, name, start_time, end_time,price, status, collections_number, collections_story, image, create_time, update_time, create_by, update_by, del_flag from post_collections
  26. </sql>
  27. <select id="selectPostCollectionsList" parameterType="PostCollections" resultMap="PostCollectionsResult">
  28. <include refid="selectPostCollectionsVo"/>
  29. <where>
  30. <if test="systemId != null "> and system_id = #{systemId}</if><!--条件套系id等于前端传过来的id-->
  31. and del_flag = '0'
  32. </where>
  33. </select>
  34. <!--查询藏品详细信息,查发行方名称字段-->
  35. <select id="selectPostCollectionsById" parameterType="Long" resultType="PostCollectionsVo">
  36. select c.image , c.name , c.price , c.start_time, c.end_time ,c.collections_number,c.collections_story , i.Issuer_name issuerName
  37. from post_collections c
  38. left join issuer i
  39. on c.issuer_id = i.id
  40. where c.id = #{id} and c.del_flag = '0'
  41. </select>
  42. <insert id="insertPostCollections" parameterType="PostCollections" useGeneratedKeys="true" keyProperty="id">
  43. insert into post_collections
  44. <trim prefix="(" suffix=")" suffixOverrides=",">
  45. <if test="systemId != null">system_id,</if>
  46. <if test="issuerId != null">issuer_id,</if>
  47. <if test="name != null">name,</if>
  48. <if test="startTime != null">start_time,</if>
  49. <if test="endTime != null">end_time,</if>
  50. <if test="price != null">price,</if>
  51. <if test="status != null">status,</if>
  52. <if test="collectionsNumber != null">collections_number,</if>
  53. <if test="collectionsStory != null">collections_story,</if>
  54. <if test="image != null">image,</if>
  55. <if test="createTime != null">create_time,</if>
  56. <if test="updateTime != null">update_time,</if>
  57. <if test="createBy != null">create_by,</if>
  58. <if test="updateBy != null">update_by,</if>
  59. <if test="delFlag != null">del_flag,</if>
  60. </trim>
  61. <trim prefix="values (" suffix=")" suffixOverrides=",">
  62. <if test="systemId != null">#{systemId},</if>
  63. <if test="issuerId != null">#{issuerId},</if>
  64. <if test="name != null">#{name},</if>
  65. <if test="startTime != null">#{startTime},</if>
  66. <if test="endTime != null">#{endTime},</if>
  67. <if test="price != null">#{price},</if>
  68. <if test="status != null">#{status},</if>
  69. <if test="collectionsNumber != null">#{collectionsNumber},</if>
  70. <if test="collectionsStory != null">#{collectionsStory},</if>
  71. <if test="image != null">#{image},</if>
  72. <if test="createTime != null">#{createTime},</if>
  73. <if test="updateTime != null">#{updateTime},</if>
  74. <if test="createBy != null">#{createBy},</if>
  75. <if test="updateBy != null">#{updateBy},</if>
  76. <if test="delFlag != null">#{delFlag},</if>
  77. </trim>
  78. </insert>
  79. <update id="updatePostCollections" parameterType="PostCollections">
  80. update post_collections
  81. <trim prefix="SET" suffixOverrides=",">
  82. <if test="systemId != null">system_id = #{systemId},</if>
  83. <if test="issuerId != null">issuer_id = #{issuerId},</if>
  84. <if test="name != null">name = #{name},</if>
  85. <if test="startTime != null">start_time = #{startTime},</if>
  86. <if test="endTime != null">end_time = #{endTime},</if>
  87. <if test="price != null">#{price},</if>
  88. <if test="status != null">status = #{status},</if>
  89. <if test="collectionsNumber != null">collections_number = #{collectionsNumber},</if>
  90. <if test="collectionsStory != null">collections_story = #{collectionsStory},</if>
  91. <if test="image != null">image = #{image},</if>
  92. <if test="createTime != null">create_time = #{createTime},</if>
  93. <if test="updateTime != null">update_time = #{updateTime},</if>
  94. <if test="createBy != null">create_by = #{createBy},</if>
  95. <if test="updateBy != null">update_by = #{updateBy},</if>
  96. <if test="delFlag != null">del_flag = #{delFlag},</if>
  97. </trim>
  98. where id = #{id}
  99. </update>
  100. <delete id="deletePostCollectionsById" parameterType="Long">
  101. UPDATE post_collections SET del_flag = '1' WHERE del_flag = '0' AND (id = #{id})
  102. </delete>
  103. <delete id="deletePostCollectionsByIds" parameterType="String">
  104. UPDATE post_collections SET del_flag = '1' WHERE del_flag = '0' AND id in
  105. <foreach item="id" collection="array" open="(" separator="," close=")">
  106. #{id}
  107. </foreach>
  108. </delete>
  109. <!--根据藏品名称查询藏品数量-->
  110. <select id="selectPostCollectionsByName" parameterType="PostCollectionsVo" resultType="int">
  111. select COUNT(name) FROM post_collections where name = #{name} and del_flag = '0'
  112. </select>
  113. <!--批量修改藏品状态status-->
  114. <update id="updatePostCollectionsStatus" parameterType="PostCollections">
  115. update post_collections set status = '4',update_time = #{updateTime}, update_by = #{updateBy} where system_id=#{systemId} and del_flag = '0'
  116. </update>
  117. </mapper>