ChargerIncomeStatisticDaySMapper.xml 14.5 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.ChargerIncomeStatisticDaySMapper">
  <resultMap id="BaseResultMap" type="com.zteits.order.domain.ChargerIncomeStatisticDay">
    <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="charger_code" jdbcType="VARCHAR" property="chargerCode" />
    <result column="charger_name" jdbcType="VARCHAR" property="chargerName" />
    <result column="park_in_ount" jdbcType="INTEGER" property="parkInOunt" />
    <result column="park_out_ount" jdbcType="INTEGER" property="parkOutOunt" />
    <result column="arrearage_count" jdbcType="INTEGER" property="arrearageCount" />
    <result column="wx_count" jdbcType="INTEGER" property="wxCount" />
    <result column="ali_count" jdbcType="INTEGER" property="aliCount" />
    <result column="cash_count" jdbcType="INTEGER" property="cashCount" />
    <result column="balance_count" jdbcType="INTEGER" property="balanceCount" />
    <result column="total_fee" jdbcType="BIGINT" property="totalFee" />
    <result column="arrearage_fee" jdbcType="BIGINT" property="arrearageFee" />
    <result column="wx_fee" jdbcType="BIGINT" property="wxFee" />
    <result column="ali_fee" jdbcType="BIGINT" property="aliFee" />
    <result column="cash_fee" jdbcType="BIGINT" property="cashFee" />
    <result column="balance_fee" jdbcType="BIGINT" property="balanceFee" />
    <result column="sub_total_fee" jdbcType="BIGINT" property="subTotalFee" />
    <result column="back_fee" jdbcType="BIGINT" property="backFee" />
    <result column="back_count" jdbcType="INTEGER" property="backCount" />
    <result column="pda_back_fee" jdbcType="BIGINT" property="pdaBackFee" />
    <result column="pda_back_count" jdbcType="INTEGER" property="pdaBackCount" />
    <result column="app_back_fee" jdbcType="BIGINT" property="appBackFee" />
    <result column="app_back_count" jdbcType="INTEGER" property="appBackCount" />
    <result column="dicount_fee" jdbcType="BIGINT" property="dicountFee" />
    <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, charger_code, charger_name, park_in_ount, 
    park_out_ount, arrearage_count, wx_count, ali_count, cash_count, balance_count, total_fee, 
    arrearage_fee, wx_fee, ali_fee, cash_fee, balance_fee, sub_total_fee, back_fee, back_count,
    pda_back_fee, pda_back_count, app_back_fee, app_back_count, dicount_fee, data_state,
    create_emp_id, create_emp_name, create_date, modfiy_emp_id, modfiy_emp_name, modfiy_date,
    remark
  </sql>
  <select id="queryChargerIncomeStatisticList" parameterType="com.zteits.clouds.api.dto.order.income.param.IncomeParkChargerReq" 
    resultType="com.zteits.order.domain.ChargerIncomeStatisticDay">
        select
	      charger_code AS chargerCode,
          charger_name AS chargerName,
          pl_no as plNo,
          pl_name as plName,
          berth_range_no as berthRangeNo,
          berth_range_name as berthRangeName,
          org_id AS orgId,
          MAX(static_date_str) AS staticDateStr,
          MAX(static_date) AS staticDate,
          SUM(park_in_ount) AS parkInOunt,
          SUM(park_out_ount) AS parkOutOunt,
          SUM(arrearage_count) AS arrearageCount,
          SUM(arrearage_count_on) AS arrearageCountOn,
          SUM(arrearage_count_off) AS arrearageCountOff,
          SUM(wx_count) AS wxCount,
          SUM(ali_count) AS aliCount,
          SUM(cash_count) AS cashCount,
          SUM(balance_count) AS balanceCount,
          SUM(total_fee) AS totalFee,
          SUM(arrearage_fee) AS arrearageFee,
          SUM(arrearage_fee_on) AS arrearageFeeOn,
          SUM(arrearage_fee_off) AS arrearageFeeOff,
          SUM(wx_fee) AS wxFee,
          SUM(ali_fee) AS aliFee,
          SUM(cash_fee) AS cashFee,
          SUM(balance_fee) AS balanceFee,
          SUM(sub_total_fee) AS subTotalFee,
          SUM(back_fee) AS backFee,
          SUM(app_back_fee) AS appBackFee,
          SUM(pda_back_fee) AS pdaBackFee,
          SUM(app_back_count) AS appBackCount,
          SUM(pda_back_count) AS pdaBackCount,
          SUM(back_count) AS backCount,
          SUM(dicount_fee) AS dicountFee
	    from charger_income_statistic_day
	    where data_state = 1
	    <if test="orgId != null">
	        and org_id = #{orgId}
	    </if>
	    <if test="sourceCodes != null and sourceCodes.size > 0">
	        and charger_code in
            <foreach collection="sourceCodes" open="(" close=")" item="sourceCode" separator=",">
                #{sourceCode}
            </foreach>
	    </if>
	    <if test="plNos != null and plNos.size > 0">
	        and pl_no in
            <foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
                #{plNo}
            </foreach>
	    </if>
	    <if test="berthRangeNos != null and berthRangeNos.size > 0">
	        and berth_range_no in
            <foreach collection="berthRangeNos" open="(" close=")" item="berthRangeNo" separator=",">
                #{berthRangeNo}
            </foreach>
	    </if>
	    AND static_date BETWEEN #{beginTime} AND #{endTime}
	  group by charger_code,pl_no,pl_name,berth_range_no,berth_range_name,org_id
  </select>
  
  <!-- 停车场视图的收费员收益稽核 -->
  <select id="queryChargerIncomeStatisticListForPark" parameterType="com.zteits.clouds.api.dto.order.income.param.IncomeParkChargerReq" 
    resultType="com.zteits.order.domain.ChargerIncomeStatisticDay">
        select
	      
          pl_no as plNo,
          pl_name as plName,
          berth_range_no as berthRangeNo,
          berth_range_name as berthRangeName,
          org_id AS orgId,
          MAX(static_date_str) AS staticDateStr,
          MAX(static_date) AS staticDate,
          SUM(park_in_ount) AS parkInOunt,
          SUM(park_out_ount) AS parkOutOunt,
          SUM(arrearage_count) AS arrearageCount,
          SUM(arrearage_count_on) AS arrearageCountOn,
          SUM(arrearage_count_off) AS arrearageCountOff,
          SUM(wx_count) AS wxCount,
          SUM(ali_count) AS aliCount,
          SUM(cash_count) AS cashCount,
          SUM(balance_count) AS balanceCount,
          SUM(total_fee) AS totalFee,
          SUM(arrearage_fee) AS arrearageFee,
          SUM(arrearage_fee_on) AS arrearageFeeOn,
          SUM(arrearage_fee_off) AS arrearageFeeOff,
          SUM(wx_fee) AS wxFee,
          SUM(ali_fee) AS aliFee,
          SUM(cash_fee) AS cashFee,
          SUM(balance_fee) AS balanceFee,
          SUM(sub_total_fee) AS subTotalFee,
          SUM(back_fee) AS backFee,
          SUM(app_back_fee) AS appBackFee,
          SUM(pda_back_fee) AS pdaBackFee,
          SUM(app_back_count) AS appBackCount,
          SUM(pda_back_count) AS pdaBackCount,
          SUM(back_count) AS backCount,
          SUM(dicount_fee) AS dicountFee
	    from charger_income_statistic_day
	    where data_state = 1
	    <if test="orgId != null">
	        and org_id = #{orgId}
	    </if>
	    <if test="sourceCodes != null and sourceCodes.size > 0">
	        and charger_code in
            <foreach collection="sourceCodes" open="(" close=")" item="sourceCode" separator=",">
                #{sourceCode}
            </foreach>
	    </if>
	    <if test="plNos != null and plNos.size > 0">
	        and pl_no in
            <foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
                #{plNo}
            </foreach>
	    </if>
	    <if test="berthRangeNos != null and berthRangeNos.size > 0">
	        and berth_range_no in
            <foreach collection="berthRangeNos" open="(" close=")" item="berthRangeNo" separator=",">
                #{berthRangeNo}
            </foreach>
	    </if>
	    AND static_date BETWEEN #{beginTime} AND #{endTime}
	    GROUP BY pl_no
  </select>
  
  <select id="queryChargerIncomeStatisticTotal" parameterType="com.zteits.clouds.api.dto.order.income.param.IncomeParkChargerReq" 
    resultType="com.zteits.order.domain.ChargerIncomeStatisticDay">
        select
          MAX(static_date_str) AS staticDateStr,
          MAX(static_date) AS staticDate,
          SUM(park_in_ount) AS parkInOunt,
          SUM(park_out_ount) AS parkOutOunt,
          SUM(arrearage_count) AS arrearageCount,
          SUM(arrearage_count_on) AS arrearageCountOn,
          SUM(arrearage_count_off) AS arrearageCountOff,
          SUM(wx_count) AS wxCount,
          SUM(ali_count) AS aliCount,
          SUM(cash_count) AS cashCount,
          SUM(balance_count) AS balanceCount,
          SUM(total_fee) AS totalFee,
          SUM(arrearage_fee) AS arrearageFee,
          SUM(arrearage_fee_on) AS arrearageFeeOn,
          SUM(arrearage_fee_off) AS arrearageFeeOff,
          SUM(wx_fee) AS wxFee,
          SUM(ali_fee) AS aliFee,
          SUM(cash_fee) AS cashFee,
          SUM(balance_fee) AS balanceFee,
          SUM(sub_total_fee) AS subTotalFee,
          SUM(back_fee) AS backFee,
          SUM(app_back_fee) AS appBackFee,
          SUM(pda_back_fee) AS pdaBackFee,
          SUM(app_back_count) AS appBackCount,
          SUM(pda_back_count) AS pdaBackCount,
          SUM(back_count) AS backCount,
          SUM(dicount_fee) AS dicountFee
	    from charger_income_statistic_day
	    where data_state = 1
	    <if test="orgId != null">
	        and org_id = #{orgId}
	    </if>
	    <if test="sourceCodes != null and sourceCodes.size > 0">
	        and charger_code in
            <foreach collection="sourceCodes" open="(" close=")" item="sourceCode" separator=",">
                #{sourceCode}
            </foreach>
	    </if>
	    <if test="plNos != null and plNos.size > 0">
	        and pl_no in
            <foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
                #{plNo}
            </foreach>
	    </if>
	    <if test="berthRangeNos != null and berthRangeNos.size > 0">
	        and berth_range_no in
            <foreach collection="berthRangeNos" open="(" close=")" item="berthRangeNo" separator=",">
                #{berthRangeNo}
            </foreach>
	    </if>
	    AND static_date BETWEEN #{beginTime} AND #{endTime}
  </select>
  <!-- 收费员收益稽核列表-丹阳 -->
  <select id="queryChargerIncomeStatisticListForDY" parameterType="com.zteits.clouds.api.dto.order.income.param.IncomeParkChargerReq" 
    resultType="com.zteits.order.domain.ChargerIncomeStatisticDay">
        select
	      charger_code AS chargerCode,
          charger_name AS chargerName,
          pl_no as plNo,
          pl_name as plName,
          berth_range_no as berthRangeNo,
          berth_range_name as berthRangeName,
          org_id AS orgId,
          MAX(static_date_str) AS staticDateStr,
          MAX(static_date) AS staticDate,
          SUM(park_in_ount) AS parkInOunt,
          SUM(park_out_ount) AS parkOutOunt,
          SUM(arrearage_count) AS arrearageCount,
          SUM(arrearage_count_on) AS arrearageCountOn,
          SUM(arrearage_count_off) AS arrearageCountOff,
          SUM(wx_count) AS wxCount,
          SUM(ali_count) AS aliCount,
          SUM(cash_count) AS cashCount,
          SUM(balance_count) AS balanceCount,
          SUM(total_fee) AS totalFee,
          SUM(arrearage_fee) AS arrearageFee,
          SUM(arrearage_fee_on) AS arrearageFeeOn,
          SUM(arrearage_fee_off) AS arrearageFeeOff,
          SUM(wx_fee) AS wxFee,
          SUM(ali_fee) AS aliFee,
          SUM(cash_fee) AS cashFee,
          SUM(balance_fee) AS balanceFee,
          SUM(sub_total_fee) AS subTotalFee,
          SUM(back_fee) AS backFee,
          SUM(app_back_fee) AS appBackFee,
          SUM(pda_back_fee) AS pdaBackFee,
          SUM(app_back_count) AS appBackCount,
          SUM(pda_back_count) AS pdaBackCount,
          SUM(back_count) AS backCount,
          SUM(dicount_fee) AS dicountFee
	    from charger_income_statistic_day
	    where data_state = 1
	    <if test="orgId != null">
	        and org_id = #{orgId}
	    </if>
	    <if test="sourceCodes != null and sourceCodes.size > 0">
	        and charger_code in
            <foreach collection="sourceCodes" open="(" close=")" item="sourceCode" separator=",">
                #{sourceCode}
            </foreach>
	    </if>
	    <if test="plNos != null and plNos.size > 0">
	        and pl_no in
            <foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
                #{plNo}
            </foreach>
	    </if>
	    <if test="berthRangeNos != null and berthRangeNos.size > 0">
	        and berth_range_no in
            <foreach collection="berthRangeNos" open="(" close=")" item="berthRangeNo" separator=",">
                #{berthRangeNo}
            </foreach>
	    </if>
	    AND static_date BETWEEN #{beginTime} AND #{endTime}
	  group by charger_code
  </select>

    <!--查询收费员收入情况-考核-->
    <select id="queryChargerIncomeListForAssess" parameterType="com.zteits.clouds.api.dto.order.income.param.IncomeParkChargerReq"
            resultType="com.zteits.order.domain.ChargerIncomeStatisticDay">
        select
        charger_code AS chargerCode,
        charger_name AS chargerName,
        MAX(static_date_str) AS staticDateStr,
        MAX(static_date) AS staticDate,
        SUM(total_fee) AS totalFee,
        SUM(back_fee) AS backFee,
        SUM(sub_total_fee) AS subTotalFee,
        SUM(order_act_fee) AS orderActFee,
        SUM(arrearage_fee) AS arrearageFee
        from charger_income_statistic_day
        where data_state = 1
        <if test="orgId != null">
            and org_id = #{orgId}
        </if>
        <if test="sourceCodes != null and sourceCodes.size > 0">
            and charger_code in
            <foreach collection="sourceCodes" open="(" close=")" item="sourceCode" separator=",">
                #{sourceCode}
            </foreach>
        </if>

        AND static_date BETWEEN #{beginTime} AND #{endTime}
        group by charger_code
    </select>
    
</mapper>