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.
 
 
 
 
 

176 lines
6.8 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.WxCampaignMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCampaign">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
  8. <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/>
  9. <result column="title" jdbcType="VARCHAR" property="title"/>
  10. <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/>
  11. <result column="use_price" jdbcType="INTEGER" property="usePrice"/>
  12. <result column="discount_price" jdbcType="INTEGER" property="discountPrice"/>
  13. <result column="detail" jdbcType="VARCHAR" property="detail"/>
  14. <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/>
  15. <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/>
  16. <result column="img_detail" jdbcType="VARCHAR" property="imgDetail"/>
  17. <result column="type" jdbcType="INTEGER" property="type"/>
  18. <result column="coupon_ids" jdbcType="VARCHAR" property="couponIds"/>
  19. <result column="mechant_id" jdbcType="BIGINT" property="mechantId"/>
  20. <result column="sort_num" jdbcType="INTEGER" property="sortNum"/>
  21. <result column="status" jdbcType="INTEGER" property="status"/>
  22. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  23. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  24. <result column="html" jdbcType="VARCHAR" property="html"/>
  25. <result column="person_limit" jdbcType="INTEGER" property="personLimit"/>
  26. <result column="activity_start_time" jdbcType="TIMESTAMP" property="activityStartTime"/>
  27. <result column="activity_end_time" jdbcType="TIMESTAMP" property="activityEndTime"/>
  28. <result column="use_credit" jdbcType="INTEGER" property="useCredit"/>
  29. <result column="credit" jdbcType="INTEGER" property="credit"/>
  30. <result column="question" jdbcType="VARCHAR" property="question"/>
  31. <result column="is_expired" jdbcType="INTEGER" property="isExpired"/>
  32. <result column="activity_type" jdbcType="INTEGER" property="activityType"/>
  33. </resultMap>
  34. <sql id="allColumns">
  35. `id`,`tenant_id`,`cover_img`,`cover_picture`,`detail_picture`,`title`,`sub_title`,`use_price`,`discount_price`,`detail`,`valid_start_date`,`valid_end_date`,`img_detail`,`type`,`coupon_ids`,
  36. `mechant_id`,`sort_num`,`status`,`create_time`,`update_time`,`html`,
  37. `person_limit`,`activity_start_time`,`activity_end_time`,`use_credit`,`credit`,`question`,`is_expired`,`activity_type`
  38. </sql>
  39. <sql id="allCHeadColumns">
  40. `id`,`tenant_id`,`cover_img`,`cover_picture`,`detail_picture`,`title`,`type`,`sort_num`
  41. </sql>
  42. <sql id="allAHeadColumns">
  43. `id`,`tenant_id`,`cover_img`,`cover_picture`,`detail_picture`,`title`,`sub_title`,`use_price`,`discount_price`,`detail`,`valid_start_date`,`valid_end_date`,`img_detail`,`type`,`coupon_ids`,
  44. `mechant_id`,`sort_num`,`status`,`create_time`,`update_time`
  45. </sql>
  46. <sql id="dynamicWhereConditions">
  47. where 1 = 1
  48. <if test=" null != id ">
  49. and `id` = #{id}
  50. </if>
  51. <if test=" null != tenantId ">
  52. and `tenant_id` = #{tenantId}
  53. </if>
  54. <if test=" null != coverImg ">
  55. and `cover_img` like concat('%', #{coverImg},'%')
  56. </if>
  57. <if test=" null != title ">
  58. and `title` like concat('%', #{title},'%')
  59. </if>
  60. <if test=" null != subTitle ">
  61. and `sub_title` like concat('%', #{subTitle},'%')
  62. </if>
  63. <if test=" null != usePrice ">
  64. and `use_price` = #{usePrice}
  65. </if>
  66. <if test=" null != discountPrice ">
  67. and `discount_price` = #{discountPrice}
  68. </if>
  69. <if test=" null != detail ">
  70. and `detail` like concat('%', #{detail},'%')
  71. </if>
  72. <if test=" null != validStartDate ">
  73. and `valid_start_date` = #{validStartDate}
  74. </if>
  75. <if test=" null != validEndDate ">
  76. and `valid_end_date` = #{validEndDate}
  77. </if>
  78. <if test=" null != imgDetail ">
  79. and `img_detail` like concat('%', #{imgDetail},'%')
  80. </if>
  81. <if test=" null != type ">
  82. and `type` = #{type}
  83. </if>
  84. <if test=" null != couponIds ">
  85. and `coupon_ids` like concat('%', #{couponIds},'%')
  86. </if>
  87. <if test=" null != mechantId ">
  88. and `mechant_id` = #{mechantId}
  89. </if>
  90. <if test=" null != sortNum ">
  91. and `sort_num` = #{sortNum}
  92. </if>
  93. <if test=" null != status ">
  94. and `status` = #{status}
  95. </if>
  96. <if test=" null != createTime ">
  97. and `create_time` = #{createTime}
  98. </if>
  99. <if test=" null != updateTime ">
  100. and `update_time` = #{updateTime}
  101. </if>
  102. <if test=" null != useCredit ">
  103. and `use_credit` = #{useCredit}
  104. </if>
  105. <if test=" null != isExpired ">
  106. and `is_expired` = #{isExpired}
  107. </if>
  108. <if test=" null != activityType ">
  109. and `activity_type` = #{activityType}
  110. </if>
  111. <if test=" null != starttime and null!=endtime ">
  112. and `create_time` between #{starttime} and #{endtime}
  113. </if>
  114. <if test=" null != ids ">
  115. and id in
  116. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  117. #{idItem}
  118. </foreach>
  119. </if>
  120. <if test=" null != sortColumns">order by ${sortColumns}</if>
  121. </sql>
  122. <select id="findList" parameterType="com.iformall.domain.po.WxCampaign" resultMap="BaseResultMap">
  123. select
  124. <include refid="allAHeadColumns"/>
  125. from wx_campaign
  126. <include refid="dynamicWhereConditions"/>
  127. </select>
  128. <select id="findCList" parameterType="com.iformall.domain.po.WxCampaign" resultMap="BaseResultMap">
  129. select
  130. <include refid="allCHeadColumns"/>
  131. from wx_campaign
  132. <include refid="dynamicWhereConditions"/>
  133. </select>
  134. <select id="getMaxSortNum" parameterType="java.lang.String" resultType="java.lang.Integer">
  135. select max(sort_num) from wx_campaign where `tenant_id` = #{tenantId}
  136. </select>
  137. <select id="queryNotify" parameterType="com.iformall.domain.po.WxCampaign"
  138. resultType="com.iformall.domain.po.WxCampaign">
  139. select id,title,activity_start_time,tenant_id from wx_campaign where status=${status} and DATEDIFF(activity_start_time,now())=3
  140. </select>
  141. </mapper>