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.
 
 
 
 
 

154 rivejä
4.7 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.simple.mapper.WxCouponChannelMapper">
  4. <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCouponChannel">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  7. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  8. <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
  9. <result column="type" jdbcType="INTEGER" property="type" />
  10. <result column="title" jdbcType="VARCHAR" property="title" />
  11. <result column="target_ad" jdbcType="INTEGER" property="targetAd" />
  12. <result column="business" jdbcType="VARCHAR" property="business" />
  13. <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime" />
  14. <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
  15. <result column="status" jdbcType="INTEGER" property="status" />
  16. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  17. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  18. <result column="sub_target_id" jdbcType="BIGINT" property="subTargetId" />
  19. </resultMap>
  20. <sql id="allColumns">
  21. `id`,`tenant_id`,`merchant_id`,`coupon_id`,`coupon_status`,`type`,`title`,`target_ad`,`business`,`begin_time`,`end_time`,`status`,`create_date`,`update_date`,`sub_target_id`
  22. </sql>
  23. <sql id="dynamicWhereConditions">
  24. where 1 = 1
  25. <if test=" null != id ">
  26. and `id` = #{id}
  27. </if>
  28. <if test=" null != tenantId ">
  29. and `tenant_id` like concat('%', #{tenantId},'%')
  30. </if>
  31. <if test=" null != merchantId ">
  32. and `merchant_id` = #{merchantId}
  33. </if>
  34. <if test=" null != couponId ">
  35. and `coupon_id` = #{couponId}
  36. </if>
  37. <if test=" null != type ">
  38. and `type` = #{type}
  39. </if>
  40. <if test=" null != title ">
  41. and `title` like concat('%', #{title},'%')
  42. </if>
  43. <if test=" null != targetAd ">
  44. and `target_ad` = #{targetAd}
  45. </if>
  46. <if test=" null != business ">
  47. and `business` like concat('%', #{business},'%')
  48. </if>
  49. <if test=" null != beginTime ">
  50. and `begin_time` = #{beginTime}
  51. </if>
  52. <if test=" null != endTime ">
  53. and `end_time` = #{endTime}
  54. </if>
  55. <if test=" null != status ">
  56. and `status` = #{status}
  57. </if>
  58. <if test=" null != createDate ">
  59. and `create_date` = #{createDate}
  60. </if>
  61. <if test=" null != updateDate ">
  62. and `update_date` = #{updateDate}
  63. </if>
  64. <if test=" null != subTargetId ">
  65. and `sub_target_id` = #{subTargetId}
  66. </if>
  67. <if test=" null != ids ">
  68. and id in
  69. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  70. #{idItem}
  71. </foreach>
  72. </if>
  73. <if test=" null != couponIds ">
  74. and coupon_id in
  75. <foreach collection="couponIds" index="index" item="couponIdsItem" open="(" separator="," close=")">
  76. #{couponIdsItem}
  77. </foreach>
  78. </if>
  79. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  80. </sql>
  81. <select id="findList" parameterType="com.simple.domain.po.WxCouponChannel" resultMap="BaseResultMap">
  82. select <include refid="allColumns" /> from wx_coupon_channel
  83. <include refid="dynamicWhereConditions" />
  84. </select>
  85. <select id="findListByCouponIds" parameterType="com.simple.domain.po.WxCouponChannel" resultMap="BaseResultMap">
  86. select <include refid="allColumns" /> from wx_coupon_channel
  87. <include refid="dynamicWhereConditions" />
  88. </select>
  89. <select id="findVoList" parameterType="com.simple.domain.po.WxCouponChannel" resultMap="CouponChannelVoMap">
  90. select <include refid="allColumns" /> from wx_coupon_channel
  91. <include refid="dynamicWhereConditions" />
  92. </select>
  93. <update id="updateStatusByCouponId" parameterType="com.simple.domain.po.WxCouponChannel">
  94. update wx_coupon_channel set status=#{status} where tenant_id=#{tenantId} and coupon_id=#{couponId}
  95. </update>
  96. <resultMap id="CouponChannelVoMap" type="com.simple.domain.vo.WxCouponChannelVo">
  97. <id column="id" jdbcType="BIGINT" property="id" />
  98. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  99. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  100. <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
  101. <result column="type" jdbcType="INTEGER" property="type" />
  102. <result column="title" jdbcType="VARCHAR" property="title" />
  103. <result column="target_ad" jdbcType="INTEGER" property="targetAd" />
  104. <result column="business" jdbcType="VARCHAR" property="business" />
  105. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  106. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  107. <result column="sub_target_id" jdbcType="BIGINT" property="subTargetId" />
  108. </resultMap>
  109. </mapper>