1
0

ApiGoodsGroupOpenMapper.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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.kmall.api.dao.ApiGoodsGroupOpenMapper">
  4. <resultMap type="com.kmall.api.entity.GoodsGroupOpenVo" id="goodsGroupOpenMap">
  5. <result property="id" column="id"/>
  6. <result property="group_id" column="group_id"/>
  7. <result property="user_id" column="user_id"/>
  8. <result property="open_time" column="open_time"/>
  9. <result property="end_time" column="end_time"/>
  10. <result property="attend_status" column="attend_status"/>
  11. <result property="attend_num" column="attend_num"/>
  12. <result property="title" column="title"/>
  13. <result property="item_pic_url" column="item_pic_url"/>
  14. <result property="market_price" column="market_price"/>
  15. <result property="goods_id" column="goods_id"/>
  16. <result property="subtitle" column="subtitle"/>
  17. <result property="retail_min_price" column="retail_min_price"/>
  18. <result property="min_open_group" column="min_open_group"/>
  19. <result property="avatar" column="avatar"/>
  20. <result property="nickname" column="nickname"/>
  21. </resultMap>
  22. <select id="queryObject" resultMap="goodsGroupOpenMap">
  23. select
  24. a.`id`,
  25. a.`group_id`,
  26. a.`user_id`,
  27. a.`open_time`,
  28. a.`end_time`,
  29. a.`attend_status`,
  30. a.`attend_num`,
  31. b.title,
  32. b.`item_pic_url`,
  33. c.`market_price`,
  34. b.`goods_id`,
  35. b.`subtitle`,
  36. b.`min_open_group`,
  37. b.`retail_min_price`,
  38. d.avatar,
  39. d.nickname
  40. from mall_goods_group_open a
  41. left join mall_goods_group b on a.group_id = b.id
  42. left join mall_goods c on c.id = b.goods_id
  43. left join mall_user d on d.id = a.user_id
  44. where a.id = #{id}
  45. </select>
  46. <select id="queryList" resultMap="goodsGroupOpenMap">
  47. select a.`id`,
  48. a.`group_id`,
  49. a.`user_id`,
  50. a.`open_time`,
  51. a.`end_time`,
  52. a.`attend_status`,
  53. a.`attend_num`,
  54. b.title,
  55. b.`item_pic_url`,
  56. c.`market_price`,
  57. b.`goods_id`,
  58. b.`subtitle`,
  59. b.`min_open_group`,
  60. b.`retail_min_price`,
  61. d.avatar,
  62. d.nickname
  63. from mall_goods_group_open a
  64. left join mall_goods_group b on a.group_id = b.id
  65. left join mall_goods c on c.id = b.goods_id
  66. left join mall_user d on d.id = a.user_id
  67. WHERE 1=1
  68. <if test="name != null and name.trim() != ''">
  69. AND a.name LIKE concat('%',#{name},'%')
  70. </if>
  71. <if test="group_id != null">
  72. AND a.group_id = #{group_id}
  73. </if>
  74. <if test="end_time != null">
  75. AND a.end_time > #{end_time}
  76. </if>
  77. <if test="attend_status != null">
  78. AND a.attend_status = #{attend_status}
  79. </if>
  80. <choose>
  81. <when test="sidx != null and sidx.trim() != ''">
  82. order by ${sidx} ${order}
  83. </when>
  84. <otherwise>
  85. order by a.id desc
  86. </otherwise>
  87. </choose>
  88. <if test="offset != null and limit != null">
  89. limit #{offset}, #{limit}
  90. </if>
  91. </select>
  92. <select id="queryTotal" resultType="int">
  93. select count(*) from mall_goods_group_open
  94. WHERE 1=1
  95. <if test="name != null and name.trim() != ''">
  96. AND name LIKE concat('%',#{name},'%')
  97. </if>
  98. </select>
  99. <insert id="save" parameterType="com.kmall.api.entity.GoodsGroupOpenVo" useGeneratedKeys="true" keyProperty="id">
  100. insert into mall_goods_group_open(
  101. `group_id`,
  102. `user_id`,
  103. `open_time`,
  104. `end_time`,
  105. `attend_status`,
  106. `attend_num`)
  107. values(
  108. #{group_id},
  109. #{user_id},
  110. #{open_time},
  111. #{end_time},
  112. #{attend_status},
  113. #{attend_num})
  114. </insert>
  115. <update id="update" parameterType="com.kmall.api.entity.GoodsGroupOpenVo">
  116. update mall_goods_group_open
  117. <set>
  118. <if test="group_id != null">`group_id` = #{group_id},</if>
  119. <if test="user_id != null">`user_id` = #{user_id},</if>
  120. <if test="open_time != null">`open_time` = #{open_time},</if>
  121. <if test="end_time != null">`end_time` = #{end_time},</if>
  122. <if test="attend_status != null">`attend_status` = #{attend_status},</if>
  123. <if test="attend_num != null">`attend_num` = #{attend_num}</if>
  124. </set>
  125. where id = #{id}
  126. </update>
  127. <delete id="delete">
  128. delete from mall_goods_group_open where id = #{value}
  129. </delete>
  130. <delete id="deleteBatch">
  131. delete from mall_goods_group_open where id in
  132. <foreach item="id" collection="array" open="(" separator="," close=")">
  133. #{id}
  134. </foreach>
  135. </delete>
  136. </mapper>