后台服务
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.

151 regels
6.3 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="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
  8. <result column="park_id" jdbcType="BIGINT" property="parkId" />
  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`,`parent_tenant_id`,`park_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 and '' != tenantId">
  23. and `tenant_id` = #{tenantId}
  24. </if>
  25. <if test=" null != parentTenantId and '' != parentTenantId">
  26. and `parent_tenant_id` = #{parentTenantId}
  27. </if>
  28. <if test=" null != parkId ">
  29. and `park_id` = #{parkId}
  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
  53. <include refid="allColumns"/>
  54. from wx_coupon_car
  55. <include refid="dynamicWhereConditions" />
  56. </select>
  57. <select id="findTemplateAmtCount" parameterType="Long" resultType="Integer">
  58. select IFNULL(sum(c.inventory),0) as count
  59. from wx_coupon_car car, wx_coupon c
  60. where car.id = c.id
  61. and c.status = 0
  62. and json_extract(car.vendor_params,'$.id') = ${value}
  63. </select>
  64. <select id="findAmtCountForCouponOrderTakeOff" parameterType="Long" resultType="Integer">
  65. select count(co.id) as id_count
  66. from wx_coupon_order co, wx_coupon c, wx_coupon_car car
  67. where 1=1
  68. and c.id = co.coupon_id
  69. and (co.coupon_order_status = 0 or co.coupon_order_status = 1)
  70. and c.status = 1
  71. and car.id = c.id
  72. and json_extract(car.vendor_params,'$.id') = ${value}
  73. </select>
  74. <select id="findTemplateAvailCount" parameterType="Long" resultType="Integer">
  75. select IFNULL(sum(c.remain_inventory),0) as count
  76. from wx_coupon_car car, wx_coupon c
  77. where car.id = c.id
  78. and c.status = 0
  79. and json_extract(vendor_params,'$.id') = ${value}
  80. </select>
  81. <resultMap id="CouponCarMap" type="com.iformall.domain.vo.WxCouponCarVo">
  82. <id column="id" jdbcType="BIGINT" property="id" />
  83. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  84. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
  85. <result column="type" jdbcType="INTEGER" property="type" />
  86. <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
  87. <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture" />
  88. <result column="title" jdbcType="VARCHAR" property="title" />
  89. <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
  90. <result column="sale_price" jdbcType="INTEGER" property="salePrice" />
  91. <result column="use_price" jdbcType="INTEGER" property="usePrice" />
  92. <result column="use_limit_rule" jdbcType="INTEGER" property="useLimitRule" />
  93. <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity" />
  94. <result column="send_type" jdbcType="INTEGER" property="sendType" />
  95. <result column="valid_type" jdbcType="INTEGER" property="validType" />
  96. <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" />
  97. <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate" />
  98. <result column="valid_days" jdbcType="INTEGER" property="validDays" />
  99. <result column="detail" jdbcType="VARCHAR" property="detail" />
  100. <result column="price" jdbcType="INTEGER" property="price" />
  101. <result column="unit" jdbcType="INTEGER" property="unit" />
  102. <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory" />
  103. <result column="inventory" jdbcType="INTEGER" property="inventory" />
  104. <result column="remark" jdbcType="VARCHAR" property="remark" />
  105. <result column="status" jdbcType="INTEGER" property="status" />
  106. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  107. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  108. <result column="business" jdbcType="VARCHAR" property="business" />
  109. <result column="credit_price" jdbcType="INTEGER" property="creditPrice" />
  110. <result column="content_type" jdbcType="INTEGER" property="contentType"/>
  111. <result column="vendor_type" jdbcType="INTEGER" property="vendorType" />
  112. <result column="vendor_params" jdbcType="VARCHAR" property="vendorParams" />
  113. </resultMap>
  114. <sql id="CouponCarColumns">
  115. c.id,c.tenant_id,c.parent_tenant_id,c.type,c.cover_img,c.cover_picture,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_rule,c.use_limit_quantity,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,
  116. car.vendor_type, car.vendor_params,c.credit_price, c.`auto_refund`, c.content_type
  117. </sql>
  118. <select id="findVoDetail" parameterType="java.lang.Long" resultMap="CouponCarMap">
  119. select
  120. <include refid="CouponCarColumns"/>
  121. from
  122. wx_coupon c,wx_coupon_car car
  123. where c.id = car.id
  124. and c.id = #{id}
  125. </select>
  126. </mapper>