package com.tofly.xrtygis.custom.mapper;

import com.tofly.xrtygis.custom.entity.vo.CostVo;
import com.tofly.xrtygis.custom.entity.vo.MarkWaterVo;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Map;

/**
 * @author 20126
 */
public interface DataMonthPlanMapper {

    /* ********************制水材料*********************** */

    /**
     * 获取一厂制水材料月度实际（财务）
     *
     * @param year 年月 yyyy-MM
     * @return MarkWaterVo
     */
    MarkWaterVo getOneMonthActual(@Param("year") String year);

    /**
     * 获取二厂制水材料月度实际（财务）
     *
     * @param year 年月 yyyy-MM
     * @return MarkWaterVo
     */
    MarkWaterVo getTwoMonthActual(@Param("year") String year);

    /**
     * 获取一厂制水材料月度计划（预算）
     *
     * @param year 年月
     * @return MarkWaterVo
     */
    MarkWaterVo getOneMonthPlan(@Param("year") String year);

    /**
     * 获取二厂制水材料月度计划（预算）
     *
     * @param year 年月
     * @return MarkWaterVo
     */
    MarkWaterVo getTwoMonthPlan(@Param("year") String year);

    /**
     * 获取一厂制水材料月度累计值
     *
     * @param year 年份
     * @return MarkWaterVo
     */
    MarkWaterVo getOneMonthPile(@Param("year") String year);

    /**
     * 获取二厂制水材料月度累计值
     *
     * @param year 年份
     * @return MarkWaterVo
     */
    MarkWaterVo getTwoMonthPile(@Param("year") String year);

    /**
     * 获取一厂信息
     *
     * @param year 年月
     * @return list
     */
    List<Map> getOneInfo(@Param("year") String year);

    /**
     * 获取二厂信息
     *
     * @param year 年月
     * @return list
     */
    List<Map> getTwoInfo(@Param("year") String year);

    /* ************************成本核算************************ */

    /**
     * 一厂材料核算（财务）
     */
    @Select("select PACZFY_ONE  pacfy,\n" +
            "       SYZFY_ONE   syfy,\n" +
            "       CNZFY       cnfy,\n" +
            "       BCSZFY      bcsfy,\n" +
            "       JBDF_ONE    jbdf,\n" +
            "       DLDF_ONE    dldf,\n" +
            "       YSF,\n" +
            "       SZYSF_ONE   szysf,\n" +
            "       PACCB_ONE   paccb,\n" +
            "       ZZSCLFY_ONE zsclfy,\n" +
            "       ZFY_ONE     zfy,\n" +
            "       DFCB_ONE    dfcb,\n" +
            "       ZSCLCB_ONE  zzsclcb,\n" +
            "       YSFCB,\n" +
            "       SZYSFCB_ONE szysfcb,\n" +
            "       DWCB_ONE    dwbdcb,\n" +
            "       SYDJ,\n" +
            "       CNDJ,\n" +
            "       BCSDJ\n" +
            "from TF_YWPN_COSTRLFIXED_W f,\n" +
            "     TF_YWPN_COSTRLPRICE_W p\n" +
            "where to_char(f.UP_DATE, 'yyyy') = p.YEAR\n" +
            "  and f.MARK = 1\n" +
            "  and p.ISNEW = 1\n" +
            "  and to_char(f.UP_DATE, 'yyyy-mm') = #{year}")
    CostVo viewOneMonthActual(@Param("year") String year);

    /**
     * 二厂材料核算（财务）
     */
    @Select("select PACZFY_TWO  pacfy,  \n" +
            "       YLZFY_TWO   ylfy,    \n" +
            "       PAMZSZFY    pamzs,   \n" +
            "       FTZFY       ftfy,    \n" +
            "       GMSJFHYZFY  gmsjfy,  \n" +
            "       PAMWNZFY    pamwn,   \n" +
            "       WNZYF       wnzyfy,  \n" +
            "       JBDF_TWO    jbdf,    \n" +
            "       DLDF_TWO    dldf,    \n" +
            "       SZYSF_TWO   szysf,   \n" +
            "       ZZSCLFY_TWO zsclfy,  \n" +
            "       ZFY_TWO     zfy,     \n" +
            "       DFCB_TWO    dfcb,    \n" +
            "       YLDJ,                \n" +
            "       PAM_ZSDJ    pamzsdj, \n" +
            "       GMSJFHYDJ   gmsjdj,  \n" +
            "       ZSCLCB_ONE  zzsclcb, \n" +
            "       FTDJ,                \n" +
            "       PAM_WNDJ    pamwndj, \n" +
            "       WNZYDJ,              \n" +
            "       PACCB_TWO   paccb,   \n" +
            "       ZSCLCB_TWO  zzsclcb, \n" +
            "       SZYSFCB_TWO szysfcb, \n" +
            "       DWCB_TWO    dwbdcb   \n" +
            "from TF_YWPN_COSTRLFIXED_W fix\n" +
            "         full join TF_YWPN_COSTRLPRICE_W pri\n" +
            "                   on to_char(fix.UP_DATE, 'yyyy') = pri.YEAR and pri.ISNEW = '1'\n" +
            "where MARK = '1'\n" +
            "  and to_char(fix.UP_DATE, 'yyyy-mm') = #{year}")
    CostVo viewTwoMonthActual(@Param("year") String year);


    /**
     * 一厂材料核算（计划）
     */
    @Select("select PACZFY_ONE  pacfy,\n" +
            "               SYZFY_ONE   syfy,\n" +
            "               CNZFY       cnfy,\n" +
            "               BCSZFY      bcsfy,\n" +
            "               JBDF_ONE    jbdf,\n" +
            "               DLDF_ONE    dldf,\n" +
            "               YSF,\n" +
            "               SZYSF_ONE   szysf,\n" +
            "               ZZSCLFY_ONE zsclfy,\n" +
            "               ZFY_ONE     zfy,\n" +
            "               DFCB_ONE    dfcb,\n" +
            "               PACCB_ONE   paccb,\n" +
            "               SYDJ,\n" +
            "               CNDJ,\n" +
            "               BCSDJ,\n" +
            "               ZSCLCB_ONE  zzsclcb,\n" +
            "               YSFCB,\n" +
            "               SZYSFCB_ONE szysfcb,\n" +
            "               DWCB_ONE    dwbdcb\n" +
            "        from TF_YWPN_COSTBGFIXED_W fix\n" +
            "                 full join (select *\n" +
            "                            from (select *\n" +
            "                                  from TF_YWPN_COSTBGPRICE_W\n" +
            "                                  where YEAR = substr(#{year}, 1, 4)\n" +
            "                                  order by create_time)\n" +
            "                            where rownum = 1) pri\n" +
            "                           on substr(fix.MOUTH, 1, 4) = pri.YEAR\n" +
            "        where MOUTH = #{year}")
    CostVo viewOneMonthPlan(@Param("year") String year);

    /**
     * 二厂材料核算（计划）
     */
    @Select("select PACZFY_TWO  pacfy,\n" +
            "               YLZFY_TWO   ylfy,\n" +
            "               PAMZSZFY    pamzs,\n" +
            "               FTZFY       ftfy,\n" +
            "               GMSJFHYZFY  gmsjfy,\n" +
            "               PAMWNZFY    pamwn,\n" +
            "               WNZYF       wnzyfy,\n" +
            "               JBDF_TWO    jbdf,\n" +
            "               DLDF_TWO    dldf,\n" +
            "               SZYSF_TWO   szysf,\n" +
            "               ZZSCLFY_TWO zsclfy,\n" +
            "               ZFY_TWO     zfy,\n" +
            "               DFCB_TWO    dfcb,\n" +
            "               YLDJ,\n" +
            "               PACCB_TWO   paccb,\n" +
            "               PAM_ZSDJ    pamzsdj,\n" +
            "               GMSJFHYDJ   gmsjdj,\n" +
            "               ZSCLCB_ONE  zzsclcb,\n" +
            "               FTDJ,\n" +
            "               PAM_WNDJ    pamwndj,\n" +
            "               WNZYDJ      wnzydj,\n" +
            "               ZSCLCB_TWO  zzsclcb,\n" +
            "               SZYSFCB_TWO szysfcb,\n" +
            "               DWCB_TWO    dwbdcb\n" +
            "        from TF_YWPN_COSTBGFIXED_W fix\n" +
            "                 full join (select *\n" +
            "                            from (select *\n" +
            "                                  from TF_YWPN_COSTBGPRICE_W\n" +
            "                                  where YEAR = substr(#{year}, 1, 4)\n" +
            "                                  order by create_time)\n" +
            "                            where rownum = 1) pri\n" +
            "                           on substr(fix.MOUTH, 1, 4) = pri.YEAR\n" +
            "        where MOUTH = #{year}")
    CostVo viewTwoMonthPlan(@Param("year") String year);

    /**
     * 获取一厂成本核算月度累计值
     */
    @Select("select sum(PACZFY_ONE)                                                            pacfy,\n" +
            "       sum(SYZFY_ONE)                                                             syfy,\n" +
            "       sum(CNZFY)                                                                 cnfy,\n" +
            "       sum(BCSZFY)                                                                bcsfy,\n" +
            "       sum(JBDF_ONE)                                                              jbdf,\n" +
            "       sum(DLDF_ONE)                                                              dldf,\n" +
            "       sum(YSF)                                                                   ysf,\n" +
            "       sum(SZYSF_ONE)                                                             szysf,\n" +
            "       sum(ZZSCLFY_ONE)                                                           zsclfy,\n" +
            "       sum(ZFY_ONE)                                                               zfy,\n" +
            "       SYDJ,\n" +
            "       CNDJ,\n" +
            "       BCSDJ,\n" +
            "       round((sum(JBDF_ONE) + sum(DLDF_ONE)) / nullif(sum(GSL_ONE), 0) * 1000, 5) dfcb,\n" +
            "       round(sum(zzsclfy_one) / nullif(sum(GSL_ONE), 0) * 1000, 5)                zzsclcb,\n" +
            "       round(sum(PACZFY_ONE) / nullif(sum(GSL_ONE), 0) * 1000, 5)                 paccb,\n" +
            "       round(sum(ysf) / nullif(sum(GSL_ONE), 0) * 1000, 5)                        ysfcb,\n" +
            "       round(sum(szysf_one) / nullif(sum(GSL_ONE), 0) * 1000, 5)                  szysfcb,\n" +
            "       round(sum(zfy_one) / nullif(sum(GSL_ONE), 0) * 1000, 5)                    dwbdcb\n" +
            "from TF_YWPN_COSTRLWATER_W w right join TF_YWPN_COSTRLFIXED_W f\n" +
            "    on to_char(f.up_date, 'yyyy-mm-dd') = to_char(w.up_date, 'yyyy-mm-dd') and f.MARK = w.MARK\n" +
            "    left join TF_YWPN_COSTRLPRICE_W p on to_char(f.UP_DATE, 'yyyy') = p.YEAR\n" +
            "\n" +
            "where f.MARK = '0'\n" +
            "  and p.ISNEW = '1'\n" +
            "  and to_char(f.UP_DATE, 'yyyy-mm') = '2021-09'\n" +
            "group by to_char(f.UP_DATE, 'yyyy-mm'), SYDJ, CNDJ, BCSDJ")
    CostVo viewOneMonthPile(@Param("year") String year);

    /**
     * 获取二厂成本核算月度累计值
     */
    @Select("select sum(PACZFY_TWO)                                                            pacfy,\n" +
            "       sum(YLZFY_TWO)                                                             ylfy,\n" +
            "       sum(PAMZSZFY)                                                              pamzs,\n" +
            "       sum(FTZFY)                                                                 ftfy,\n" +
            "       sum(GMSJFHYZFY)                                                            gmsjfy,\n" +
            "       sum(PAMWNZFY)                                                              pamwn,\n" +
            "       sum(WNZYF)                                                                 wnzyfy,\n" +
            "       sum(JBDF_TWO)                                                              jbdf,\n" +
            "       sum(DLDF_TWO)                                                              dldf,\n" +
            "       sum(SZYSF_TWO)                                                             szysf,\n" +
            "       sum(ZZSCLFY_TWO)                                                           zsclfy,\n" +
            "       sum(ZFY_TWO)                                                               zfy,\n" +
            "       YLDJ,\n" +
            "       PAM_ZSDJ                                                                   pamzsdj,\n" +
            "       GMSJFHYDJ                                                                  gmsjdj,\n" +
            "       FTDJ,\n" +
            "       PAM_WNDJ                                                                   pamwndj,\n" +
            "       WNZYDJ,\n" +
            "       round((sum(JBDF_TWO) + sum(DLDF_TWO)) / nullif(sum(GSL_TWO), 0) * 1000, 5) dfcb,\n" +
            "       round(sum(zzsclfy_two) / nullif(sum(GSL_TWO), 0) * 1000, 5)                zzsclcb,\n" +
            "       round(sum(PACZFY_TWO) / nullif(sum(GSL_TWO), 0) * 1000, 5)                 paccb,\n" +
            "       round(sum(szysf_two) / nullif(sum(GSL_TWO), 0) * 1000, 5)                  szysfcb,\n" +
            "       round(sum(zfy_two) / nullif(sum(GSL_TWO), 0) * 1000, 5)                    dwbdcb\n" +
            "from TF_YWPN_COSTRLWATER_W w\n" +
            "         right join TF_YWPN_COSTRLFIXED_W f\n" +
            "                    on to_char(f.up_date, 'yyyy-mm-dd') = to_char(w.up_date, 'yyyy-mm-dd') and f.MARK = w.MARK\n" +
            "         left join TF_YWPN_COSTRLPRICE_W p on to_char(f.UP_DATE, 'yyyy') = p.YEAR\n" +
            "\n" +
            "where f.MARK = '0'\n" +
            "  and p.ISNEW = '1'\n" +
            "  and to_char(f.UP_DATE, 'yyyy-mm') = #{year}\n" +
            "group by to_char(f.UP_DATE, 'yyyy-mm'), YLDJ, PAM_ZSDJ, GMSJFHYDJ, FTDJ, PAM_WNDJ, WNZYDJ")
    CostVo viewTwoMonthPile(@Param("year") String year);


    /**
     * 获取一厂信息
     */
    @Select("select to_char(fix.UP_DATE, 'yyyy-mm-dd') day,\n" +
            "               PACZFY_ONE                     pacfy,\n" +
            "               SYZFY_ONE                      syfy,\n" +
            "               CNZFY                          cnfy,\n" +
            "               BCSZFY                         bcsfy,\n" +
            "               JBDF_ONE                       jbdf,\n" +
            "               DLDF_ONE                       dldf,\n" +
            "               YSF,\n" +
            "               SZYSF_ONE                      szysf,\n" +
            "               ZZSCLFY_ONE                    zsclfy,\n" +
            "               ZFY_ONE                        zfy,\n" +
            "               DFCB_ONE                       dfcb,\n" +
            "               SYDJ,\n" +
            "               CNDJ,\n" +
            "               BCSDJ,\n" +
            "               ZSCLCB_ONE                     zzsclcb,\n" +
            "               PACCB_ONE                      paccb,\n" +
            "               YSFCB,\n" +
            "               SZYSFCB_ONE                    szysfcb,\n" +
            "               DWCB_ONE                       dwbdcb\n" +
            "        from TF_YWPN_COSTRLFIXED_W fix\n" +
            "                 full join TF_YWPN_COSTRLPRICE_W pri\n" +
            "                           on to_char(fix.UP_DATE, 'yyyy') = pri.YEAR and pri.ISNEW = '1'\n" +
            "        where MARK = '0'\n" +
            "          and to_char(fix.UP_DATE, 'yyyy-mm') = #{year}\n" +
            "        order by day")
    List<Map<String, Object>> viewOneInfo(@Param("year") String year);

    /**
     * 获取二厂信息
     */
    @Select("select to_char(fix.UP_DATE, 'yyyy-mm-dd') day,\n" +
            "               PACZFY_TWO                     pacfy,\n" +
            "               YLZFY_TWO                      ylfy,\n" +
            "               PAMZSZFY                       pamzs,\n" +
            "               FTZFY                          ftfy,\n" +
            "               GMSJFHYZFY                     gmsjfy,\n" +
            "               PAMWNZFY                       pamwn,\n" +
            "               WNZYF                          wnzyfy,\n" +
            "               JBDF_TWO                       jbdf,\n" +
            "               DLDF_TWO                       dldf,\n" +
            "               SZYSF_TWO                      szysf,\n" +
            "               ZZSCLFY_TWO                    zsclfy,\n" +
            "               ZFY_TWO                        zfy,\n" +
            "               DFCB_TWO                       dfcb,\n" +
            "               YLDJ,\n" +
            "               PAM_ZSDJ                       pamzsdj,\n" +
            "               GMSJFHYDJ                      gmsjdj,\n" +
            "               ZSCLCB_ONE                     zzsclcb,\n" +
            "               FTDJ,\n" +
            "               PAM_WNDJ                       pamwndj,\n" +
            "               WNZYDJ,\n" +
            "               ZSCLCB_TWO                     zzsclcb,\n" +
            "               paccb_two                      paccb,\n" +
            "               SZYSFCB_TWO                    szysfcb,\n" +
            "               DWCB_TWO                       dwbdcb\n" +
            "        from TF_YWPN_COSTRLFIXED_W fix\n" +
            "                 full join TF_YWPN_COSTRLPRICE_W pri\n" +
            "                           on to_char(fix.UP_DATE, 'yyyy') = pri.YEAR and pri.ISNEW = '1'\n" +
            "        where MARK = '0'\n" +
            "          and to_char(fix.UP_DATE, 'yyyy-mm') = #{year}\n" +
            "        order by day")
    List<Map<String, Object>> viewTwoInfo(@Param("year") String year);

    @Select("select (PACZFY_ONE + PACZFY_TWO) pacfy,\n" +
            "       JBDF_TOTAL                jbdf,\n" +
            "       DLDF_TOTAL                dldf,\n" +
            "       SZYSF_TOTAL               szysf,\n" +
            "       ZZSCLFY_ONE + ZZSCLFY_TWO zsclzfy,\n" +
            "       ZFY,\n" +
            "       DFCB_TOTAL                dfcb,\n" +
            "       ZSCLCB_TOTAL              zzslccb,\n" +
            "       SZYSFCB_TOTAL             szysfcb,\n" +
            "       DWCB_TOTAL                dwbdcb,\n" +
            "       SYZFY_ONE                 syfy,\n" +
            "       CNZFY                     cnfy,\n" +
            "       BCSZFY                    bcsfy,\n" +
            "       YSF,\n" +
            "       YSFCB,\n" +
            "       round((PACZFY_ONE + PACZFY_TWO) / nullif(GSL_TOTAL,0) * 1000,5) paccb,\n" +
            "       SYDJ,\n" +
            "       CNDJ,\n" +
            "       BCSDJ,\n" +
            "       YLZFY_TWO                 ylfy,\n" +
            "       PAMZSZFY                  pamzs,\n" +
            "       FTZFY                     ftfy,\n" +
            "       GMSJFHYZFY                gmsjfy,\n" +
            "       PAMWNZFY                  pamwn,\n" +
            "       WNZYF                     wnzyfy,\n" +
            "       YLDJ,\n" +
            "       PAM_ZSDJ                  pamzsdj,\n" +
            "       GMSJFHYDJ                 gmsjdj,\n" +
            "       FTDJ,\n" +
            "       PAM_WNDJ                  pamwndj,\n" +
            "       WNZYDJ\n" +
            "from TF_YWPN_COSTRLWATER_W w\n" +
            "         right join TF_YWPN_COSTRLFIXED_W f\n" +
            "                    on w.MARK = f.MARK and to_char(w.UP_DATE, 'yyyy-mm') = to_char(f.UP_DATE, 'yyyy-mm')\n" +
            "         left join TF_YWPN_COSTRLPRICE_W p\n" +
            "                   on to_char(f.UP_DATE, 'yyyy') = p.YEAR\n" +
            "where\n" +
            "   f.MARK = 1\n" +
            "  and p.ISNEW = 1\n" +
            "  and to_char(f.UP_DATE, 'yyyy-mm') = #{year}")
    CostVo viewSumMonthActual(@Param("year") String year);

    @Select("select (PACZFY_ONE + PACZFY_TWO)                              pacfy,\n" +
            "       JBDF_TOTAL                                             jbdf,\n" +
            "       DLDF_TOTAL                                             dldf,\n" +
            "       SZYSF_TOTAL                                            szysf,\n" +
            "       ZZSCLFY_ONE + ZZSCLFY_TWO                              zsclzfy,\n" +
            "       ZFY,\n" +
            "       DFCB_TOTAL                                             dfcb,\n" +
            "       ZSCLCB_TOTAL                                           zzsclcb,\n" +
            "       SZYSFCB_TOTAL                                          szysfcb,\n" +
            "       DWCB_TOTAL                                             dwbdcb,\n" +
            "       SYZFY_ONE                                              syfy,\n" +
            "       CNZFY                                                  cnfy,\n" +
            "       BCSZFY                                                 bcsfy,\n" +
            "       YSF,\n" +
            "       YSFCB,\n" +
            "       SYDJ,\n" +
            "       CNDJ,\n" +
            "       BCSDJ,\n" +
            "       round((PACZFY_ONE + PACZFY_TWO) / nullif(GSL_TOTAL,0) * 1000, 5) paccb,\n" +
            "       YLZFY_TWO                                              ylft,\n" +
            "       PAMZSZFY                                               pamzs,\n" +
            "       FTZFY                                                  ftfy,\n" +
            "       GMSJFHYZFY                                             gmsjfy,\n" +
            "       PAMWNZFY                                               pamwn,\n" +
            "       WNZYF                                                  wnzyfy,\n" +
            "       YLDJ,\n" +
            "       PAM_ZSDJ                                               pamzsdj,\n" +
            "       GMSJFHYDJ                                              gmsjdj,\n" +
            "       FTDJ,\n" +
            "       PAM_WNDJ                                               pamwndj,\n" +
            "       WNZYDJ\n" +
            "from TF_YWPN_COSTBGWATER_W w\n" +
            "         right join TF_YWPN_COSTBGFIXED_W fix\n" +
            "                    on w.MONTH = fix.MOUTH\n" +
            "         left join (select *\n" +
            "                    from (select *\n" +
            "                          from TF_YWPN_COSTBGPRICE_W\n" +
            "                          where YEAR = substr(#{year}, 1, 4)\n" +
            "                          order by create_time)\n" +
            "                    where rownum = 1) pri\n" +
            "                   on substr(fix.MOUTH, 1, 4) = pri.YEAR\n" +
            "where fix.MOUTH = #{year}")
    CostVo viewSumMonthPlan(@Param("year") String year);

    @Select("select sum(PACZFY_ONE) + sum(PACZFY_TWO)                                                  pacfy,\n" +
            "       sum(JBDF_TOTAL)                                                                    jbdf,\n" +
            "       sum(DLDF_TOTAL)                                                                    dldf,\n" +
            "       sum(SZYSF_TOTAL)                                                                   szysf,\n" +
            "       sum(ZZSCLFY_ONE) + sum(ZZSCLFY_TWO)                                                zcclfy,\n" +
            "       sum(ZFY)                                                                           ZFY,\n" +
            "       sum(SYZFY_ONE)                                                                     syfy,\n" +
            "       sum(CNZFY)                                                                         CNFY,\n" +
            "       sum(BCSZFY)                                                                        BCSFY,\n" +
            "       sum(YSF)                                                                           YSF,\n" +
            "       sum(YLZFY_TWO)                                                                     YLFY,\n" +
            "       sum(PAMZSZFY)                                                                      PAMZS,\n" +
            "       sum(FTZFY)                                                                         FTFY,\n" +
            "       sum(GMSJFHYZFY)                                                                    GMSJFY,\n" +
            "       sum(PAMWNZFY)                                                                      PAMWN,\n" +
            "       sum(WNZYF)                                                                         wnzyfy,\n" +
            "       round((sum(PACZFY_ONE) + sum(PACZFY_TWO)) / nullif(sum(GSL_TOTAL), 0) * 1000, 5)   paccb,\n" +
            "       round((sum(JBDF_TOTAL) + sum(DLDF_TOTAL)) / nullif(sum(GSL_TOTAL), 0) * 1000, 5)   DFCB,\n" +
            "       round((sum(ZZSCLFY_ONE) + sum(ZZSCLFY_TWO)) / nullif(sum(GSL_TOTAL), 0) * 1000, 5) ZZSCLCB,\n" +
            "       round(sum(SZYSF_TOTAL) / nullif(sum(GSL_TOTAL), 0) * 1000, 5)                      SZYSFCB,\n" +
            "       round(sum(ZFY) / nullif(sum(GSL_TOTAL), 0) * 1000, 5)                              DWBDCB,\n" +
            "       round(sum(YSF) / nullif(sum(GSL_TOTAL), 0) * 1000, 5)                              YSFCB,\n" +
            "       SYDJ,\n" +
            "       CNDJ,\n" +
            "       BCSDJ,\n" +
            "       YLDJ,\n" +
            "       PAM_ZSDJ                                                                           pamzsdj,\n" +
            "       GMSJFHYDJ                                                                          gmsjdj,\n" +
            "       FTDJ,\n" +
            "       PAM_WNDJ                                                                           pamwndj,\n" +
            "       WNZYDJ\n" +
            "from TF_YWPN_COSTRLWATER_W w\n" +
            "         right join TF_YWPN_COSTRLFIXED_W f\n" +
            "                    on to_char(w.UP_DATE, 'yyyy-mm') = to_char(f.UP_DATE, 'yyyy-mm') and w.MARK = f.MARK\n" +
            "         left join TF_YWPN_COSTRLPRICE_W p\n" +
            "                   on to_char(f.UP_DATE, 'yyyy') = p.YEAR\n" +
            "where f.MARK = 1\n" +
            "  and p.ISNEW = 1\n" +
            "  and to_char(f.UP_DATE, 'yyyy-mm') = #{year}\n" +
            "group by to_char(f.UP_DATE, 'yyyy-mm'), SYDJ, CNDJ, BCSDJ, YLDJ, PAM_ZSDJ, GMSJFHYDJ, FTDJ, PAM_WNDJ, WNZYDJ")
    CostVo viewSumMonthPile(@Param("year") String year);

    @Select("select (PACZFY_ONE + PACZFY_TWO)                                         pacfy,\n" +
            "       to_char(f.UP_DATE, 'yyyy-mm-dd')                                  day,\n" +
            "       JBDF_TOTAL                                                        jbdf,\n" +
            "       DLDF_TOTAL                                                        dldf,\n" +
            "       SZYSF_TOTAL                                                       szysf,\n" +
            "       ZZSCLFY_ONE + ZZSCLFY_TWO                                         zsclzfy,\n" +
            "       ZFY,\n" +
            "       DFCB_TOTAL                                                        dfcb,\n" +
            "       ZSCLCB_TOTAL                                                      zzslccb,\n" +
            "       SZYSFCB_TOTAL                                                     szysfcb,\n" +
            "       DWCB_TOTAL                                                        dwbdcb,\n" +
            "       SYZFY_ONE                                                         syfy,\n" +
            "       CNZFY                                                             cnfy,\n" +
            "       BCSZFY                                                            bcsfy,\n" +
            "       round((PACZFY_ONE + PACZFY_TWO) / nullif(GSL_TOTAL, 0) * 1000, 5) paccb,\n" +
            "       YSF,\n" +
            "       YSFCB,\n" +
            "       SYDJ,\n" +
            "       CNDJ,\n" +
            "       BCSDJ,\n" +
            "       YLZFY_TWO                                                         ylfy,\n" +
            "       PAMZSZFY                                                          pamzs,\n" +
            "       FTZFY                                                             ftfy,\n" +
            "       GMSJFHYZFY                                                        gmsjfy,\n" +
            "       PAMWNZFY                                                          pamwn,\n" +
            "       WNZYF                                                             wnzyfy,\n" +
            "       YLDJ,\n" +
            "       PAM_ZSDJ                                                          pamzsdj,\n" +
            "       GMSJFHYDJ                                                         gmsjdj,\n" +
            "       FTDJ,\n" +
            "       PAM_WNDJ                                                          pamwndj,\n" +
            "       WNZYDJ\n" +
            "from TF_YWPN_COSTRLWATER_W w\n" +
            "         right join TF_YWPN_COSTRLFIXED_W f\n" +
            "                    on w.MARK = f.MARK and to_char(w.UP_DATE, 'yyyy-mm-dd') = to_char(f.UP_DATE, 'yyyy-mm-dd')\n" +
            "         left join TF_YWPN_COSTRLPRICE_W p\n" +
            "                   on to_char(f.UP_DATE, 'yyyy') = p.YEAR\n" +
            "where f.MARK = 0\n" +
            "  and p.ISNEW = 1\n" +
            "  and to_char(f.UP_DATE, 'yyyy-mm') = #{year}\n" +
            "order by f.UP_DATE")
    List<Map<String, Object>> viewSumInfo(@Param("year") String year);
}
