|  | @@ -0,0 +1,293 @@
 | 
	
		
			
				|  |  | +<?xml version="1.0" encoding="UTF-8"?>
 | 
	
		
			
				|  |  | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
	
		
			
				|  |  | +<mapper namespace="com.ym.mec.biz.dal.dao.SellOrderDao">
 | 
	
		
			
				|  |  | +    <resultMap id="SellOrder" type="com.ym.mec.biz.dal.entity.SellOrder">
 | 
	
		
			
				|  |  | +        <!--@mbg.generated-->
 | 
	
		
			
				|  |  | +        <!--@Table sell_order-->
 | 
	
		
			
				|  |  | +        <id column="id_" property="id"/>
 | 
	
		
			
				|  |  | +        <result column="organ_id_" property="organId"/>
 | 
	
		
			
				|  |  | +        <result column="cooperation_organ_id_" property="cooperationOrganId"/>
 | 
	
		
			
				|  |  | +        <result column="school_name_" property="schoolName"/>
 | 
	
		
			
				|  |  | +        <result column="trans_no_" property="transNo"/>
 | 
	
		
			
				|  |  | +        <result column="order_no_" property="orderNo"/>
 | 
	
		
			
				|  |  | +        <result column="order_id_" property="orderId"/>
 | 
	
		
			
				|  |  | +        <result column="expect_amount_" property="expectAmount"/>
 | 
	
		
			
				|  |  | +        <result column="actual_amount_" property="actualAmount"/>
 | 
	
		
			
				|  |  | +        <result column="balance_amount_" property="balanceAmount"/>
 | 
	
		
			
				|  |  | +        <result column="type_" property="type"/>
 | 
	
		
			
				|  |  | +        <result column="goods_id_" property="goodsId"/>
 | 
	
		
			
				|  |  | +        <result column="goods_name_" property="goodsName"/>
 | 
	
		
			
				|  |  | +        <result column="sell_cost_" property="sellCost"/>
 | 
	
		
			
				|  |  | +        <result column="sell_cost2_" property="sellCost2"/>
 | 
	
		
			
				|  |  | +        <result column="num_" property="num"/>
 | 
	
		
			
				|  |  | +        <result column="user_id_" property="userId"/>
 | 
	
		
			
				|  |  | +        <result column="user_name_" property="userName"/>
 | 
	
		
			
				|  |  | +        <result column="phone_" property="phone"/>
 | 
	
		
			
				|  |  | +        <result column="organ_name_" property="organName"/>
 | 
	
		
			
				|  |  | +        <result column="user_id_" property="userId"/>
 | 
	
		
			
				|  |  | +        <result column="payment_channel_" property="paymentChannel"/>
 | 
	
		
			
				|  |  | +        <result column="mer_no_" property="merNo"/>
 | 
	
		
			
				|  |  | +        <result column="sell_time_" property="sellTime"/>
 | 
	
		
			
				|  |  | +        <result column="create_ime_" property="createIme"/>
 | 
	
		
			
				|  |  | +        <result column="update_time_" property="updateTime"/>
 | 
	
		
			
				|  |  | +    </resultMap>
 | 
	
		
			
				|  |  | +    <sql id="Base_Column_List">
 | 
	
		
			
				|  |  | +        <!--@mbg.generated-->
 | 
	
		
			
				|  |  | +        id_, organ_id_, cooperation_organ_id_, trans_no_,order_id_, order_no_, expect_amount_, actual_amount_,
 | 
	
		
			
				|  |  | +        balance_amount_, sell_cost_, sell_cost2_, type_, goods_id_,goods_name_, num_, user_id_, payment_channel_,
 | 
	
		
			
				|  |  | +        mer_no_, sell_time_, create_ime_, update_time_
 | 
	
		
			
				|  |  | +    </sql>
 | 
	
		
			
				|  |  | +    <select id="get" parameterType="java.lang.Integer" resultMap="SellOrder">
 | 
	
		
			
				|  |  | +        <!--@mbg.generated-->
 | 
	
		
			
				|  |  | +        select
 | 
	
		
			
				|  |  | +        <include refid="Base_Column_List"/>
 | 
	
		
			
				|  |  | +        from sell_order
 | 
	
		
			
				|  |  | +        where id_ = #{id}
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +    <delete id="delete" parameterType="java.lang.Integer">
 | 
	
		
			
				|  |  | +        <!--@mbg.generated-->
 | 
	
		
			
				|  |  | +        delete from sell_order
 | 
	
		
			
				|  |  | +        where id_ = #{id}
 | 
	
		
			
				|  |  | +    </delete>
 | 
	
		
			
				|  |  | +    <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.SellOrder"
 | 
	
		
			
				|  |  | +            useGeneratedKeys="true">
 | 
	
		
			
				|  |  | +        <!--@mbg.generated-->
 | 
	
		
			
				|  |  | +        insert into sell_order (organ_id_, cooperation_organ_id_, trans_no_,order_id_, order_no_, expect_amount_, actual_amount_,
 | 
	
		
			
				|  |  | +        balance_amount_, type_, goods_id_,goods_name_, sell_cost_, sell_cost2_, num_, user_id_, payment_channel_,
 | 
	
		
			
				|  |  | +        mer_no_, sell_time_, create_ime_, update_time_)
 | 
	
		
			
				|  |  | +        values (#{organId}, #{cooperationOrganId}, #{transNo}, #{orderNo},#{orderId}, #{expectAmount}, #{actualAmount},
 | 
	
		
			
				|  |  | +        #{balanceAmount}, #{type}, #{goodsId}, #{goodsName}, #{sellCost}, #{sellCost2}, #{num}, #{userId},
 | 
	
		
			
				|  |  | +        #{paymentChannel},
 | 
	
		
			
				|  |  | +        #{merNo}, #{sellTime}, #{createIme}, #{updateTime})
 | 
	
		
			
				|  |  | +    </insert>
 | 
	
		
			
				|  |  | +    <update id="update" parameterType="com.ym.mec.biz.dal.entity.SellOrder">
 | 
	
		
			
				|  |  | +        <!--@mbg.generated-->
 | 
	
		
			
				|  |  | +        update sell_order
 | 
	
		
			
				|  |  | +        <set>
 | 
	
		
			
				|  |  | +            <if test="organId != null">
 | 
	
		
			
				|  |  | +                organ_id_ = #{organId},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="cooperationOrganId != null">
 | 
	
		
			
				|  |  | +                cooperation_organ_id_ = #{cooperationOrganId},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="transNo != null">
 | 
	
		
			
				|  |  | +                trans_no_ = #{transNo},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="orderId != null">
 | 
	
		
			
				|  |  | +                order_id_ = #{orderId},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="orderNo != null">
 | 
	
		
			
				|  |  | +                order_no_ = #{orderNo},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="expectAmount != null">
 | 
	
		
			
				|  |  | +                expect_amount_ = #{expectAmount},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="actualAmount != null">
 | 
	
		
			
				|  |  | +                actual_amount_ = #{actualAmount},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="balanceAmount != null">
 | 
	
		
			
				|  |  | +                balance_amount_ = #{balanceAmount},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="type != null">
 | 
	
		
			
				|  |  | +                type_ = #{type},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="goodsId != null">
 | 
	
		
			
				|  |  | +                goods_id_ = #{goodsId},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="goodsName != null">
 | 
	
		
			
				|  |  | +                goods_name_ = #{goodsName},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="sellCost != null">
 | 
	
		
			
				|  |  | +                sell_cost_ = #{sellCost},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="sellCost2 != null">
 | 
	
		
			
				|  |  | +                sell_cost2_ = #{sellCost2},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="num != null">
 | 
	
		
			
				|  |  | +                num_ = #{num},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="userId != null">
 | 
	
		
			
				|  |  | +                user_id_ = #{userId},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="paymentChannel != null">
 | 
	
		
			
				|  |  | +                payment_channel_ = #{paymentChannel},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="merNo != null">
 | 
	
		
			
				|  |  | +                mer_no_ = #{merNo},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="sellTime != null">
 | 
	
		
			
				|  |  | +                sell_time_ = #{sellTime},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="createIme != null">
 | 
	
		
			
				|  |  | +                create_ime_ = #{createIme},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="updateTime != null">
 | 
	
		
			
				|  |  | +                update_time_ = #{updateTime},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +        </set>
 | 
	
		
			
				|  |  | +        where id_ = #{id}
 | 
	
		
			
				|  |  | +    </update>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id_">
 | 
	
		
			
				|  |  | +        insert into sell_order (organ_id_, cooperation_organ_id_, trans_no_,order_id_, order_no_, expect_amount_, actual_amount_,
 | 
	
		
			
				|  |  | +        balance_amount_, type_, goods_id_,goods_name_, sell_cost_, sell_cost2_, num_, user_id_, payment_channel_,
 | 
	
		
			
				|  |  | +        mer_no_, sell_time_, create_ime_, update_time_)
 | 
	
		
			
				|  |  | +        VALUE
 | 
	
		
			
				|  |  | +        <foreach collection="sellOrders" separator="," item="sellOrder">
 | 
	
		
			
				|  |  | +            (#{sellOrder.organId},#{sellOrder.cooperationOrganId},#{sellOrder.transNo},#{sellOrder.orderId},#{sellOrder.orderNo},
 | 
	
		
			
				|  |  | +            #{sellOrder.expectAmount},#{sellOrder.actualAmount},#{sellOrder.balanceAmount},#{sellOrder.type},#{sellOrder.goodsId},
 | 
	
		
			
				|  |  | +            #{sellOrder.goodsName},#{sellOrder.sellCost},#{sellOrder.sellCost2},#{sellOrder.num},#{sellOrder.userId},
 | 
	
		
			
				|  |  | +            #{sellOrder.paymentChannel},#{sellOrder.merNo},#{sellOrder.sellTime},#{sellOrder.createIme},#{sellOrder.updateTime})
 | 
	
		
			
				|  |  | +        </foreach>
 | 
	
		
			
				|  |  | +    </insert>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 分页查询 -->
 | 
	
		
			
				|  |  | +    <select id="queryPage" resultMap="SellOrder" parameterType="map">
 | 
	
		
			
				|  |  | +        SELECT so.*,su.username_ user_name_,su.phone_,o.name_ organ_name_,co.name_ school_name_ FROM sell_order so
 | 
	
		
			
				|  |  | +        LEFT JOIN sys_user su ON so.user_id_ = su.id_
 | 
	
		
			
				|  |  | +        LEFT JOIN organization o ON o.id_ = so.organ_id_
 | 
	
		
			
				|  |  | +        LEFT JOIN cooperation_organ co ON co.id_= so.cooperation_organ_id_
 | 
	
		
			
				|  |  | +        <include refid="queryPageSql"/>
 | 
	
		
			
				|  |  | +        ORDER BY so.sell_time_ DESC
 | 
	
		
			
				|  |  | +        <include refid="global.limit"/>
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 查询当前表的总记录数 -->
 | 
	
		
			
				|  |  | +    <select id="queryCount" resultType="int">
 | 
	
		
			
				|  |  | +        SELECT COUNT(*) FROM sell_order so
 | 
	
		
			
				|  |  | +        <include refid="queryPageSql"/>
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <sql id="queryPageSql">
 | 
	
		
			
				|  |  | +        <where>
 | 
	
		
			
				|  |  | +            <if test="search != null and search != ''">
 | 
	
		
			
				|  |  | +                AND (so.order_no_ = #{search} OR so.trans_no_ = #{search})
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="organIdList != null and organIdList != ''">
 | 
	
		
			
				|  |  | +                AND FIND_IN_SET(so.organ_id_,#{organIdList})
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="goodsName != null and goodsName != ''">
 | 
	
		
			
				|  |  | +                AND so.goods_name_ = #{goodsName}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="cooperationOrganId != null">
 | 
	
		
			
				|  |  | +                AND so.cooperation_organ_id_ = #{cooperationOrganId}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="type != null">
 | 
	
		
			
				|  |  | +                AND so.type_ = #{type}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="startTime != null">
 | 
	
		
			
				|  |  | +                AND so.sell_time_ >= #{startTime}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="endTime != null">
 | 
	
		
			
				|  |  | +                AND so.sell_time_ <= #{endTime}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +        </where>
 | 
	
		
			
				|  |  | +    </sql>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 获取分部学校的收入支出(乐团订单) -->
 | 
	
		
			
				|  |  | +    <select id="getMusicGroupMonthReport" resultMap="com.ym.mec.biz.dal.dao.OperatingReportDao.OperatingReport"><![CDATA[
 | 
	
		
			
				|  |  | +        SELECT spo.organ_id_,
 | 
	
		
			
				|  |  | +               co.id_                  cooperation_organ_id_,
 | 
	
		
			
				|  |  | +               SUM(spo.actual_amount_) income_total_,
 | 
	
		
			
				|  |  | +               SUM(so.actual_amount_)  sell_amount_,
 | 
	
		
			
				|  |  | +               SUM(so.sell_cost_)      sellCost
 | 
	
		
			
				|  |  | +        FROM student_payment_order spo
 | 
	
		
			
				|  |  | +                 LEFT JOIN sell_order so on so.order_id_ = spo.id_
 | 
	
		
			
				|  |  | +                 LEFT JOIN music_group mg ON mg.id_ = spo.music_group_id_
 | 
	
		
			
				|  |  | +                 LEFT JOIN cooperation_organ co ON co.id_ = mg.cooperation_organ_id_
 | 
	
		
			
				|  |  | +        WHERE spo.status_ = 'SUCCESS'
 | 
	
		
			
				|  |  | +          AND spo.group_type_ = 'MUSIC'
 | 
	
		
			
				|  |  | +          AND spo.create_time_ >= #{startTime}
 | 
	
		
			
				|  |  | +          AND spo.create_time_ <= #{endTime}
 | 
	
		
			
				|  |  | +        GROUP BY spo.organ_id_, co.id_
 | 
	
		
			
				|  |  | +        ]]></select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 获取分部学校的收入支出(VIP,网管课) -->
 | 
	
		
			
				|  |  | +    <select id="getMusicVipPracticeMonthReport" resultMap="com.ym.mec.biz.dal.dao.OperatingReportDao.OperatingReport"><![CDATA[
 | 
	
		
			
				|  |  | +        SELECT spo.organ_id_,
 | 
	
		
			
				|  |  | +               co.id_                  cooperation_organ_id_,
 | 
	
		
			
				|  |  | +               SUM(spo.actual_amount_) income_total_
 | 
	
		
			
				|  |  | +        FROM student_payment_order spo
 | 
	
		
			
				|  |  | +                 LEFT JOIN
 | 
	
		
			
				|  |  | +             (SELECT MIN(music_group_id_) music_group_id_, user_id_
 | 
	
		
			
				|  |  | +              FROM student_registration
 | 
	
		
			
				|  |  | +              WHERE music_group_status_ = 'NORMAL'
 | 
	
		
			
				|  |  | +              GROUP BY user_id_) sr
 | 
	
		
			
				|  |  | +             ON sr.user_id_ = spo.user_id_
 | 
	
		
			
				|  |  | +                 LEFT JOIN music_group mg ON mg.id_ = sr.music_group_id_
 | 
	
		
			
				|  |  | +                 LEFT JOIN cooperation_organ co ON co.id_ = mg.cooperation_organ_id_
 | 
	
		
			
				|  |  | +        WHERE spo.status_ = 'SUCCESS'
 | 
	
		
			
				|  |  | +          AND spo.group_type_ IN ('VIP', 'PRACTICE')
 | 
	
		
			
				|  |  | +          AND spo.create_time_ >= #{startTime}
 | 
	
		
			
				|  |  | +          AND spo.create_time_ <= #{endTime}
 | 
	
		
			
				|  |  | +        GROUP BY spo.organ_id_, co.id_
 | 
	
		
			
				|  |  | +        ]]></select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 获取分部学校的收入支出(外部添加订单) -->
 | 
	
		
			
				|  |  | +    <select id="getOutOrderMonthReport" resultMap="com.ym.mec.biz.dal.dao.OperatingReportDao.OperatingReport"><![CDATA[
 | 
	
		
			
				|  |  | +        SELECT spo.organ_id_,
 | 
	
		
			
				|  |  | +               co.id_                  cooperation_organ_id_,
 | 
	
		
			
				|  |  | +               SUM(spo.actual_amount_) income_total_,
 | 
	
		
			
				|  |  | +               SUM(so.actual_amount_)  sell_amount_,
 | 
	
		
			
				|  |  | +               SUM(so.sell_cost_)      sellCost
 | 
	
		
			
				|  |  | +        FROM student_payment_order spo
 | 
	
		
			
				|  |  | +                 LEFT JOIN sell_order so on so.order_id_ = spo.id_
 | 
	
		
			
				|  |  | +                 LEFT JOIN cooperation_organ co ON co.id_ = spo.music_group_id_
 | 
	
		
			
				|  |  | +        WHERE spo.status_ = 'SUCCESS'
 | 
	
		
			
				|  |  | +          AND spo.group_type_ = 'OUTORDER'
 | 
	
		
			
				|  |  | +          AND spo.create_time_ >= #{startTime}
 | 
	
		
			
				|  |  | +          AND spo.create_time_ <= #{endTime}
 | 
	
		
			
				|  |  | +        GROUP BY spo.organ_id_, co.id_
 | 
	
		
			
				|  |  | +        ]]></select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 获取分部学校的收入(充值) -->
 | 
	
		
			
				|  |  | +    <select id="getRechargeMonthReport" resultMap="com.ym.mec.biz.dal.dao.OperatingReportDao.OperatingReport"><![CDATA[
 | 
	
		
			
				|  |  | +        SELECT spo.organ_id_,
 | 
	
		
			
				|  |  | +               co.id_                  cooperation_organ_id_,
 | 
	
		
			
				|  |  | +               SUM(spo.actual_amount_) income_total_
 | 
	
		
			
				|  |  | +        FROM student_payment_order spo
 | 
	
		
			
				|  |  | +                 LEFT JOIN sporadic_charge_info sci ON sci.id_ = spo.music_group_id_
 | 
	
		
			
				|  |  | +                 LEFT JOIN music_group mg ON mg.id_ = sci.music_group_id_
 | 
	
		
			
				|  |  | +                 LEFT JOIN cooperation_organ co ON co.id_ = mg.cooperation_organ_id_
 | 
	
		
			
				|  |  | +        WHERE spo.status_ = 'SUCCESS'
 | 
	
		
			
				|  |  | +          AND spo.group_type_ = 'SPORADIC'
 | 
	
		
			
				|  |  | +          AND sci.charge_type_ = '9'
 | 
	
		
			
				|  |  | +          AND spo.create_time_ >= #{startTime}
 | 
	
		
			
				|  |  | +          AND spo.create_time_ <= #{endTime}
 | 
	
		
			
				|  |  | +        GROUP BY spo.organ_id_, co.id_
 | 
	
		
			
				|  |  | +        ]]></select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 获取分部学校的收入(零星支付) -->
 | 
	
		
			
				|  |  | +    <select id="getSporadicMonthReport" resultMap="com.ym.mec.biz.dal.dao.OperatingReportDao.OperatingReport"><![CDATA[
 | 
	
		
			
				|  |  | +        SELECT spo.organ_id_,
 | 
	
		
			
				|  |  | +               co.id_                  cooperation_organ_id_,
 | 
	
		
			
				|  |  | +               SUM(spo.actual_amount_) income_total_
 | 
	
		
			
				|  |  | +        FROM student_payment_order spo
 | 
	
		
			
				|  |  | +                 LEFT JOIN sporadic_charge_info sci ON sci.id_ = spo.music_group_id_
 | 
	
		
			
				|  |  | +                 LEFT JOIN music_group mg ON mg.id_ = sci.music_group_id_
 | 
	
		
			
				|  |  | +                 LEFT JOIN cooperation_organ co ON co.id_ = mg.cooperation_organ_id_
 | 
	
		
			
				|  |  | +        WHERE spo.status_ = 'SUCCESS'
 | 
	
		
			
				|  |  | +          AND spo.group_type_ = 'SPORADIC'
 | 
	
		
			
				|  |  | +          AND sci.charge_type_ != '9'
 | 
	
		
			
				|  |  | +          AND spo.create_time_ >= #{startTime}
 | 
	
		
			
				|  |  | +          AND spo.create_time_ <= #{endTime}
 | 
	
		
			
				|  |  | +        GROUP BY spo.organ_id_, co.id_
 | 
	
		
			
				|  |  | +        ]]></select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 获取分部学校的收入支出(维修、商品销售订单) -->
 | 
	
		
			
				|  |  | +    <select id="getRepairGoodsSellGroupMonthReport" resultMap="com.ym.mec.biz.dal.dao.OperatingReportDao.OperatingReport"><![CDATA[
 | 
	
		
			
				|  |  | +        SELECT spo.organ_id_,
 | 
	
		
			
				|  |  | +               SUM(spo.actual_amount_) income_total_,
 | 
	
		
			
				|  |  | +               SUM(so.actual_amount_)  sell_amount_,
 | 
	
		
			
				|  |  | +               SUM(so.sell_cost_)      sellCost
 | 
	
		
			
				|  |  | +        FROM student_payment_order spo
 | 
	
		
			
				|  |  | +                 LEFT JOIN sell_order so on so.order_id_ = spo.id_
 | 
	
		
			
				|  |  | +        WHERE spo.status_ = 'SUCCESS'
 | 
	
		
			
				|  |  | +          AND spo.group_type_ IN ('REPAIR','GOODS_SELL')
 | 
	
		
			
				|  |  | +          AND spo.create_time_ >= #{startTime}
 | 
	
		
			
				|  |  | +          AND spo.create_time_ <= #{endTime}
 | 
	
		
			
				|  |  | +        GROUP BY spo.organ_id_
 | 
	
		
			
				|  |  | +        ]]></select>
 | 
	
		
			
				|  |  | +</mapper>
 |