嗨森逛服务
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.
hai-server/hai-service/src/main/java/com/hai/dao/HighCouponMapperExt.java

38 lines
1.8 KiB

4 years ago
package com.hai.dao;
2 years ago
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
2 years ago
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
4 years ago
/**
* mapper扩展类
*/
public interface HighCouponMapperExt {
2 years ago
/**
* 查询月销量
* @param couponId
* @return
*/
@Select({"SELECT count(1) FROM `high_child_order` " +
2 years ago
" where goods_type = 1 and goods_id = #{couponId} and child_order_status in (2,3,6,7) and DATE_FORMAT(pay_time,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m')"})
2 years ago
int getMonthlySales(@Param("couponId") Long couponId);
2 years ago
@Select("<script>" +
" select a.sales_price,sum(notUseCount) notUseCount,sum(a.useCount) useCount from " +
"(select a.sales_price, (select count(1) FROM high_coupon_code_other WHERE cou_type_code = a.coupon_key and `status` = 20 <if test='param.salesTimeS != null'> and create_time BETWEEN #{param.salesTimeS} and #{param.salesTimeE} </if> ) notUseCount, " +
"(select count(1) FROM high_coupon_code_other WHERE cou_type_code = a.coupon_key and `status` = 40 <if test='param.salesTimeS != null'> and create_time BETWEEN #{param.salesTimeS} and #{param.salesTimeE} </if> ) useCount " +
" FROM high_coupon a" +
" WHERE a.coupon_source = #{param.couponSource} GROUP BY coupon_key ORDER BY a.sales_price) a where 1 = 1 " +
" <if test='param.salesPrice != null'> and a.sales_price = #{param.salesPrice} </if>" +
" GROUP BY a.sales_price" +
" </script>")
List<Map<String, Object>> getUseCouponStatistics(@Param("param") Map<String, Object> param);
@Select("select sales_price from high_coupon where coupon_source = #{couponSource} GROUP BY sales_price ORDER BY sales_price")
List<BigDecimal> getCouponSalesPrice(@Param("couponSource") Integer couponSource);
2 years ago
}