|
@@ -60,8 +60,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
select
|
|
|
school,
|
|
|
school_name,
|
|
|
- sum(school_commission) as school_commission,
|
|
|
- sum(total) as orderTotal
|
|
|
+ IFNULL(sum(school_commission),0) as school_commission,
|
|
|
+ IFNULL(sum(total),0) as order_total,
|
|
|
+ COUNT(DISTINCT logincode) as people_count,
|
|
|
+ COUNT(id) as order_count,
|
|
|
+ IFNULL(COUNT(DISTINCT logincode),0)*49*100 as activation_commission,
|
|
|
+ (IFNULL(COUNT(DISTINCT logincode),0)*49*100-sum(school_commission)) as subsidy_bak,
|
|
|
+ (case
|
|
|
+ when (IFNULL(COUNT(DISTINCT logincode),0)*49*100-sum(school_commission)) <![CDATA[ <= ]]> 0 then 0
|
|
|
+ when (IFNULL(COUNT(DISTINCT logincode),0)*49*100-sum(school_commission)) <![CDATA[ > ]]> 0 then (IFNULL(COUNT(DISTINCT logincode),0)*49*100-sum(school_commission))
|
|
|
+ else 0 end) as subsidy
|
|
|
from order_info
|
|
|
<where>
|
|
|
<if test="isShare != null">
|
|
@@ -91,8 +99,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
select
|
|
|
school,
|
|
|
school_name,
|
|
|
- sum(school_commission)/100 as school_commission,
|
|
|
- sum(total)/100 as orderTotal
|
|
|
+ IFNULL(sum(school_commission)/100,0) as school_commission,
|
|
|
+ IFNULL(sum(total)/100,0) as order_total,
|
|
|
+ COUNT(DISTINCT logincode) as people_count,
|
|
|
+ COUNT(id) as order_count,
|
|
|
+ IFNULL(COUNT(DISTINCT logincode),0)*49 as activation_commission,
|
|
|
+ (IFNULL(COUNT(DISTINCT logincode),0)*49-sum(school_commission/100)) as subsidy_bak,
|
|
|
+ (case
|
|
|
+ when (IFNULL(COUNT(DISTINCT logincode),0)*49-sum(school_commission)/100) <![CDATA[ <= ]]> 0 then 0
|
|
|
+ when (IFNULL(COUNT(DISTINCT logincode),0)*49-sum(school_commission)/100) <![CDATA[ > ]]> 0 then (IFNULL(COUNT(DISTINCT logincode),0)*49-sum(school_commission)/100)
|
|
|
+ else 0 end) as subsidy
|
|
|
from order_info
|
|
|
<where>
|
|
|
<if test="isShare != null">
|
|
@@ -196,6 +212,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
order by success_time desc
|
|
|
</select>
|
|
|
|
|
|
+
|
|
|
+ <select id="selectSchoolOrderDetailedExcel" resultType="com.miaxis.order.vo.QuerySchoolOrderDetailedVo">
|
|
|
+ select
|
|
|
+ school_name,
|
|
|
+ goods_name,user_name,logincode,out_trade_no,
|
|
|
+ case when trade_type = 1 then '支付成功'
|
|
|
+ when trade_type = 2 then '支付失败'
|
|
|
+ when trade_type = 3 then '已退款' else '未知' end as trade_type,
|
|
|
+ case when phone_type = 1 then '苹果' else '安卓' end as phone_type,
|
|
|
+ IFNULL(total/100,0) as total,IFNULL(school_commission/100,0) as school_commission,
|
|
|
+ success_time,
|
|
|
+ case when is_share = 1 then '是' else '否' end as is_share
|
|
|
+ from order_info
|
|
|
+ <where>
|
|
|
+ <if test="isShare != null">
|
|
|
+ and is_share = #{isShare }
|
|
|
+ </if>
|
|
|
+ <if test="tradeType != null">
|
|
|
+ and trade_type = #{tradeType }
|
|
|
+ </if>
|
|
|
+ <if test="schoolName != null and schoolName != ''">
|
|
|
+ and school_name like concat('%', #{schoolName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null">
|
|
|
+ and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S')<![CDATA[ >= ]]> #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null">
|
|
|
+ and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by success_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
<select id="getByOutTradeNo" parameterType="string" resultType="com.miaxis.order.domain.OrderInfo">
|
|
|
select * from order_info where out_trade_no =#{outTradeNo}
|
|
|
</select>
|