|
@@ -59,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
select * from order_info where out_trade_no =#{outTradeNo}
|
|
|
</select>
|
|
|
|
|
|
+ <!--
|
|
|
<select id="selectSchoolOrderInfoList" parameterType="com.miaxis.order.dto.QuerySchoolOrderListDTO" resultType="com.miaxis.order.vo.QuerySchoolOrderListVo">
|
|
|
select
|
|
|
school,
|
|
@@ -100,6 +101,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
group by school,school_name
|
|
|
|
|
|
</select>
|
|
|
+ -->
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectSchoolOrderInfoList" parameterType="com.miaxis.order.dto.QuerySchoolOrderListDTO" resultType="com.miaxis.order.vo.QuerySchoolOrderListVo">
|
|
|
+ SELECT *,
|
|
|
+ CASE
|
|
|
+ WHEN subsidy_bak <![CDATA[ <= ]]> 0 THEN 0
|
|
|
+ WHEN subsidy_bak <![CDATA[ > ]]> 0 THEN subsidy_bak
|
|
|
+ ELSE 0
|
|
|
+ END AS subsidy
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ school,
|
|
|
+ school_name,
|
|
|
+ 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 CASE WHEN dqbh NOT IN ('2108') THEN logincode END), 0) * 49 * 100 AS activation_commission,
|
|
|
+ IFNULL(COUNT(DISTINCT CASE WHEN dqbh NOT IN ('2108') THEN logincode END), 0) * 49 * 100 - SUM(school_commission) AS subsidy_bak
|
|
|
+ from order_info
|
|
|
+ <where>
|
|
|
+ <if test="isShare != null">
|
|
|
+ and is_share = #{isShare }
|
|
|
+ </if>
|
|
|
+ <if test="tradeType != null">
|
|
|
+ and trade_type = #{tradeType }
|
|
|
+ </if>
|
|
|
+ <if test="dqbh != null and dqbh != ''">
|
|
|
+ and dqbh = #{dqbh}
|
|
|
+ </if>
|
|
|
+ <if test="schoolName != null and schoolName != ''">
|
|
|
+ and school_name like concat('%', #{schoolName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
+ and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S')<![CDATA[ >= ]]> #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null and endTime != '' ">
|
|
|
+ and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by school,school_name) as subquery
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
|
|
|
<select id="selectSchoolOrderInfoExcel" resultType="com.miaxis.order.vo.QuerySchoolOrderListVo">
|
|
|
select
|
|
@@ -132,10 +180,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="schoolName != null and schoolName != ''">
|
|
|
and school_name like concat('%', #{schoolName}, '%')
|
|
|
</if>
|
|
|
- <if test="startTime != null">
|
|
|
+ <if test="startTime != null and startTime !='' ">
|
|
|
and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S')<![CDATA[ >= ]]> #{startTime}
|
|
|
</if>
|
|
|
- <if test="endTime != null">
|
|
|
+ <if test="endTime != null and endTime !=''">
|
|
|
and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> #{endTime}
|
|
|
</if>
|
|
|
</where>
|
|
@@ -161,10 +209,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="schoolName != null and schoolName != ''">
|
|
|
and school_name like concat('%', #{schoolName}, '%')
|
|
|
</if>
|
|
|
- <if test="startTime != null">
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S')<![CDATA[ >= ]]> #{startTime}
|
|
|
</if>
|
|
|
- <if test="endTime != null">
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> #{endTime}
|
|
|
</if>
|
|
|
</where>
|
|
@@ -188,10 +236,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="schoolName != null and schoolName != ''">
|
|
|
and school_name like concat('%', #{schoolName}, '%')
|
|
|
</if>
|
|
|
- <if test="startTime != null">
|
|
|
+ <if test="startTime != null and startTime!=''">
|
|
|
and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S')<![CDATA[ >= ]]> #{startTime}
|
|
|
</if>
|
|
|
- <if test="endTime != null">
|
|
|
+ <if test="endTime != null and endTime!=''">
|
|
|
and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> #{endTime}
|
|
|
</if>
|
|
|
</where>
|
|
@@ -211,10 +259,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="schoolName != null and schoolName != ''">
|
|
|
and school_name like concat('%', #{schoolName}, '%')
|
|
|
</if>
|
|
|
- <if test="startTime != null">
|
|
|
+ <if test="startTime != null and startTime!=''">
|
|
|
and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S')<![CDATA[ >= ]]> #{startTime}
|
|
|
</if>
|
|
|
- <if test="endTime != null">
|
|
|
+ <if test="endTime != null and endTime!=''">
|
|
|
and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> #{endTime}
|
|
|
</if>
|
|
|
</where>
|
|
@@ -244,10 +292,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="schoolName != null and schoolName != ''">
|
|
|
and school_name like concat('%', #{schoolName}, '%')
|
|
|
</if>
|
|
|
- <if test="startTime != null">
|
|
|
+ <if test="startTime != null and startTime != '' ">
|
|
|
and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S')<![CDATA[ >= ]]> #{startTime}
|
|
|
</if>
|
|
|
- <if test="endTime != null">
|
|
|
+ <if test="endTime != null and endTime!='' ">
|
|
|
and DATE_FORMAT(success_time,'%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> #{endTime}
|
|
|
</if>
|
|
|
</where>
|