GoodsGroupDao.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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.admin.dao.GoodsGroupDao">
  4. <resultMap type="com.kmall.admin.entity.GoodsGroupEntity" id="goodsGroupMap">
  5. <result property="id" column="id"/>
  6. <result property="title" column="title"/>
  7. <result property="itemPicUrl" column="item_pic_url"/>
  8. <result property="launchNum" column="launch_num"/>
  9. <result property="goodsId" column="goods_id"/>
  10. <result property="sortOrder" column="sort_order"/>
  11. <result property="minOpenGroup" column="min_open_group"/>
  12. <result property="subtitle" column="subtitle"/>
  13. <result property="retailMinPrice" column="retail_min_price"/>
  14. <result property="openTime" column="open_time"/>
  15. <result property="endTime" column="end_time"/>
  16. <result property="openStatus" column="open_status"/>
  17. <result property="validDays" column="valid_days"/>
  18. <result property="adDesc" column="ad_desc"/>
  19. <result property="abbrPicUrl" column="abbr_pic_url"/>
  20. </resultMap>
  21. <select id="queryObject" resultType="com.kmall.admin.entity.GoodsGroupEntity">
  22. select
  23. `id`,
  24. `title`,
  25. `item_pic_url`,
  26. `launch_num`,
  27. `goods_id`,
  28. `sort_order`,
  29. `min_open_group`,
  30. `subtitle`,
  31. `retail_min_price`,
  32. `open_time`,
  33. `end_time`,
  34. `open_status`,
  35. `ad_desc`,
  36. `valid_days`,
  37. `abbr_pic_url`
  38. from mall_goods_group
  39. where id = #{id}
  40. </select>
  41. <select id="queryList" resultType="com.kmall.admin.entity.GoodsGroupEntity">
  42. select
  43. mall_goods_group.id,
  44. mall_goods_group.title,
  45. mall_goods_group.item_pic_url,
  46. mall_goods_group.launch_num,
  47. mall_goods_group.goods_id,
  48. mall_goods_group.sort_order,
  49. mall_goods_group.min_open_group,
  50. mall_goods_group.subtitle,
  51. mall_goods_group.retail_min_price,
  52. mall_goods_group.open_time,
  53. mall_goods_group.end_time,
  54. mall_goods_group.open_status,
  55. mall_goods_group.valid_days,
  56. mall_goods_group.ad_desc,
  57. mall_goods_group.abbr_pic_url,
  58. mall_goods.name goods_name
  59. from mall_goods_group
  60. LEFT JOIN mall_goods on mall_goods.id = mall_goods_group.goods_id
  61. WHERE 1=1
  62. <if test="title != null and title.trim() != ''">
  63. AND mall_goods_group.title LIKE concat('%',#{title},'%')
  64. </if>
  65. <if test="subtitle != null and subtitle.trim() != ''">
  66. AND mall_goods_group.subtitle LIKE concat('%',#{subtitle},'%')
  67. </if>
  68. <if test="goodsName != null and goodsName.trim() != ''">
  69. AND mall_goods.name LIKE concat('%',#{goodsName},'%')
  70. </if>
  71. <if test="goodsId != null and goodsId != ''">
  72. AND mall_goods_group.goods_id = #{goodsId}
  73. </if>
  74. <choose>
  75. <when test="sidx != null and sidx.trim() != ''">
  76. order by ${sidx} ${order}
  77. </when>
  78. <otherwise>
  79. order by id desc
  80. </otherwise>
  81. </choose>
  82. <if test="offset != null and limit != null">
  83. limit #{offset}, #{limit}
  84. </if>
  85. </select>
  86. <select id="queryTotal" resultType="int">
  87. select count(*) from mall_goods_group
  88. LEFT JOIN mall_goods on mall_goods.id = mall_goods_group.goods_id
  89. WHERE 1=1
  90. <if test="title != null and title.trim() != ''">
  91. AND mall_goods_group.title LIKE concat('%',#{title},'%')
  92. </if>
  93. <if test="subtitle != null and subtitle.trim() != ''">
  94. AND mall_goods_group.subtitle LIKE concat('%',#{subtitle},'%')
  95. </if>
  96. <if test="goodsName != null and goodsName.trim() != ''">
  97. AND mall_goods.name LIKE concat('%',#{goodsName},'%')
  98. </if>
  99. <if test="goodsId != null and goodsId != ''">
  100. AND mall_goods_group.goods_id = #{goodsId}
  101. </if>
  102. </select>
  103. <insert id="save" parameterType="com.kmall.admin.entity.GoodsGroupEntity" useGeneratedKeys="true" keyProperty="id">
  104. insert into mall_goods_group(
  105. `title`,
  106. `item_pic_url`,
  107. `launch_num`,
  108. `goods_id`,
  109. `sort_order`,
  110. `min_open_group`,
  111. `subtitle`,
  112. `retail_min_price`,
  113. `open_time`,
  114. `end_time`,
  115. `open_status`,
  116. `ad_desc`,
  117. `valid_days`,
  118. `abbr_pic_url`)
  119. values(
  120. #{title},
  121. #{itemPicUrl},
  122. #{launchNum},
  123. #{goodsId},
  124. #{sortOrder},
  125. #{minOpenGroup},
  126. #{subtitle},
  127. #{retailMinPrice},
  128. #{openTime},
  129. #{endTime},
  130. #{openStatus},
  131. #{adDesc},
  132. #{validDays},
  133. #{abbrPicUrl})
  134. </insert>
  135. <update id="update" parameterType="com.kmall.admin.entity.GoodsGroupEntity">
  136. update mall_goods_group
  137. <set>
  138. <if test="title != null">`title` = #{title},</if>
  139. <if test="itemPicUrl != null">`item_pic_url` = #{itemPicUrl},</if>
  140. <if test="launchNum != null">`launch_num` = #{launchNum},</if>
  141. <if test="goodsId != null">`goods_id` = #{goodsId},</if>
  142. <if test="sortOrder != null">`sort_order` = #{sortOrder},</if>
  143. <if test="minOpenGroup != null">`min_open_group` = #{minOpenGroup},</if>
  144. <if test="subtitle != null">`subtitle` = #{subtitle},</if>
  145. <if test="retailMinPrice != null">`retail_min_price` = #{retailMinPrice},</if>
  146. <if test="openTime != null">`open_time` = #{openTime},</if>
  147. <if test="endTime != null">`end_time` = #{endTime},</if>
  148. <if test="openStatus != null">`open_status` = #{openStatus},</if>
  149. <if test="validDays != null">`ad_desc` = #{adDesc},</if>
  150. <if test="validDays != null">`valid_days` = #{validDays},</if>
  151. <if test="abbrPicUrl != null">`abbr_pic_url` = #{abbrPicUrl}</if>
  152. </set>
  153. where id = #{id}
  154. </update>
  155. <delete id="delete">
  156. delete from mall_goods_group where id = #{value}
  157. </delete>
  158. <delete id="deleteBatch">
  159. delete from mall_goods_group where id in
  160. <foreach item="id" collection="array" open="(" separator="," close=")">
  161. #{id}
  162. </foreach>
  163. </delete>
  164. </mapper>