Commit 6b7f3f933da530083957f8603893410b198bb1a2

Authored by liquanyu
1 parent 117e1ca99a

优惠劵统计

Showing 1 changed file with 5 additions and 5 deletions

platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml View file @ 6b7f3f9
... ... @@ -344,7 +344,7 @@
344 344  
345 345 <select id="findUsedUserIds2" parameterType="map" resultType="string">
346 346 select distinct(b.user_id)
347   - from organization a, coupon_info b, coupon_template c, coupon_type d
  347 + from organization a, (select * from coupon_info where used_hospital_id = #{hid}) b, coupon_template c, coupon_type d
348 348 where a.id = b.used_hospital_id and b.coupon_template_id = c.id and c.type_id = d.id
349 349 and a.id = #{hid}
350 350 and b.status = 2
... ... @@ -380,7 +380,7 @@
380 380  
381 381 <select id="findHospitalUsedInfo2" parameterType="map" resultType="map">
382 382 select a.id, count(distinct(b.user_id)) as user_used_count, count(1) as coupon_used_count, a.area_id, a.city_id, a.province_id
383   - from organization a, coupon_info b, coupon_template c, coupon_type d
  383 + from organization a, (select * from coupon_info where used_hospital_id = #{hid}) b, coupon_template c, coupon_type d
384 384 where a.id = b.used_hospital_id and b.coupon_template_id = c.id and c.type_id = d.id
385 385 and a.id = #{hid}
386 386 and b.status = 2
... ... @@ -415,7 +415,7 @@
415 415  
416 416 <select id="findSendUserIds2" parameterType="map" resultType="string">
417 417 select distinct(b.user_id)
418   - from organization a, coupon_info b, coupon_template c, coupon_type d
  418 + from organization a, (select * from coupon_info where create_hospital_id = #{hid}) b, coupon_template c, coupon_type d
419 419 where a.id = b.create_hospital_id and b.coupon_template_id = c.id and c.type_id = d.id
420 420 and a.id = #{hid}
421 421 and d.type in
... ... @@ -432,7 +432,7 @@
432 432  
433 433 <select id="findHospitalSendInfo" parameterType="map" resultType="map">
434 434 select a.id, count(distinct(b.user_id)) as people_send_count, count(1) as coupon_send_count, a.area_id, a.city_id, a.province_id
435   - from organization a, coupon_info b, coupon_template c, coupon_type d
  435 + from organization a, (select * from coupon_info where create_hospital_id = #{hid}) b, coupon_template c, coupon_type d
436 436 where a.id = b.create_hospital_id and b.coupon_template_id = c.id and c.type_id = d.id
437 437 and a.id = #{hid}
438 438 and d.type in
... ... @@ -449,7 +449,7 @@
449 449  
450 450 <select id="findHospitalSendInfo2" parameterType="map" resultType="map">
451 451 select a.id, count(distinct(b.user_id)) as people_send_count, count(1) as coupon_send_count, a.area_id, a.city_id, a.province_id
452   - from organization a, coupon_info b, coupon_template c, coupon_type d
  452 + from organization a, (select * from coupon_info where create_hospital_id = #{hid}) b, coupon_template c, coupon_type d
453 453 where a.id = b.create_hospital_id and b.coupon_template_id = c.id and c.type_id = d.id
454 454 and a.id = #{hid}
455 455 and d.type in