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

568 rivejä
20 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.WxCouponChannelMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCouponChannel">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  8. <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
  9. <result column="make_merchant_id" jdbcType="BIGINT" property="makeMerchantId" />
  10. <result column="type" jdbcType="INTEGER" property="type" />
  11. <result column="title" jdbcType="VARCHAR" property="title" />
  12. <result column="target_ad" jdbcType="INTEGER" property="targetAd" />
  13. <result column="business" jdbcType="INTEGER" property="business" />
  14. <result column="sub_business" jdbcType="INTEGER" property="subBusiness" />
  15. <result column="show_begin_time" jdbcType="TIMESTAMP" property="showBeginTime" />
  16. <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime" />
  17. <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
  18. <result column="status" jdbcType="INTEGER" property="status" />
  19. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  20. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  21. <result column="sub_target_id" jdbcType="BIGINT" property="subTargetId" />
  22. <result column="qr_code" jdbcType="VARCHAR" property="qrCode"/>
  23. <result column="tt_qr_code" jdbcType="VARCHAR" property="ttQrCode"/>
  24. <result column="tt_spu_id" jdbcType="VARCHAR" property="ttSpuId"/>
  25. <result column="channel_price" jdbcType="INTEGER" property="channelPrice"/>
  26. <result column="channel_stock" jdbcType="INTEGER" property="channelStock"/>
  27. </resultMap>
  28. <sql id="allColumns">
  29. distinct cc.`id`,cc.`tenant_id`,cc.`parent_tenant_id`,cc.`coupon_id`,cc.`make_merchant_id`,cc.`coupon_status`,cc.`type`,cc.`title`,cc.`target_ad`,cc.`business`,cc.`sub_business`,cc.`show_begin_time`,cc.`begin_time`,cc.`end_time`,cc.`status`,cc.`create_date`,cc.`update_date`,cc.`sub_target_id`,cc.`qr_code`,
  30. cc.`tt_qr_code`,cc.`tt_spu_id`,cc.`channel_price`,cc.`channel_stock`
  31. </sql>
  32. <sql id="dynamicWhereConditions">
  33. where 1=1
  34. <if test="null != couponStatus">
  35. and c.status = #{couponStatus}
  36. </if>
  37. <if test="null != status ">
  38. and cc.status = #{status}
  39. </if>
  40. <if test="null == status ">
  41. and cc.status = 0
  42. </if>
  43. <if test=" null != id ">
  44. and cc.`id` = #{id}
  45. </if>
  46. <if test=" null != tenantId and '' != tenantId">
  47. and cc.`tenant_id` = #{tenantId}
  48. </if>
  49. <if test=" null != parentTenantId and '' != parentTenantId">
  50. and cc.`parent_tenant_id` = #{parentTenantId}
  51. </if>
  52. <if test=" null != couponId ">
  53. and cc.`coupon_id` = #{couponId}
  54. </if>
  55. <if test=" null != type ">
  56. and cc.`type` = #{type}
  57. </if>
  58. <if test=" null != title and ''!= title">
  59. and cc.`title` like concat('%', #{title},'%')
  60. </if>
  61. <if test=" null != targetAd ">
  62. and cc.`target_ad` = #{targetAd}
  63. </if>
  64. <if test=" null != business ">
  65. and cc.`business` = #{business}
  66. </if>
  67. <if test=" null != subBusiness ">
  68. and cc.`sub_business` = #{subBusiness}
  69. </if>
  70. <if test=" null != showBeginTime ">
  71. and cc.`show_begin_time` &lt;= #{showBeginTime}
  72. </if>
  73. <if test=" null != startdate and null!=enddate">
  74. and cc.`create_date` between #{startdate} and #{enddate}
  75. </if>
  76. <if test=" null != status ">
  77. and cc.`status` = #{status}
  78. </if>
  79. <if test=" null != createDate ">
  80. and cc.`create_date` = #{createDate}
  81. </if>
  82. <if test=" null != updateDate ">
  83. and cc.`update_date` = #{updateDate}
  84. </if>
  85. <if test=" null != subTargetId ">
  86. and cc.`sub_target_id` = #{subTargetId}
  87. </if>
  88. <if test=" null != ttSpuId and ''!= ttSpuId">
  89. and cc.`tt_spu_id` = #{ttSpuId}
  90. </if>
  91. <if test=" null != supportTransfer ">
  92. and c.`support_transfer` = #{supportTransfer}
  93. </if>
  94. <if test=" null != userCredit ">
  95. and c.`credit_price` &lt;= #{userCredit}
  96. </if>
  97. <if test=" null != sourceType ">
  98. and c.`source_type` = #{sourceType}
  99. </if>
  100. <if test=" null != merchantId ">
  101. and cm.`merchant_id` = #{merchantId}
  102. </if>
  103. <if test=" null != ids ">
  104. and cc.id in
  105. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  106. #{idItem}
  107. </foreach>
  108. </if>
  109. <if test=" null != couponIds ">
  110. and cc.coupon_id in
  111. <foreach collection="couponIds" index="index" item="couponIdsItem" open="(" separator="," close=")">
  112. #{couponIdsItem}
  113. </foreach>
  114. </if>
  115. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  116. </sql>
  117. <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  118. select <include refid="allColumns" /> from wx_coupon_channel cc where id = #{id} and tenant_id = #{tenantId}
  119. </select>
  120. <select id="findList" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="BaseResultMap">
  121. select <include refid="allColumns" /> from wx_coupon_channel cc
  122. <include refid="dynamicWhereConditions" />
  123. </select>
  124. <select id="findCouponIdList" parameterType="com.iformall.domain.po.WxCouponChannel" resultType="Long">
  125. select distinct coupon_id from wx_coupon_channel cc
  126. <include refid="dynamicWhereConditions" />
  127. </select>
  128. <update id="updateStatusByCouponId" parameterType="com.iformall.domain.po.WxCouponChannel">
  129. update wx_coupon_channel
  130. set status=#{status}, update_date=#{updateDate}
  131. where coupon_id=#{couponId}
  132. <if test=" null != tenantId and '' != tenantId">
  133. and `tenant_id` = #{tenantId}
  134. </if>
  135. <if test=" null != parentTenantId and '' != parentTenantId">
  136. and `parent_tenant_id` = #{parentTenantId}
  137. </if>
  138. </update>
  139. <update id="updateEndTimeByCouponId" parameterType="com.iformall.domain.po.WxCouponChannel">
  140. update wx_coupon_channel
  141. set end_time = #{endTime}
  142. where coupon_id=#{couponId}
  143. <if test=" null != tenantId and '' != tenantId">
  144. and `tenant_id` = #{tenantId}
  145. </if>
  146. <if test=" null != parentTenantId and '' != parentTenantId">
  147. and `parent_tenant_id` = #{parentTenantId}
  148. </if>
  149. </update>
  150. <select id="findVoDetail" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  151. select
  152. cc.id,cc.coupon_id,cc.make_merchant_id,cc.target_ad,cc.begin_time,cc.end_time,cc.tenant_id,cc.parent_tenant_id,cc.qr_code,cc.tt_qr_code,
  153. cc.channel_price,cc.channel_stock
  154. from wx_coupon_channel cc where cc.id = #{id} and cc.tenant_id = #{tenantId}
  155. </select>
  156. <select id="findVoStatusDetail" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  157. select cc.id,cc.coupon_id
  158. from wx_coupon_channel cc
  159. where cc.id = #{id} and cc.tenant_id = #{tenantId}
  160. </select>
  161. <select id="countCoupon" parameterType="com.iformall.domain.po.WxCouponChannel" resultType="java.lang.Integer">
  162. select count(distinct coupon_id) from wx_coupon_channel cc
  163. <include refid="dynamicWhereConditions" />
  164. </select>
  165. <select id="countCouponChannel" parameterType="com.iformall.domain.po.WxCouponChannel" resultType="java.lang.Integer">
  166. select count(1) from wx_coupon_channel cc
  167. <include refid="dynamicWhereConditions" />
  168. </select>
  169. <select id="getExpiriedCouponIdsByEndTime" resultType="Long">
  170. select distinct coupon_id from wx_coupon_channel
  171. where status in (0,-1) and tenant_id = #{tenantId} and end_time &lt; now()
  172. </select>
  173. <update id="offExpiriedCouponChannelByEndTime">
  174. update wx_coupon_channel SET status = 1, update_date = now()
  175. where status in (0,-1) and tenant_id = #{tenantId} and end_time &lt; now()
  176. </update>
  177. <select id="getExpiriedCouponIdsByValidDate" resultType="Long">
  178. select distinct cc.coupon_id from wx_coupon_channel cc, wx_coupon c
  179. where cc.coupon_id = c.id and c.valid_type = 1 and c.valid_end_date &lt; now()
  180. and cc.status in (0,-1) and cc.tenant_id = #{tenantId}
  181. </select>
  182. <update id="offExpiriedCouponChannelByValidDate">
  183. update wx_coupon_channel cc, wx_coupon c SET cc.status = 1, cc.update_date = now()
  184. where cc.coupon_id = c.id and c.valid_type = 1 and c.valid_end_date &lt; now()
  185. and cc.status in (0,-1) and cc.tenant_id = #{tenantId}
  186. </update>
  187. <select id="getExpiriedCouponIdsByCouponStatus" resultType="Long">
  188. select distinct cc.coupon_id from wx_coupon_channel cc, wx_coupon c
  189. where cc.coupon_id = c.id and c.status = 1
  190. and cc.status in (0,-1) and cc.tenant_id = #{tenantId}
  191. </select>
  192. <update id="offExpiriedCouponChannelByCouponStatus">
  193. update wx_coupon_channel cc, wx_coupon c SET cc.status = 1, cc.update_date = now()
  194. where cc.coupon_id = c.id and c.status = 1
  195. and cc.status in (0,-1) and cc.tenant_id = #{tenantId}
  196. </update>
  197. <update id="offExpiriedCouponChannel2ByEndTime">
  198. update wx_coupon_channel SET status = 1, update_date = now()
  199. where status = 0 and tenant_id = #{tenantId} and target_ad = 2 and end_time &lt; now()
  200. </update>
  201. <delete id="delByTopic" parameterType="com.iformall.domain.po.WxTopic">
  202. update wx_coupon_channel set status = 1 where sub_target_id = #{id}
  203. </delete>
  204. <select id="findQrcodeEmptyList" resultType="com.iformall.domain.po.WxCouponChannel">
  205. select * from wx_coupon_channel where (qr_code is null or tt_qr_code is null)
  206. </select>
  207. <update id="cardDefer">
  208. update wx_coupon_channel set end_time = #{endTime} where coupon_id = #{couponId} and tenant_id = #{tenantId} and target_ad = 5 and type = 100
  209. </update>
  210. <select id="newfindCList" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="BaseResultMap">
  211. select cc.`id`,cc.`tenant_id`,cc.`parent_tenant_id`,cc.`coupon_id`,cc.`coupon_status`,cc.`type`,cc.`title`,
  212. cc.`target_ad`,cc.`business`,cc.`sub_business`,cc.`show_begin_time`,cc.`begin_time`,cc.`end_time`,cc.`status`,
  213. cc.`create_date`,cc.`update_date`,cc.`sub_target_id`,cc.qr_code,cc.tt_spu_id,cc.channel_price,cc.channel_stock
  214. from wx_coupon_channel cc
  215. where cc.`tenant_id` = #{tenantId}
  216. <if test=" null != id ">
  217. and cc.`id` = #{id}
  218. </if>
  219. <if test=" null != parentTenantId and '' != parentTenantId">
  220. and cc.`parent_tenant_id` = #{parentTenantId}
  221. </if>
  222. <if test=" null != couponId ">
  223. and cc.`coupon_id` = #{couponId}
  224. </if>
  225. <if test=" null != type ">
  226. and cc.`type` = #{type}
  227. </if>
  228. <if test=" null != title and ''!= title">
  229. and cc.`title` like concat('%', #{title},'%')
  230. </if>
  231. <if test=" null != targetAd ">
  232. and cc.`target_ad` = #{targetAd}
  233. </if>
  234. <if test=" null != business ">
  235. and cc.`business` = #{business}
  236. </if>
  237. <if test=" null != subBusiness ">
  238. and cc.`sub_business` = #{subBusiness}
  239. </if>
  240. <if test=" null != showBeginTime ">
  241. and cc.`show_begin_time` &lt;= #{showBeginTime}
  242. </if>
  243. <if test=" null != startdate and null!=enddate">
  244. and cc.`create_date` between #{startdate} and #{enddate}
  245. </if>
  246. <if test=" null != status ">
  247. and cc.`status` = #{status}
  248. </if>
  249. <if test=" null != createDate ">
  250. and cc.`create_date` = #{createDate}
  251. </if>
  252. <if test=" null != updateDate ">
  253. and cc.`update_date` = #{updateDate}
  254. </if>
  255. <if test=" null != subTargetId ">
  256. and cc.`sub_target_id` = #{subTargetId}
  257. </if>
  258. <if test=" null != ids ">
  259. and cc.id in
  260. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  261. #{idItem}
  262. </foreach>
  263. </if>
  264. <if test=" null != couponIds ">
  265. and cc.coupon_id in
  266. <foreach collection="couponIds" index="index" item="couponIdsItem" open="(" separator="," close=")">
  267. #{couponIdsItem}
  268. </foreach>
  269. </if>
  270. <if test=" null != targetAds ">
  271. and cc.target_ad in
  272. <foreach collection="targetAds" index="index" item="targetAdsItem" open="(" separator="," close=")">
  273. #{targetAdsItem}
  274. </foreach>
  275. </if>
  276. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  277. </select>
  278. <select id="liveHomeList" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="BaseResultMap">
  279. select cc.`id`,cc.`coupon_id`
  280. from wx_coupon_channel cc
  281. where cc.`tenant_id` = #{tenantId} and cc.`target_ad` = #{targetAd}
  282. <if test=" null != parentTenantId and '' != parentTenantId">
  283. and cc.`parent_tenant_id` = #{parentTenantId}
  284. </if>
  285. <if test=" null != business ">
  286. and cc.`business` = #{business}
  287. </if>
  288. <if test=" null != subBusiness ">
  289. and cc.`sub_business` = #{subBusiness}
  290. </if>
  291. <if test=" null != showBeginTime ">
  292. and cc.`show_begin_time` &lt;= #{showBeginTime}
  293. </if>
  294. <if test=" null != status ">
  295. and cc.`status` = #{status}
  296. </if>
  297. <if test=" null != subTargetId ">
  298. and cc.`sub_target_id` = #{subTargetId}
  299. </if>
  300. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  301. </select>
  302. <update id="reduceChannelStock">
  303. update wx_coupon_channel SET channel_stock = channel_stock - #{number} where id = #{id} and tenant_id =#{tenantId} and channel_stock is not null and channel_stock - #{number} &gt;= 0
  304. </update>
  305. <update id="backChannelStock">
  306. update wx_coupon_channel SET channel_stock = channel_stock + #{number} where id = #{id} and tenant_id =#{tenantId} and channel_stock is not null
  307. </update>
  308. <update id="setChannelStock">
  309. update wx_coupon_channel SET channel_stock = #{number} where id = #{id} and tenant_id =#{tenantId} and (channel_stock is null or channel_stock = 0)
  310. </update>
  311. <update id="clearChannelStock">
  312. update wx_coupon_channel SET channel_stock = null where id = #{id} and tenant_id =#{tenantId}
  313. </update>
  314. <update id="setChannelPrice">
  315. update wx_coupon_channel SET channel_price = #{price} where id = #{id} and tenant_id =#{tenantId}
  316. </update>
  317. <select id="getPriceAndStock" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  318. select id,coupon_id,channel_stock,channel_price from wx_coupon_channel where `id` = #{id} and `tenant_id` = #{tenantId}
  319. </select>
  320. <select id="batGetPriceAndStock" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  321. select id,coupon_id,channel_stock,channel_price from wx_coupon_channel where `tenant_id` = #{tenantId}
  322. and id in
  323. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  324. #{idItem}
  325. </foreach>
  326. </select>
  327. <resultMap id="ttChannelResultMap" type="com.iformall.domain.vo.TtCouponChannelVo">
  328. <id column="id" jdbcType="BIGINT" property="id" />
  329. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  330. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  331. <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
  332. <result column="type" jdbcType="INTEGER" property="type" />
  333. <result column="title" jdbcType="VARCHAR" property="title" />
  334. <result column="target_ad" jdbcType="INTEGER" property="targetAd" />
  335. <result column="business" jdbcType="INTEGER" property="business" />
  336. <result column="sub_business" jdbcType="INTEGER" property="subBusiness" />
  337. <result column="show_begin_time" jdbcType="TIMESTAMP" property="showBeginTime" />
  338. <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime" />
  339. <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
  340. <result column="status" jdbcType="INTEGER" property="status" />
  341. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  342. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  343. <result column="sub_target_id" jdbcType="BIGINT" property="subTargetId" />
  344. <result column="qr_code" jdbcType="VARCHAR" property="qrCode"/>
  345. <result column="tt_qr_code" jdbcType="VARCHAR" property="ttQrCode"/>
  346. <result column="tt_spu_id" jdbcType="VARCHAR" property="ttSpuId"/>
  347. <result column="channel_price" jdbcType="INTEGER" property="channelPrice"/>
  348. <result column="channel_stock" jdbcType="INTEGER" property="channelStock"/>
  349. <result column="spu_id" jdbcType="VARCHAR" property="spuId"/>
  350. <result column="poi_status" jdbcType="INTEGER" property="poiStatus"/>
  351. <result column="status_desc" jdbcType="VARCHAR" property="statusDesc"/>
  352. <result column="last_status" jdbcType="INTEGER" property="lastStatus"/>
  353. <result column="last_status_desc" jdbcType="VARCHAR" property="lastStatusDesc"/>
  354. </resultMap>
  355. <select id="ttChannelList" parameterType="com.iformall.domain.vo.TtCouponChannelVo" resultMap="ttChannelResultMap">
  356. select cc.`id`,cc.`tenant_id`,cc.`parent_tenant_id`,cc.`coupon_id`,cc.`coupon_status`,cc.`type`,cc.`title`,
  357. cc.`target_ad`,cc.`business`,cc.`sub_business`,cc.`show_begin_time`,cc.`begin_time`,cc.`end_time`,cc.`status`,
  358. cc.`create_date`,cc.`update_date`,cc.`sub_target_id`,cc.qr_code,cc.tt_spu_id,cc.channel_price,cc.channel_stock,
  359. poi.coupon_channel_id,poi.spu_id,poi.status poi_status,poi.status_desc,poi.last_status,poi.last_status_desc
  360. from wx_coupon_channel cc
  361. left join tt_coupon_channel_poi poi on poi.coupon_channel_id = cc.id and poi.id = cc.`coupon_id`
  362. where cc.`tenant_id` = #{tenantId}
  363. <if test=" null != id ">
  364. and cc.`id` = #{id}
  365. </if>
  366. <if test=" null != parentTenantId and '' != parentTenantId">
  367. and cc.`parent_tenant_id` = #{parentTenantId}
  368. </if>
  369. <if test=" null != couponId ">
  370. and cc.`coupon_id` = #{couponId}
  371. </if>
  372. <if test=" null != type ">
  373. and cc.`type` = #{type}
  374. </if>
  375. <if test=" null != title and ''!= title">
  376. and cc.`title` like concat('%', #{title},'%')
  377. </if>
  378. <if test=" null != targetAd ">
  379. and cc.`target_ad` = #{targetAd}
  380. </if>
  381. <if test=" null != business ">
  382. and cc.`business` = #{business}
  383. </if>
  384. <if test=" null != subBusiness ">
  385. and cc.`sub_business` = #{subBusiness}
  386. </if>
  387. <if test=" null != showBeginTime ">
  388. and cc.`show_begin_time` &lt;= #{showBeginTime}
  389. </if>
  390. <if test=" null != startdate and null!=enddate">
  391. and cc.`create_date` between #{startdate} and #{enddate}
  392. </if>
  393. <if test=" null != status ">
  394. and cc.`status` = #{status}
  395. </if>
  396. <if test=" null != createDate ">
  397. and cc.`create_date` = #{createDate}
  398. </if>
  399. <if test=" null != updateDate ">
  400. and cc.`update_date` = #{updateDate}
  401. </if>
  402. <if test=" null != subTargetId ">
  403. and cc.`sub_target_id` = #{subTargetId}
  404. </if>
  405. <if test=" null != spuId and '' != spuId">
  406. and poi.`spu_id` = #{spuId}
  407. </if>
  408. <if test=" null != poiStatus">
  409. and poi.`status` = #{poiStatus}
  410. </if>
  411. <if test=" null != lastStatus">
  412. and poi.`last_status` = #{lastStatus}
  413. </if>
  414. <if test=" null != ids ">
  415. and cc.id in
  416. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  417. #{idItem}
  418. </foreach>
  419. </if>
  420. <if test=" null != couponIds ">
  421. and cc.coupon_id in
  422. <foreach collection="couponIds" index="index" item="couponIdsItem" open="(" separator="," close=")">
  423. #{couponIdsItem}
  424. </foreach>
  425. </if>
  426. <if test=" null != targetAds ">
  427. and cc.target_ad in
  428. <foreach collection="targetAds" index="index" item="targetAdsItem" open="(" separator="," close=")">
  429. #{targetAdsItem}
  430. </foreach>
  431. </if>
  432. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  433. </select>
  434. <select id="findCouponIdById" parameterType="java.util.HashMap" resultType="long">
  435. select coupon_id from wx_coupon_channel
  436. where `tenant_id` = #{tenantId}
  437. and id = #{id}
  438. </select>
  439. <update id="updateStatusByTargetAd" parameterType="com.iformall.domain.po.WxCouponChannel">
  440. update wx_coupon_channel
  441. set status=#{status}, update_date=#{updateDate}
  442. where status != #{status}
  443. and coupon_id = #{couponId}
  444. and target_ad = #{targetAd}
  445. <if test=" null != tenantId and '' != tenantId">
  446. and `tenant_id` = #{tenantId}
  447. </if>
  448. <if test=" null != parentTenantId and '' != parentTenantId">
  449. and `parent_tenant_id` = #{parentTenantId}
  450. </if>
  451. </update>
  452. <select id="selectCountExclude" parameterType="com.iformall.domain.po.WxCouponChannel" resultType="Integer">
  453. select count(1) from wx_coupon_channel
  454. where status = #{status}
  455. and coupon_id = #{couponId}
  456. and id != #{id}
  457. and target_ad != #{targetAd}
  458. <if test=" null != tenantId and '' != tenantId">
  459. and `tenant_id` = #{tenantId}
  460. </if>
  461. <if test=" null != parentTenantId and '' != parentTenantId">
  462. and `parent_tenant_id` = #{parentTenantId}
  463. </if>
  464. </select>
  465. </mapper>