GoodsGroupOpenDao.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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.GoodsGroupOpenDao">
  4. <resultMap type="com.kmall.admin.entity.GoodsGroupOpenEntity" id="goodsGroupOpenMap">
  5. <result property="id" column="id"/>
  6. <result property="groupId" column="group_id"/>
  7. <result property="userId" column="user_id"/>
  8. <result property="openTime" column="open_time"/>
  9. <result property="endTime" column="end_time"/>
  10. <result property="attendStatus" column="attend_status"/>
  11. <result property="attendNum" column="attend_num"/>
  12. </resultMap>
  13. <select id="queryObject" resultType="com.kmall.admin.entity.GoodsGroupOpenEntity">
  14. select
  15. id,
  16. group_id,
  17. user_id,
  18. open_time,
  19. end_time,
  20. attend_status,
  21. attend_num
  22. from mall_goods_group_open
  23. where id = #{id}
  24. </select>
  25. <select id="queryList" resultType="com.kmall.admin.entity.GoodsGroupOpenEntity">
  26. select
  27. mall_goods_group_open.id,
  28. mall_goods_group_open.group_id,
  29. mall_goods_group_open.user_id,
  30. mall_goods_group_open.open_time,
  31. mall_goods_group_open.end_time,
  32. mall_goods_group_open.attend_status,
  33. mall_goods_group_open.attend_num,
  34. mall_user.username user_name
  35. from mall_goods_group_open
  36. LEFT JOIN mall_user on mall_goods_group_open.user_id=mall_user.id
  37. WHERE 1=1
  38. <if test="groupId != null and groupId != '' and groupId != 'null'">
  39. AND group_id = #{groupId}
  40. </if>
  41. <choose>
  42. <when test="sidx != null and sidx.trim() != ''">
  43. order by ${sidx} ${order}
  44. </when>
  45. <otherwise>
  46. order by id desc
  47. </otherwise>
  48. </choose>
  49. <if test="offset != null and limit != null">
  50. limit #{offset}, #{limit}
  51. </if>
  52. </select>
  53. <select id="queryTotal" resultType="int">
  54. select count(*) from mall_goods_group_open
  55. WHERE 1=1
  56. <if test="groupId != null and groupId != ''">
  57. AND group_id = #{groupId}
  58. </if>
  59. </select>
  60. <insert id="save" parameterType="com.kmall.admin.entity.GoodsGroupOpenEntity" useGeneratedKeys="true" keyProperty="id">
  61. insert into mall_goods_group_open(
  62. group_id,
  63. user_id,
  64. open_time,
  65. end_time,
  66. attend_status,
  67. attend_num)
  68. values(
  69. #{groupId},
  70. #{userId},
  71. #{openTime},
  72. #{endTime},
  73. #{attendStatus},
  74. #{attendNum})
  75. </insert>
  76. <update id="update" parameterType="com.kmall.admin.entity.GoodsGroupOpenEntity">
  77. update mall_goods_group_open
  78. <set>
  79. <if test="groupId != null">`group_id` = #{groupId}, </if>
  80. <if test="userId != null">`user_id` = #{userId}, </if>
  81. <if test="openTime != null">`open_time` = #{openTime}, </if>
  82. <if test="endTime != null">`end_time` = #{endTime}, </if>
  83. <if test="attendStatus != null">`attend_status` = #{attendStatus}, </if>
  84. <if test="attendNum != null">`attend_num` = #{attendNum}</if>
  85. </set>
  86. where id = #{id}
  87. </update>
  88. <delete id="delete">
  89. delete from mall_goods_group_open where id = #{value}
  90. </delete>
  91. <delete id="deleteBatch">
  92. delete from mall_goods_group_open where id in
  93. <foreach item="id" collection="array" open="(" separator="," close=")">
  94. #{id}
  95. </foreach>
  96. </delete>
  97. </mapper>