You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

96 lines
3.5 KiB

  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.iformall.mapper.WxOrderGroupMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxOrderGroup">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="order_id" jdbcType="BIGINT" property="orderId"/>
  8. <result column="coupon_id" jdbcType="BIGINT" property="couponId"/>
  9. <result column="remain_people" jdbcType="INTEGER" property="remainPeople"/>
  10. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  11. <result column="update_date" jdbcType="TIMESTAMP" property="createDate"/>
  12. <result column="expired_date" jdbcType="TIMESTAMP" property="createDate"/>
  13. <result column="status" jdbcType="SMALLINT" property="status"/>
  14. <result column="user_id" jdbcType="BIGINT" property="userId"/>
  15. </resultMap>
  16. <sql id="allColumns">
  17. `id`,`tenant_id`,`order_id`,`coupon_id`,`remain_people`,`create_date`,`update_date`,`expired_date`,`status`,`user_id`
  18. </sql>
  19. <sql id="dynamicWhereConditions">
  20. where 1 = 1
  21. <if test=" null != id ">
  22. and `id` = #{id}
  23. </if>
  24. <if test=" null != tenantId ">
  25. and `tenant_id` = #{tenantId}
  26. </if>
  27. <if test=" null != orderId ">
  28. and `order_id` = #{orderId}
  29. </if>
  30. <if test=" null != userId ">
  31. and `coupon_id` = #{couponId}
  32. </if>
  33. <if test=" null != pressValue ">
  34. and `remain_people` = #{remainPeople}
  35. </if>
  36. <if test=" null != createDate ">
  37. and `create_date` = #{createDate}
  38. </if>
  39. <if test=" null != ids ">
  40. and id in
  41. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  42. #{idItem}
  43. </foreach>
  44. </if>
  45. <if test=" null != sortColumns">order by ${sortColumns}</if>
  46. </sql>
  47. <select id="findList" parameterType="com.iformall.domain.po.WxOrderGroup" resultMap="BaseResultMap">
  48. select
  49. <include refid="allColumns"/>
  50. from wx_order_group
  51. <include refid="dynamicWhereConditions"/>
  52. </select>
  53. <select id="queryRemainOne" parameterType="com.iformall.domain.po.WxOrderGroup" resultType="hashmap">
  54. select o.press_end_date expiredDate,o.order_group_id orderGroupId,c.nick_name nickName,
  55. c.avatar_url avatarUrl,o.id orderId,o.product_id couponId
  56. from wx_order o
  57. left join wx_c_user c on o.c_user_id=c.id
  58. where o.tenant_id=#{tenantId} and o.id=#{orderId}
  59. </select>
  60. <select id="queryOrderGroup" parameterType="com.iformall.domain.po.WxOrder" resultType="hashmap">
  61. select o.id orderId,o.order_status orderStatus,o.order_group_id orderGroupId,c.title,c.sub_title subTitle,
  62. c.sale_price salePrice,c.cover_img coverImg,g.remain_people remainPeople,c.id couponId,g.expired_date
  63. expiredDate,g.status,g.user_id firstUser,u.nick_name nickName,u.avatar_url avatarUrl,o.tenant_id tenantId,
  64. cc.id couponChannelId,c.press_limit_num pressLimitNum,c.status couponStatus
  65. from wx_order o
  66. left join wx_coupon c on o.product_id=c.id
  67. left join wx_order_group g on o.order_group_id=g.id
  68. left join wx_c_user u on o.c_user_id=u.id
  69. left join wx_coupon_channel cc on c.id=cc.coupon_id
  70. where o.tenant_id=#{tenantId}
  71. <if test=" null != cUserId ">
  72. and o.c_user_id=#{cUserId} and o.order_status not in(0,1,2,3)
  73. </if>
  74. <if test=" null != id ">
  75. and o.id=#{id}
  76. </if>
  77. <if test=" null != orderGroupId ">
  78. and o.order_group_id=#{orderGroupId}
  79. </if>
  80. and o.order_group_id!=0 and g.status in(10,11,12,13)
  81. order by o.id desc,o.order_status
  82. </select>
  83. </mapper>