IncomeStatisticParkSourceMonthSMapper.xml 8.76 KB
<?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.zteits.order.mapper.smapper.IncomeStatisticParkSourceMonthSMapper">
    <resultMap id="BaseResultMap" type="com.zteits.order.domain.IncomeStatisticParkSourceMonth">
        <id column="id" jdbcType="BIGINT" property="id" />
        <result column="static_date" jdbcType="DATE" property="staticDate" />
        <result column="static_date_str" jdbcType="VARCHAR" property="staticDateStr" />
        <result column="org_id" jdbcType="INTEGER" property="orgId" />
        <result column="pl_no" jdbcType="VARCHAR" property="plNo" />
        <result column="pl_name" jdbcType="VARCHAR" property="plName" />
        <result column="pl_type" jdbcType="INTEGER" property="plType" />
        <result column="berth_range_no" jdbcType="VARCHAR" property="berthRangeNo" />
        <result column="berth_range_name" jdbcType="VARCHAR" property="berthRangeName" />
        <result column="area_id" jdbcType="VARCHAR" property="areaId" />
        <result column="area_name" jdbcType="VARCHAR" property="areaName" />
        <result column="source_code" jdbcType="VARCHAR" property="sourceCode" />
        <result column="source_name" jdbcType="VARCHAR" property="sourceName" />
        <result column="work_offwork_time" jdbcType="VARCHAR" property="workOffworkTime" />
        <result column="order_num" jdbcType="INTEGER" property="orderNum" />
        <result column="total_fee" jdbcType="BIGINT" property="totalFee" />
        <result column="act_fee" jdbcType="BIGINT" property="actFee" />
        <result column="dicount_fee" jdbcType="BIGINT" property="dicountFee" />
        <result column="back_act_fee" jdbcType="BIGINT" property="backActFee" />
        <result column="error_fee" jdbcType="BIGINT" property="errorFee" />
        <result column="error_order_num" jdbcType="INTEGER" property="errorOrderNum" />
        <result column="ali_fee" jdbcType="BIGINT" property="aliFee" />
        <result column="ali_charge_num" jdbcType="INTEGER" property="aliChargeNum" />
        <result column="wx_fee" jdbcType="BIGINT" property="wxFee" />
        <result column="wx_charge_num" jdbcType="INTEGER" property="wxChargeNum" />
        <result column="cash_fee" jdbcType="BIGINT" property="cashFee" />
        <result column="cash_charge_num" jdbcType="INTEGER" property="cashChargeNum" />
        <result column="balance_fee" jdbcType="BIGINT" property="balanceFee" />
        <result column="balance_charge_num" jdbcType="INTEGER" property="balanceChargeNum" />
        <result column="data_state" jdbcType="INTEGER" property="dataState" />
        <result column="create_emp_id" jdbcType="VARCHAR" property="createEmpId" />
        <result column="create_emp_name" jdbcType="VARCHAR" property="createEmpName" />
        <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
        <result column="modfiy_emp_id" jdbcType="VARCHAR" property="modfiyEmpId" />
        <result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" />
        <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
        <result column="remark" jdbcType="VARCHAR" property="remark" />
    </resultMap>
    <sql id="Base_Column_List">
    id, static_date, static_date_str, org_id, pl_no, pl_name, pl_type, berth_range_no,
    berth_range_name, area_id, area_name, source_code, source_name, work_offwork_time,
    order_num, total_fee, act_fee, dicount_fee, back_act_fee, error_fee, error_order_num,
    ali_fee, ali_charge_num, wx_fee, wx_charge_num, cash_fee, cash_charge_num, balance_fee,
    balance_charge_num, data_state, create_emp_id, create_emp_name, create_date, modfiy_emp_id,
    modfiy_emp_name, modfiy_date, remark
  </sql>
  <!-- 收费员收入按月(income_statistic_park_source_month) -->
    <select id="queryIncomeStatisticChargerMonthTotal" resultMap="BaseResultMap" parameterType="com.zteits.clouds.api.dto.order.income.param.IncomeParkChargerReq">
       SELECT
            a.pl_type,
            sum(IFNULL(a.act_fee,0)) as act_fee,
            sum(IFNULL(a.order_num,0)) as order_num,
            sum(IFNULL(a.error_fee,0)) as error_fee,
            sum(IFNULL(a.error_order_num,0)) as error_order_num
        FROM
            income_statistic_park_source_month a
        where 1=1
          and a.data_state=1
          and a.static_date between #{beginTime} and #{endTime}
        <if test="plNos != null and plNos.size > 0">
          and a.pl_no in
            <foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
                #{plNo}
            </foreach>
        </if>
        <if test="sourceCodes != null and sourceCodes.size > 0">
            and a.source_code in
            <foreach collection="sourceCodes" open="(" close=")" item="sourceCode" separator=",">
                #{sourceCode}
            </foreach>
          </if>
         group by a.pl_type
    </select>
  <!-- 收费员收入按月-分页查询 -->
    <select id="queryParkChargerIncomeMonthForPage" resultType="com.zteits.clouds.api.dto.order.income.dto.IncomeStatisticParkSourceDTO" parameterType="com.zteits.clouds.api.dto.order.income.param.IncomeParkChargerReq">
       SELECT * from (
       SELECT
        a.pl_no AS plNo,
        a.pl_name AS plName,
        a.source_code AS sourceCode,
        a.source_name AS sourceName,
        a.pl_type AS plType,
        a.berth_range_no AS berthRangeNo,
        a.berth_range_name AS berthRangeName,
        a.work_offwork_time AS workOffworkTime,
        sum( IFNULL(a.total_fee,0)) AS totalFee,
        sum( IFNULL(a.act_fee,0)) AS actFee,
        sum( IFNULL(a.ali_fee,0)) AS aliFee,
		sum( IFNULL(a.wx_fee,0)) AS wxFee,
		sum( IFNULL(a.cash_fee,0)) AS cashFee,
		sum( IFNULL(a.balance_fee,0)) AS balanceFee,
        sum( IFNULL(a.dicount_fee,0)) AS dicountFee,
        sum(IFNULL(a.error_fee,0)) AS errorFee,
        sum( IFNULL(a.error_order_num,0)) AS errorOrderNum,
        sum(IFNULL(a.back_act_fee,0)) AS backActFee
    FROM
        income_statistic_park_source_month a
    where 1=1
          and a.data_state=1
          and a.static_date between #{beginTime} and #{endTime}
          <if test="plNos != null and plNos.size > 0">
            and a.pl_no in
            <foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
                #{plNo}
            </foreach>
          </if>
          <if test="sourceCodes != null and sourceCodes.size > 0">
            and a.source_code in
            <foreach collection="sourceCodes" open="(" close=")" item="sourceCode" separator=",">
                #{sourceCode}
            </foreach>
          </if>
         group by a.pl_no,a.pl_name,a.source_code,a.source_name,a.pl_type,a.berth_range_no,a.berth_range_name,a.work_offwork_time)b
    ORDER BY b.actFee DESC,convert(b.plName USING gbk) ASC
    </select>
  
  <!-- 收费员收入按每月-分页查询-不汇总 -->
    <select id="queryParkChargerIncomeEveryMonthForPage" resultType="com.zteits.clouds.api.dto.order.income.dto.IncomeStatisticParkSourceDTO" 
        parameterType="com.zteits.clouds.api.dto.order.income.param.IncomeParkChargerReq">
       SELECT * from (
       SELECT
        MAX(a.static_date_str) AS staticDateStr,
        max(a.pl_no) AS plNo,
        max(a.pl_name) AS plName,
        a.source_code AS sourceCode,
        max(a.source_name) AS sourceName,
        max(a.pl_type) AS plType,
        max(a.berth_range_no) AS berthRangeNo,
        max(a.berth_range_name) AS berthRangeName,
        max(a.work_offwork_time) AS workOffworkTime,
        sum( IFNULL(a.total_fee,0)) AS totalFee,
        sum( IFNULL(a.act_fee,0)) AS actFee,
        sum( IFNULL(a.ali_fee,0)) AS aliFee,
		sum( IFNULL(a.wx_fee,0)) AS wxFee,
		sum( IFNULL(a.cash_fee,0)) AS cashFee,
		sum( IFNULL(a.balance_fee,0)) AS balanceFee,
        sum( IFNULL(a.dicount_fee,0)) AS dicountFee,
        sum(IFNULL(a.error_fee,0)) AS errorFee,
        sum( IFNULL(a.error_order_num,0)) AS errorOrderNum,
        sum(IFNULL(a.back_act_fee,0)) AS backActFee
    FROM
        income_statistic_park_source_month a
    where 1=1
          and a.data_state=1
          and a.static_date between #{beginTime} and #{endTime}
          <if test="plNos != null and plNos.size > 0">
            and a.pl_no in
            <foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
                #{plNo}
            </foreach>
          </if>
          <if test="sourceCodes != null and sourceCodes.size > 0">
            and a.source_code in
            <foreach collection="sourceCodes" open="(" close=")" item="sourceCode" separator=",">
                #{sourceCode}
            </foreach>
          </if>
         group by a.static_date_str,a.source_code)b
    ORDER BY b.staticDateStr DESC,b.actFee DESC,convert(b.plName USING gbk) ASC
    </select>
    
</mapper>