Commit 916d0470ce189a31325348759b9435103fe242ed

Authored by litao
1 parent c45aecdd33

优惠券报表详情

Showing 3 changed files with 37 additions and 1 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java View file @ 916d047
... ... @@ -62,5 +62,7 @@
62 62 String findPhone(String s);
63 63  
64 64 List<Map<String,Object>> findCouponInfo(Map<String, Object> param);
  65 +
  66 + int findCouponInfoCount(Map<String, Object> param);
65 67 }
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml View file @ 916d047
... ... @@ -250,5 +250,35 @@
250 250 </if>
251 251 limit #{currentPage},#{pageSize}
252 252 </select>
  253 +
  254 + <select id="findCouponInfoCount" parameterType="map" resultType="integer">
  255 + select count(1) from (
  256 + select c.type, a.sequence_id, d.name
  257 + from coupon_info a, coupon_template b, coupon_type c, users d, organization e, hospital_coupon_template_group f
  258 + where a.coupon_template_id = b.id and b.type_id = c.id and a.user_id = d.id and a.status=2 and a.create_hospital_id = e.id
  259 + and a.used_hospital_id = #{hospitalId} and f.hospital_id = a.used_hospital_id and c.type in
  260 + <foreach collection="couponType" open="(" close=")" separator="," item="type">
  261 + #{type}
  262 + </foreach>
  263 + <if test="startDate != null">
  264 + and a.create_date >= #{startDate}
  265 + </if>
  266 + <if test="endDate != null">
  267 + and a.create_date <![CDATA[ <= ]]> #{endDate}
  268 + </if>
  269 + <if test="provinceId != null and provinceId != ''">
  270 + and e.province_id = #{provinceId}
  271 + </if>
  272 + <if test="cityId != null and cityId != '' ">
  273 + and e.city_id = #{cityId}
  274 + </if>
  275 + <if test="areaId != null and areaId != ''">
  276 + and e.area_id = #{areaId}
  277 + </if>
  278 + <if test="tempId != null and tempId != ''">
  279 + and f.coupon_template_group_id = #{tempId}
  280 + </if>
  281 + ) a
  282 + </select>
253 283 </mapper>
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ 916d047
... ... @@ -486,12 +486,16 @@
486 486 @Override
487 487 public BaseObjectResponse couponInfo(Map<String, Object> param) {
488 488 PageUtil.setPageInfo(param);
  489 +
489 490 Map<String, Object> hospitalName = couponMapper.findHospitalName(param);
490 491 List<Map<String, Object>> couponInfos = couponMapper.findCouponInfo(param);
491 492 for (Map<String, Object> couponInfo : couponInfos) {
492 493 setAntexInfo(couponInfo);
493 494 }
494   - return RespBuilder.buildSuccess("hospitalInfo", hospitalName, "couponInfo", couponInfos);
  495 + hospitalName.put("couponInfos", couponInfos);
  496 + int count = couponMapper.findCouponInfoCount(param);
  497 + PageResult pageResult = new PageResult(count, (Integer) param.get("currentPage") ,(Integer) param.get("pageSize"), hospitalName);
  498 + return RespBuilder.buildSuccess(pageResult);
495 499 }
496 500  
497 501 private void setAntexInfo(Map<String, Object> map) {