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.
 
 
 
 
 

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