提交代码

new-dev
胡锐 1 year ago
parent d3bb627425
commit c1bb86b341
  1. 13
      hai-service/src/main/java/com/hai/dao/HighDiscountAgentBatchMapperExt.java

@ -25,7 +25,10 @@ public interface HighDiscountAgentBatchMapperExt {
" a.create_time createTime," + " a.create_time createTime," +
" a.mail_time mailTime," + " a.mail_time mailTime," +
" a.batch_num batchNum," + " a.batch_num batchNum," +
" (select count(1) from high_discount_agent_code where discount_agent_batch_id = a.id and `status` in (2,3)) useNum" + " (select count(1) from high_discount_agent_code where discount_agent_batch_id = a.id and `status` in (2,3,4)) receiveNum, " +
" (select count(1) from high_discount_agent_code where discount_agent_batch_id = a.id and `status` in (3)) useNum," +
" (select count(1) from high_coupon_code_other where discount_agent_code_id in " +
" (select id from high_discount_agent_code where discount_agent_batch_id = a.id)) sendNum " +
" from high_discount_agent_batch a where 1 = 1" + " from high_discount_agent_batch a where 1 = 1" +
" <if test='param.usingRange != null'> and a.using_range = #{param.usingRange} </if>" + " <if test='param.usingRange != null'> and a.using_range = #{param.usingRange} </if>" +
" <if test='param.price != null'> and a.discount_price = #{param.price} </if>" + " <if test='param.price != null'> and a.discount_price = #{param.price} </if>" +
@ -38,12 +41,16 @@ public interface HighDiscountAgentBatchMapperExt {
" sum(a.batchNum) batchNum," + " sum(a.batchNum) batchNum," +
" sum(a.useNum) useNum," + " sum(a.useNum) useNum," +
" sum((a.useNum * a.discountPrice)) usePrice," + " sum((a.useNum * a.discountPrice)) usePrice," +
" ROUND(sum(a.useNum) / sum(a.batchNum) * 100, 2) useRate" + " ROUND(sum(a.useNum) / sum(a.batchNum) * 100, 2) useRate," +
" sum(a.sendNum) sendNum," +
" sum((a.sendNum * a.discountPrice)) sendPrice" +
" from (select " + " from (select " +
" a.discount_price discountPrice," + " a.discount_price discountPrice," +
" a.using_range discountUsingRange," + " a.using_range discountUsingRange," +
" a.batch_num batchNum," + " a.batch_num batchNum," +
" (select count(1) from high_discount_agent_code where discount_agent_batch_id = a.id and `status` in (2,3)) useNum" + " (select count(1) from high_discount_agent_code where discount_agent_batch_id = a.id and `status` in (3)) useNum," +
" (select count(1) from high_coupon_code_other where discount_agent_code_id in " +
" (select id from high_discount_agent_code where discount_agent_batch_id = a.id)) sendNum " +
" from high_discount_agent_batch a where 1 = 1" + " from high_discount_agent_batch a where 1 = 1" +
" <if test='param.usingRange != null'> and a.using_range = #{param.usingRange} </if>" + " <if test='param.usingRange != null'> and a.using_range = #{param.usingRange} </if>" +
" <if test='param.price != null'> and a.discount_price = #{param.price} </if>" + " <if test='param.price != null'> and a.discount_price = #{param.price} </if>" +

Loading…
Cancel
Save