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.
 
 
 
 
 

143 lines
5.6 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.WxCouponCarMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCouponCar">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
  7. <result column="park_id" jdbcType="BIGINT" property="parkId" />
  8. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  9. <result column="vendor_type" jdbcType="INTEGER" property="vendorType" />
  10. <result column="vendor_params" jdbcType="VARCHAR" property="vendorParams" />
  11. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  12. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  13. </resultMap>
  14. <sql id="allColumns">
  15. `id`,`tenant_id`,`park_id`,`merchant_id`,`vendor_type`,`vendor_params`,`create_date`,`update_date`
  16. </sql>
  17. <sql id="dynamicWhereConditions">
  18. where 1 = 1
  19. <if test=" null != id ">
  20. and `id` = #{id}
  21. </if>
  22. <if test=" null != tenantId ">
  23. and `tenant_id` = #{tenantId}
  24. </if>
  25. <if test=" null != parkId ">
  26. and `park_id` = #{parkId}
  27. </if>
  28. <if test=" null != merchantId ">
  29. and `merchant_id` = #{merchantId}
  30. </if>
  31. <if test=" null != vendorType ">
  32. and `vendor_type` = #{vendorType}
  33. </if>
  34. <if test=" null != vendorParams ">
  35. and `vendor_params` like concat('%', #{vendorParams},'%')
  36. </if>
  37. <if test=" null != createDate ">
  38. and `create_date` = #{createDate}
  39. </if>
  40. <if test=" null != updateDate ">
  41. and `update_date` = #{updateDate}
  42. </if>
  43. <if test=" null != ids ">
  44. and id in
  45. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  46. #{idItem}
  47. </foreach>
  48. </if>
  49. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  50. </sql>
  51. <select id="findList" parameterType="com.iformall.domain.po.WxCouponCar" resultMap="BaseResultMap">
  52. select <include refid="allColumns" /> from wx_coupon_car
  53. <include refid="dynamicWhereConditions" />
  54. </select>
  55. <select id="findTemplateAmtCount" parameterType="Long" resultType="Integer">
  56. select IFNULL(sum(c.inventory),0) as count
  57. from wx_coupon_car car, wx_coupon c
  58. where car.id = c.id
  59. and c.status = 0
  60. and json_extract(vendor_params,'$.id') = ${value}
  61. </select>
  62. <select id="findTemplateAvailCount" parameterType="Long" resultType="Integer">
  63. select IFNULL(sum(c.remain_inventory),0) as count
  64. from wx_coupon_car car, wx_coupon c
  65. where car.id = c.id
  66. and c.status = 0
  67. and json_extract(vendor_params,'$.id') = ${value}
  68. </select>
  69. <resultMap id="CouponCarMap" type="com.iformall.domain.vo.WxCouponCarVo">
  70. <id column="id" jdbcType="BIGINT" property="id" />
  71. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  72. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  73. <result column="type" jdbcType="INTEGER" property="type" />
  74. <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
  75. <result column="title" jdbcType="VARCHAR" property="title" />
  76. <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
  77. <result column="sale_price" jdbcType="INTEGER" property="salePrice" />
  78. <result column="use_price" jdbcType="INTEGER" property="usePrice" />
  79. <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity" />
  80. <result column="target_ad" jdbcType="INTEGER" property="targetAd" />
  81. <result column="send_type" jdbcType="INTEGER" property="sendType" />
  82. <result column="valid_type" jdbcType="INTEGER" property="validType" />
  83. <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" />
  84. <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate" />
  85. <result column="valid_days" jdbcType="INTEGER" property="validDays" />
  86. <result column="detail" jdbcType="VARCHAR" property="detail" />
  87. <result column="price" jdbcType="INTEGER" property="price" />
  88. <result column="unit" jdbcType="INTEGER" property="unit" />
  89. <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory" />
  90. <result column="inventory" jdbcType="INTEGER" property="inventory" />
  91. <result column="remark" jdbcType="VARCHAR" property="remark" />
  92. <result column="status" jdbcType="INTEGER" property="status" />
  93. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  94. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  95. <result column="business" jdbcType="VARCHAR" property="business" />
  96. <result column="vendor_type" jdbcType="INTEGER" property="vendorType" />
  97. <result column="vendor_params" jdbcType="VARCHAR" property="vendorParams" />
  98. </resultMap>
  99. <sql id="CouponCarColumns">
  100. c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business,
  101. car.vendor_type, car.vendor_params
  102. </sql>
  103. <select id="selectCouponCarDetail" parameterType="com.iformall.domain.vo.WxCouponCarVo" resultMap="CouponCarMap">
  104. select <include refid="CouponCarColumns" />
  105. from
  106. wx_coupon c,wx_coupon_car car
  107. where c.id = car.id
  108. <if test=" null != id ">
  109. and c.id = #{id}
  110. </if>
  111. <if test=" null != tenantId ">
  112. and c.tenant_id = #{tenantId}
  113. </if>
  114. </select>
  115. </mapper>