<?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.fjhx.sale.mapper.commission.CommissionMapper">
    <select id="getPage" resultType="com.fjhx.sale.entity.commission.vo.CommissionVo">
        select *
        from commission c
            ${ew.customSqlSegment}
    </select>

    <select id="getHeadStatistics" resultType="com.fjhx.sale.entity.commission.vo.CommissionVo">
        SELECT IFNULL(SUM(total_income), 0)            AS totalIncome,
               IFNULL(SUM(total_expenses), 0)          AS totalExpenses,
               IFNULL(SUM(after_sales_amount), 0)      AS afterSalesAmount,
               IFNULL(SUM(public_amount), 0)           AS publicAmount,
               IFNULL(SUM(have_overall_amount), 0)     AS haveOverallAmount,
               IFNULL(SUM(departmental_commission), 0) AS departmentalCommission,
               IFNULL(SUM(personal_commission), 0)     AS personalCommission
        FROM commission c
    </select>
</mapper>
