<?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.tofly.xrtygis.mapper.CostrlwaterMapper">

    <resultMap id="costrlwaterMap" type="com.tofly.xrtygis.entity.Costrlwater">
        <id property="id" column="ID"/>
        <result property="upDate" column="UP_DATE"/>
        <result property="gslOne" column="GSL_ONE"/>
        <result property="gslTwo" column="GSL_TWO"/>
        <result property="gslQbj" column="GSL_QBJ"/>
        <result property="gslTotal" column="GSL_TOTAL"/>
        <result property="zslOne" column="ZSL_ONE"/>
        <result property="zslTwo" column="ZSL_TWO"/>
        <result property="zslHqsk" column="ZSL_HQSK"/>
        <result property="zslTotal" column="ZSL_TOTAL"/>
        <result property="sslTotal" column="SSL_TOTAL"/>
        <result property="zyslOne" column="ZYSL_ONE"/>
        <result property="zyslTwo" column="ZYSL_TWO"/>
        <result property="zyslTotal" column="ZYSL_TOTAL"/>
        <result property="zysllOne" column="ZYSLL_ONE"/>
        <result property="zysllTwo" column="ZYSLL_TWO"/>
        <result property="zysllTotal" column="ZYSLL_TOTAL"/>
        <result property="wspsl" column="WSPSL"/>
        <result property="cxc" column="CXC"/>
        <result property="lsl" column="LSL"/>
        <result property="pacOne" column="PAC_ONE"/>
        <result property="pacTwo" column="PAC_TWO"/>
        <result property="syOne" column="SY_ONE"/>
        <result property="ylTwo" column="YL_TWO"/>
        <result property="pam" column="PAM"/>
        <result property="ft" column="FT"/>
        <result property="cn" column="CN"/>
        <result property="gmsjfhy" column="GMSJFHY"/>
        <result property="pamWy" column="PAM_WY"/>
        <result property="bcs" column="BCS"/>
        <result property="wnzl" column="WNZL"/>
        <result property="dldlOne" column="DLDL_ONE"/>
        <result property="dldlTwo" column="DLDL_TWO"/>
        <result property="dldlTotal" column="DLDL_TOTAL"/>
        <result property="jbdlOne" column="JBDL_ONE"/>
        <result property="jbdlTwo" column="JBDL_TWO"/>
        <result property="jbdlTotal" column="JBDL_TOTAL"/>
        <result property="createTime" column="CREATE_TIME"/>
        <result property="createUser" column="CREATE_USER"/>
        <result property="mark" column="MARK"/>
        <result property="other" column="OTHER"/>
        <association property="createUserName" column="CREATE_USER"
                     select="com.tofly.xrtygis.mapper.IFileMapper.getUserName"/>
    </resultMap>
    <!--<![CDATA[ >= ]]>  <![CDATA[ <= ]]>-->
    <!--    GSL_ONE,GSL_TWO,GSL_QBJ,GSL_TOTAL,
                   ZSL_ONE,ZSL_TWO,ZSL_HQSK,ZSL_TOTAL,SSL_TOTAL,ZYSL_ONE,ZYSL_TWO,ZYSL_TOTAL,ZYSLL_ONE,ZYSLL_TWO,ZYSLL_TOTAL,WSPSL-->
    <select id="getWaterDataMonth" resultType="java.util.Map">
        SELECT TO_CHAR(UP_DATE, 'yyyy') YEAR,
               TO_CHAR(UP_DATE, 'yyyy-MM') UP_DATE,
               TO_CHAR(UP_DATE, 'MM') MONTH,
               ${typet}
        FROM TF_YWPN_COSTRLWATER_W
        WHERE MARK = '1'
          AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
          AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear}
        ORDER BY UP_DATE
    </select>
    <!--SUM(GSL_ONE) GSL_ONE ,SUM(GSL_TWO) GSL_TWO, SUM(GSL_QBJ) GSL_QBJ,
                   SUM(GSL_TOTAL) GSL_TOTAL, SUM(ZSL_ONE) ZSL_ONE,  SUM(ZSL_TWO) ZSL_TWO,
                   SUM(ZSL_HQSK) ZSL_HQSK, SUM(ZSL_TOTAL) ZSL_TOTAL, SUM(SSL_TOTAL) SSL_TOTAL,
                   SUM(ZYSL_ONE) ZYSL_ONE, SUM(ZYSL_TWO) ZYSL_TWO, SUM(ZYSL_TOTAL) ZYSL_TOTAL,
                   SUM(ZYSLL_ONE) ZYSLL_ONE, SUM(ZYSLL_TWO) ZYSLL_TWO, SUM(ZYSLL_TOTAL) ZYSLL_TOTAL,
                   SUM(WSPSL) WSPSL-->
    <select id="getWaterDataQuarter" resultType="java.util.Map">
        SELECT SUBSTR(UP_DATE, 1, 4) YEAR, UP_DATE MONTH, ${sumType}
        FROM (SELECT TO_CHAR(UP_DATE, 'yyyy-Q') UP_DATE,
                     ${typet}
              FROM TF_YWPN_COSTRLWATER_W
              WHERE MARK = '1'
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear} )
        GROUP BY UP_DATE
        ORDER BY UP_DATE
    </select>
    <!--SUM(GSL_ONE) GSL_ONE , SUM(GSL_TWO) GSL_TWO, SUM(GSL_QBJ) GSL_QBJ, SUM(GSL_TOTAL) GSL_TOTAL,
                   SUM(ZSL_ONE) ZSL_ONE,  SUM(ZSL_TWO) ZSL_TWO, SUM(ZSL_HQSK) ZSL_HQSK, SUM(ZSL_TOTAL) ZSL_TOTAL,
                   SUM(SSL_TOTAL) SSL_TOTAL, SUM(ZYSL_ONE) ZYSL_ONE, SUM(ZYSL_TWO) ZYSL_TWO, SUM(ZYSL_TOTAL) ZYSL_TOTAL,
                   SUM(ZYSLL_ONE) ZYSLL_ONE, SUM(ZYSLL_TWO) ZYSLL_TWO, SUM(ZYSLL_TOTAL) ZYSLL_TOTAL, SUM(WSPSL) WSPSL-->
    <select id="getWaterDataYear" resultType="java.util.Map">
        SELECT UP_DATE YEAR , ${sumType}
        FROM (SELECT TO_CHAR(UP_DATE, 'yyyy') UP_DATE,
                     ${typet}
              FROM TF_YWPN_COSTRLWATER_W
              WHERE MARK = '1'
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear})
        GROUP BY UP_DATE
        ORDER BY UP_DATE
    </select>

    <select id="getElectricityDataMonth" resultType="java.util.Map">
        SELECT TO_CHAR(UP_DATE, 'yyyy') YEAR,
               TO_CHAR(UP_DATE, 'yyyy-MM') UP_DATE,
               TO_CHAR(UP_DATE, 'MM') MONTH,
               ${typet}
        FROM ${tableName}
        WHERE MARK = '1'
          AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
          AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear}
        ORDER BY UP_DATE
    </select>

    <select id="getElectricityDataQuarter" resultType="java.util.Map">
        SELECT SUBSTR(UP_DATE, 1, 4) YEAR, UP_DATE MONTH, ${sumType}
        FROM (SELECT TO_CHAR(UP_DATE, 'yyyy-Q') UP_DATE, ${typet}
              FROM ${tableName}
              WHERE MARK = '1'
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear})
        GROUP BY UP_DATE
        ORDER BY UP_DATE
    </select>

    <select id="getElectricityDataYear" resultType="java.util.Map">
        SELECT UP_DATE YEAR, ${sumType}
        FROM (SELECT TO_CHAR(UP_DATE, 'yyyy') UP_DATE, ${typet}
              FROM ${tableName}
              WHERE MARK = '1'
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear})
        GROUP BY UP_DATE
        ORDER BY UP_DATE
    </select>

    <select id="getMaterialsDataMonth" resultType="java.util.Map">
        SELECT TO_CHAR(UP_DATE, 'yyyy') YEAR,
               TO_CHAR(UP_DATE, 'yyyy-MM') UP_DATE,
               TO_CHAR(UP_DATE, 'MM') MONTH,
               ${typet}
        FROM TF_YWPN_COSTRLUNIT_W
        WHERE MARK = '1'
          AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
          AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear}
        ORDER BY UP_DATE
    </select>

    <select id="getMaterialsDataQuarter" resultType="java.util.Map">
        SELECT SUBSTR(UP_DATE, 1, 4) YEAR, UP_DATE MONTH, ${sumType}
        FROM (SELECT TO_CHAR(UP_DATE, 'yyyy-Q') UP_DATE, ${typet}
              FROM TF_YWPN_COSTRLUNIT_W
              WHERE MARK = '1'
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear})
        GROUP BY UP_DATE
        ORDER BY UP_DATE
    </select>

    <select id="getMaterialsDataYear" resultType="java.util.Map">
        SELECT UP_DATE YEAR, ${sumType}
        FROM (SELECT TO_CHAR(UP_DATE, 'yyyy') UP_DATE, ${typet}
              FROM TF_YWPN_COSTRLUNIT_W
              WHERE MARK = '1'
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear})
        GROUP BY UP_DATE
        ORDER BY UP_DATE
    </select>

    <select id="getPriceDataMonth" resultType="java.util.Map">
        SELECT YEAR, TO_CHAR(UP_DATE, 'yyyy-MM') CRET_TIME, TO_CHAR(UP_DATE, 'MM') MONTH, ${typet}
        FROM TF_YWPN_COSTRLPRICE_W
        WHERE ID IN (
            SELECT MAX (ID) FROM (SELECT ID
            , TO_CHAR(UP_DATE
            , 'yyyy-MM') CRET_TIME, YEAR FROM TF_YWPN_COSTRLPRICE_W WHERE
            YEAR <![CDATA[ >= ]]> #{startYear}
          and YEAR <![CDATA[ <= ]]> #{endYear} )
            GROUP BY CRET_TIME , YEAR )
        ORDER BY UP_DATE ASC
    </select>
    <select id="getPriceDataQuarter" resultType="java.util.Map">
        SELECT YEAR, TO_CHAR(UP_DATE, 'yyyy-Q') MONTH, ${typet}
        FROM TF_YWPN_COSTRLPRICE_W
        WHERE ID IN (SELECT
            MAX (ID) FROM (SELECT ID
            , YEAR
            , TO_CHAR(UP_DATE
            , 'yyyy-Q') quarter FROM TF_YWPN_COSTRLPRICE_W WHERE
            YEAR <![CDATA[ >= ]]> #{startYear}
          and YEAR <![CDATA[ <= ]]> #{endYear})
          GROUP BY quarter , YEAR )
        ORDER BY UP_DATE ASC
    </select>
    <select id="getPriceDataYear" resultType="java.util.Map">
        SELECT YEAR, TO_CHAR(UP_DATE, 'yyyy-MM') CRET_TIME, ${typet}
        FROM TF_YWPN_COSTRLPRICE_W
        WHERE
            YEAR <![CDATA[ >= ]]> #{startYear}
          and YEAR <![CDATA[ <= ]]> #{endYear}
          and ISNEW = '1'
        ORDER BY UP_DATE ASC
    </select>


    <select id="getProduceDataYearReality" resultMap="costrlwaterMap2">
        SELECT UP_DATE,
               nvl(SUM(GSL_ONE)    ,0) GSL_ONE,
               nvl(SUM(GSL_TWO)    ,0) GSL_TWO,
               nvl(SUM(GSL_QBJ)    ,0) GSL_QBJ,
               nvl(SUM(GSL_TOTAL)  ,0) GSL_TOTAL,
               nvl(SUM(ZSL_ONE)    ,0) ZSL_ONE,
               nvl(SUM(ZSL_TWO)    ,0) ZSL_TWO,
               nvl(SUM(ZSL_HQSK)   ,0) ZSL_HQSK,
               nvl(SUM(ZSL_TOTAL)  ,0) ZSL_TOTAL,
               nvl(SUM(SSL_TOTAL)  ,0) SSL_TOTAL,
               nvl(SUM(ZYSL_ONE)   ,0) ZYSL_ONE,
               nvl(SUM(ZYSL_TWO)   ,0) ZYSL_TWO,
               nvl(SUM(ZYSL_TOTAL) ,0) ZYSL_TOTAL,
               nvl(SUM(ZYSLL_ONE)  ,0) ZYSLL_ONE,
               nvl(SUM(ZYSLL_TWO)  ,0) ZYSLL_TWO,
               nvl(SUM(ZYSLL_TOTAL),0) ZYSLL_TOTAL,
               nvl(SUM(WSPSL)      ,0) WSPSL,
               nvl(SUM(CXC)        ,0) CXC,
               nvl(SUM(LSL)        ,0) LSL
        FROM (SELECT TO_CHAR(UP_DATE, 'yyyy') UP_DATE,
                     GSL_ONE,
                     GSL_TWO,
                     GSL_QBJ,
                     GSL_TOTAL,
                     ZSL_ONE,
                     ZSL_TWO,
                     ZSL_HQSK,
                     ZSL_TOTAL,
                     SSL_TOTAL,
                     ZYSL_ONE,
                     ZYSL_TWO,
                     ZYSL_TOTAL,
                     ZYSLL_ONE,
                     ZYSLL_TWO,
                     ZYSLL_TOTAL,
                     WSPSL,
                     CXC,
                     LSL
              FROM TF_YWPN_COSTRLWATER_W
              WHERE TO_CHAR(UP_DATE, 'yyyy') IN (${startYear})
                and MARK = '1')
        GROUP BY UP_DATE
    </select>
    <select id="getProduceDataMonthByYearReality" resultMap="costrlwaterMap2">
        SELECT TO_CHAR(UP_DATE, 'yyyy-MM') UP_DATE,
               GSL_ONE,
               GSL_TWO,
               GSL_QBJ,
               GSL_TOTAL,
               ZSL_ONE,
               ZSL_TWO,
               ZSL_HQSK,
               ZSL_TOTAL,
               SSL_TOTAL,
               ZYSL_ONE,
               ZYSL_TWO,
               ZYSL_TOTAL,
               ZYSLL_ONE,
               ZYSLL_TWO,
               ZYSLL_TOTAL,
               WSPSL,
               CXC,
               LSL
        FROM TF_YWPN_COSTRLWATER_W
        WHERE TO_CHAR(UP_DATE, 'yyyy') = #{year}
          and MARK = '1'
    </select>
    <select id="getProduceDataMonthReality" resultMap="costrlwaterMap2">
        SELECT TO_CHAR(UP_DATE, 'yyyy-MM')
                   UP_DATE,
               GSL_ONE,
               GSL_TWO,
               GSL_QBJ,
               GSL_TOTAL,
               ZSL_ONE,
               ZSL_TWO,
               ZSL_HQSK,
               ZSL_TOTAL,
               SSL_TOTAL,
               ZYSL_ONE,
               ZYSL_TWO,
               ZYSL_TOTAL,
               ZYSLL_ONE,
               ZYSLL_TWO,
               ZYSLL_TOTAL,
               WSPSL,
               CXC,
               LSL
        FROM TF_YWPN_COSTRLWATER_W
        WHERE TO_CHAR(UP_DATE, 'yyyy') IN (${year})
          and TO_CHAR(UP_DATE, 'MM') IN (${month})
          and MARK = '1'
    </select>
    <select id="getQuarterDataOffer" resultType="java.util.Map">
        SELECT QUARTER, SUBSTR(QUARTER, -1) NUM, nvl(SUM(ONE) , 0) ONE,nvl(SUM(TWO) , 0)  TWO, nvl(SUM(TOTAL) , 0) TOTAL
        FROM (SELECT TO_CHAR(UP_DATE, 'yyyy-Q') QUARTER, GSL_ONE ONE, GSL_TWO TWO, GSL_TOTAL TOTAL
              FROM TF_YWPN_COSTRLWATER_W
              WHERE TO_CHAR(UP_DATE, 'yyyy') = #{year}
                and MARK = '1')
        GROUP BY QUARTER
        ORDER BY QUARTER
    </select>
    <select id="getMonthDataOffer" resultType="java.util.Map">
        SELECT TO_CHAR(UP_DATE, 'yyyy') YEAR, TO_CHAR(UP_DATE, 'MM') MONTH, nvl(GSL_ONE , 0) ONE,
               nvl(GSL_TWO , 0) TWO, nvl(GSL_TOTAL , 0) TOTAL
        FROM TF_YWPN_COSTRLWATER_W
        WHERE TO_CHAR(UP_DATE, 'yyyy') = #{year}
          and TO_CHAR(UP_DATE, 'MM') = #{month}
          and MARK = '1'
    </select>
    <select id="getYearDataOffer" resultType="java.util.Map">
        SELECT TO_CHAR(UP_DATE, 'yyyy') YEAR, TO_CHAR(UP_DATE, 'MM') MONTH, nvl(GSL_ONE , 0) ONE,
               nvl(GSL_TWO , 0) TWO, nvl(GSL_TOTAL , 0) TOTAL
        FROM TF_YWPN_COSTRLWATER_W
        WHERE TO_CHAR(UP_DATE, 'yyyy') = #{year}
          and MARK = '1'
        ORDER BY MONTH
    </select>

    <resultMap id="costrlwaterMap2" type="com.tofly.xrtygis.custom.entity.dataquery.WaterReality">
        <id property="id" column="ID"/>
        <result property="upDate" column="UP_DATE"/>
        <result property="gslOne" column="GSL_ONE"/>
        <result property="gslTwo" column="GSL_TWO"/>
        <result property="gslQbj" column="GSL_QBJ"/>
        <result property="gslTotal" column="GSL_TOTAL"/>
        <result property="zslOne" column="ZSL_ONE"/>
        <result property="zslTwo" column="ZSL_TWO"/>
        <result property="zslHqsk" column="ZSL_HQSK"/>
        <result property="zslTotal" column="ZSL_TOTAL"/>
        <result property="sslTotal" column="SSL_TOTAL"/>
        <result property="zyslOne" column="ZYSL_ONE"/>
        <result property="zyslTwo" column="ZYSL_TWO"/>
        <result property="zyslTotal" column="ZYSL_TOTAL"/>
        <result property="zysllOne" column="ZYSLL_ONE"/>
        <result property="zysllTwo" column="ZYSLL_TWO"/>
        <result property="zysllTotal" column="ZYSLL_TOTAL"/>
        <result property="wspsl" column="WSPSL"/>
        <result property="cxc" column="CXC"/>
        <result property="lsl" column="LSL"/>
        <result property="pacOne" column="PAC_ONE"/>
        <result property="pacTwo" column="PAC_TWO"/>
        <result property="syOne" column="SY_ONE"/>
        <result property="ylTwo" column="YL_TWO"/>
        <result property="pam" column="PAM"/>
        <result property="ft" column="FT"/>
        <result property="cn" column="CN"/>
        <result property="gmsjfhy" column="GMSJFHY"/>
        <result property="pamWy" column="PAM_WY"/>
        <result property="bcs" column="BCS"/>
        <result property="wnzl" column="WNZL"/>
        <result property="dldlOne" column="DLDL_ONE"/>
        <result property="dldlTwo" column="DLDL_TWO"/>
        <result property="dldlTotal" column="DLDL_TOTAL"/>
        <result property="jbdlOne" column="JBDL_ONE"/>
        <result property="jbdlTwo" column="JBDL_TWO"/>
        <result property="jbdlTotal" column="JBDL_TOTAL"/>
        <result property="createTime" column="CREATE_TIME"/>
        <result property="createUser" column="CREATE_USER"/>
        <result property="mark" column="MARK"/>
    </resultMap>

    <select id="getWaterDataMonthTwo" resultType="java.util.Map">
        SELECT TO_CHAR(UP_DATE, 'yyyy') YEAR,
               TO_CHAR(UP_DATE, 'yyyy-MM') UP_DATE,
               TO_CHAR(UP_DATE, 'MM') MONTH,
               nvl(${typet}, 0)            reslutData
        FROM TF_YWPN_COSTRLWATER_W
        WHERE MARK = '1'
          AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
          AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear}
        ORDER BY UP_DATE
    </select>
    <select id="getWaterDataQuarterTwo" resultType="java.util.Map">
        SELECT SUBSTR(UP_DATE, 1, 4) YEAR, UP_DATE MONTH, nvl(SUM(${typet}), 0) reslutData
        FROM (SELECT TO_CHAR(UP_DATE, 'yyyy-Q') UP_DATE,
                     ${typet}
              FROM TF_YWPN_COSTRLWATER_W
              WHERE MARK = '1'
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear} )
        GROUP BY UP_DATE
        ORDER BY UP_DATE
    </select>
    <select id="getWaterDataYearTwo" resultType="java.util.Map">
        SELECT UP_DATE YEAR, nvl(SUM(${typet}), 0) reslutData
        FROM (SELECT TO_CHAR(UP_DATE, 'yyyy') UP_DATE,
                     ${typet}
              FROM TF_YWPN_COSTRLWATER_W
              WHERE MARK = '1'
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear})
        GROUP BY UP_DATE
        ORDER BY UP_DATE
    </select>
    <select id="getElectricityDataMonthTwo" resultType="java.util.Map">
        SELECT TO_CHAR(UP_DATE, 'yyyy') YEAR,
               TO_CHAR(UP_DATE, 'yyyy-MM') UP_DATE,
               TO_CHAR(UP_DATE, 'MM') MONTH,
               nvl(${typet}, 0)            reslutData
        FROM ${tableName}
        WHERE MARK = '1'
          AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
          AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear}
        ORDER BY UP_DATE
    </select>
    <select id="getElectricityDataQuarterTwo" resultType="java.util.Map">
        SELECT SUBSTR(UP_DATE, 1, 4) YEAR, UP_DATE MONTH, nvl(SUM(${typet}), 0) reslutData
        FROM (SELECT TO_CHAR(UP_DATE, 'yyyy-Q') UP_DATE, nvl(${typet}, 0) ${typet}
              FROM ${tableName}
              WHERE MARK = '1'
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear})
        GROUP BY UP_DATE
        ORDER BY UP_DATE
    </select>
    <select id="getElectricityDataYearTwo" resultType="java.util.Map">
        SELECT UP_DATE YEAR, nvl(SUM(${typet}), 0) reslutData
        FROM (SELECT TO_CHAR(UP_DATE, 'yyyy') UP_DATE, nvl(${typet}, 0) ${typet}
              FROM ${tableName}
              WHERE MARK = '1'
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear})
        GROUP BY UP_DATE
        ORDER BY UP_DATE
    </select>
    <select id="getMaterialsDataMonthTwo" resultType="java.util.Map">
        SELECT TO_CHAR(UP_DATE, 'yyyy') YEAR,
               TO_CHAR(UP_DATE, 'yyyy-MM') UP_DATE,
               TO_CHAR(UP_DATE, 'MM') MONTH,
               nvl(${typet}, 0)            reslutData
        FROM TF_YWPN_COSTRLUNIT_W
        WHERE MARK = '1'
          AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
          AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear}
        ORDER BY UP_DATE
    </select>
    <select id="getMaterialsDataQuarterTwo" resultType="java.util.Map">
        SELECT SUBSTR(UP_DATE, 1, 4) YEAR, UP_DATE MONTH, nvl(SUM(${typet}), 0) reslutData
        FROM (SELECT TO_CHAR(UP_DATE, 'yyyy-Q') UP_DATE, ${typet}
              FROM TF_YWPN_COSTRLUNIT_W
              WHERE MARK = '1'
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear})
        GROUP BY UP_DATE
        ORDER BY UP_DATE
    </select>
    <select id="getMaterialsDataYearTwo" resultType="java.util.Map">
        SELECT UP_DATE YEAR, nvl(SUM(${typet}), 0) reslutData
        FROM (SELECT TO_CHAR(UP_DATE, 'yyyy') UP_DATE, ${typet}
              FROM TF_YWPN_COSTRLUNIT_W
              WHERE MARK = '1'
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ <= ]]> #{endYear}
                AND TO_CHAR(UP_DATE, 'yyyy') <![CDATA[ >= ]]> #{startYear})
        GROUP BY UP_DATE
        ORDER BY UP_DATE
    </select>
    <select id="getPriceDataMonthTwo" resultType="java.util.Map">
        SELECT YEAR, TO_CHAR(UP_DATE, 'yyyy-MM') CRET_TIME, TO_CHAR(UP_DATE, 'MM') MONTH, nvl(${typet}, 0) reslutData
        FROM TF_YWPN_COSTRLPRICE_W
        WHERE ID IN (
            SELECT MAX (ID) FROM (SELECT ID
            , TO_CHAR(UP_DATE
            , 'yyyy-MM') UP_DATE , YEAR FROM TF_YWPN_COSTRLPRICE_W WHERE
            YEAR <![CDATA[ >= ]]> #{startYear}
          and YEAR <![CDATA[ <= ]]> #{endYear} )
            GROUP BY UP_DATE , YEAR )
        ORDER BY UP_DATE ASC
    </select>
    <select id="getPriceDataQuarterTwo" resultType="java.util.Map">
        SELECT YEAR, TO_CHAR(UP_DATE, 'yyyy-Q') MONTH, nvl(${typet}, 0) reslutData
        FROM TF_YWPN_COSTRLPRICE_W
        WHERE ID IN (SELECT
            MAX (ID) FROM ( SELECT ID
            , YEAR
            , TO_CHAR(UP_DATE
            , 'yyyy-Q') quarter FROM TF_YWPN_COSTRLPRICE_W WHERE
            YEAR <![CDATA[ >= ]]> #{startYear}
          and YEAR <![CDATA[ <= ]]> #{endYear})
            GROUP BY quarter , YEAR )
        ORDER BY UP_DATE ASC
    </select>
    <select id="getPriceDataYearTwo" resultType="java.util.Map">
        SELECT YEAR, TO_CHAR(UP_DATE, 'yyyy-MM') CRET_TIME, nvl(${typet}, 0) reslutData
        FROM TF_YWPN_COSTRLPRICE_W
        WHERE
            YEAR <![CDATA[ >= ]]> #{startYear}
          and YEAR <![CDATA[ <= ]]> #{endYear}
          and ISNEW = '1'
        ORDER BY UP_DATE ASC
    </select>

</mapper>
