McBasicMoneyMapper.xml 27.1 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.chinagas.modules.schsf.mapper.McBasicMoneyMapper">

    <resultMap type="com.chinagas.modules.schsf.domain.McBasicMoney" id="McBasicMoneyResult">
        <result property="id"    column="id"    />
        <result property="fiscalYear"    column="fiscal_year"    />
        <result property="regionName"    column="region_name"    />
        <result property="groupName"    column="group_name"    />
        <result property="companyName"    column="company_name"    />
        <result property="companyCode"    column="company_code"    />
        <result property="province"    column="province"    />
        <result property="city"    column="city"    />
        <result property="district"    column="district"    />
        <result property="street"    column="street"    />
        <result property="vlgOrCmty"    column="vlg_or_cmty"    />
        <result property="respPerson"    column="resp_person"    />
        <result property="urbRurCls"    column="urb_rur_cls"    />
        <result property="budgConfPrev"    column="budg_conf_prev"    />
        <result property="budgConfNew"    column="budg_conf_new"    />
        <result property="budgTotal"    column="budg_total"    />
        <result property="quarterlyTarget"    column="quarterly_target"    />
        <result property="cnyGsgCharged"    column="cny_gsg_charged"    />
        <result property="cnyGsgUncharged"    column="cny_gsg_uncharged"    />
        <result property="cnyGsgTotal"    column="cny_gsg_total"    />
        <result property="cnyYrFull"    column="cny_yr_full"    />
        <result property="cnyYrInstal"    column="cny_yr_instal"    />
        <result property="cnyPrevFull"    column="cny_prev_full"    />
        <result property="cnyPrevInstall"    column="cny_prev_install"    />
        <result property="cnyMarketCumr"    column="cny_market_cumr"    />
        <result property="cnyFyCumReturn"    column="cny_fy_cum_return"    />
        <result property="cnyFpCumReturn"    column="cny_fp_cum_return"    />
        <result property="cnyInstCumReturn"    column="cny_inst_cum_return"    />
        <result property="cnyNewCumReturn"    column="cny_new_cum_return"    />
        <result property="cnyRcvblsCumReturn"    column="cny_rcvbls_cum_return"    />
        <result property="cnyBdgtCmplRate"    column="cny_bdgt_cmpl_rate"    />
        <result property="cnyRcvblsCmplRate"    column="cny_rcvbls_cmpl_rate"    />
        <result property="cnyCynCmplRate"    column="cny_cyn_cmpl_rate"    />
        <result property="cnyPtCmplRate"    column="cny_pt_cmpl_rate"    />
        <result property="remark"    column="remark"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="defFlag"    column="def_flag"    />
    </resultMap>

    <sql id="selectMcBasicMoneyVo">
        select t.id, t.fiscal_year, t.region_name, t.group_name, t.company_name, t.company_code, t.province,
               t.city, t.district, t.street, t.vlg_or_cmty, t.resp_person, t.urb_rur_cls, t.budg_conf_prev,
               t.budg_conf_new, t.budg_total, t.quarterly_target, t.cny_gsg_charged, t.cny_gsg_uncharged,
               t.cny_gsg_total, t.cny_yr_full, t.cny_yr_instal, t.cny_prev_full,
               t.cny_prev_install, t.cny_market_cumr, t.cny_fy_cum_return,
               t.cny_fp_cum_return, t.cny_inst_cum_return, t.cny_new_cum_return,
               t.cny_rcvbls_cum_return, t.cny_bdgt_cmpl_rate,
               t.cny_rcvbls_cmpl_rate, t.cny_cyn_cmpl_rate,
               t.cny_pt_cmpl_rate, t.remark, t.create_time, t.create_by,
               t.update_time, t.update_by, t.def_flag
        from mc_basic_money t
        left join sys_user u on u.user_id = t.create_by
        left join sys_dept d on d.dept_id = t.company_code
    </sql>

    <select id="selectMcBasicMoneyList" parameterType="com.chinagas.modules.schsf.domain.vo.McBasicMoneyVo" resultMap="McBasicMoneyResult">
        <include refid="selectMcBasicMoneyVo"/>
        <where>
            <if test="fiscalYear != null "> and t.fiscal_year = #{fiscalYear}</if>
            <if test="regionName != null  and regionName != ''"> and t.region_name like concat('%', #{regionName}, '%')</if>
            <if test="groupName != null  and groupName != ''"> and t.group_name like concat('%', #{groupName}, '%')</if>
            <if test="companyName != null  and companyName != ''"> and t.company_name like concat('%', #{companyName}, '%')</if>
            <if test="companyCode != null  and companyCode != ''"> and t.company_code = #{companyCode}</if>
            <if test="province != null  and province != ''"> and t.province = #{province}</if>
            <if test="city != null  and city != ''"> and t.city = #{city}</if>
            <if test="district != null  and district != ''"> and t.district = #{district}</if>
            <if test="street != null  and street != ''"> and t.street = #{street}</if>
            <if test="vlgOrCmty != null  and vlgOrCmty != ''"> and t.vlg_or_cmty = #{vlgOrCmty}</if>
            <if test="respPerson != null  and respPerson != ''"> and t.resp_person = #{respPerson}</if>
            <if test="urbRurCls != null  and urbRurCls != ''"> and t.urb_rur_cls = #{urbRurCls}</if>
            <if test="budgConfPrev != null "> and t.budg_conf_prev = #{budgConfPrev}</if>
            <if test="budgConfNew != null "> and t.budg_conf_new = #{budgConfNew}</if>
            <if test="budgTotal != null "> and t.budg_total = #{budgTotal}</if>
            <if test="quarterlyTarget != null "> and t.quarterly_target = #{quarterlyTarget}</if>
            <if test="cnyGsgCharged != null "> and t.cny_gsg_charged = #{cnyGsgCharged}</if>
            <if test="cnyGsgUncharged != null "> and t.cny_gsg_uncharged = #{cnyGsgUncharged}</if>
            <if test="cnyGsgTotal != null "> and t.cny_gsg_total = #{cnyGsgTotal}</if>
            <if test="cnyYrFull != null "> and t.cny_yr_full = #{cnyYrFull}</if>
            <if test="cnyYrInstal != null "> and t.cny_yr_instal = #{cnyYrInstal}</if>
            <if test="cnyPrevFull != null "> and t.cny_prev_full = #{cnyPrevFull}</if>
            <if test="cnyPrevInstall != null "> and t.cny_prev_install = #{cnyPrevInstall}</if>
            <if test="cnyMarketCumr != null "> and t.cny_market_cumr = #{cnyMarketCumr}</if>
            <if test="cnyFyCumReturn != null "> and t.cny_fy_cum_return = #{cnyFyCumReturn}</if>
            <if test="cnyFpCumReturn != null "> and t.cny_fp_cum_return = #{cnyFpCumReturn}</if>
            <if test="cnyInstCumReturn != null "> and t.cny_inst_cum_return = #{cnyInstCumReturn}</if>
            <if test="cnyNewCumReturn != null "> and t.cny_new_cum_return = #{cnyNewCumReturn}</if>
            <if test="cnyRcvblsCumReturn != null "> and t.cny_rcvbls_cum_return = #{cnyRcvblsCumReturn}</if>
            <if test="cnyBdgtCmplRate != null "> and t.cny_bdgt_cmpl_rate = #{cnyBdgtCmplRate}</if>
            <if test="cnyRcvblsCmplRate != null "> and t.cny_rcvbls_cmpl_rate = #{cnyRcvblsCmplRate}</if>
            <if test="cnyCynCmplRate != null "> and t.cny_cyn_cmpl_rate = #{cnyCynCmplRate}</if>
            <if test="cnyPtCmplRate != null "> and t.cny_pt_cmpl_rate = #{cnyPtCmplRate}</if>
            <if test="defFlag != null  and defFlag != ''"> and t.def_flag = #{defFlag}</if>
            <if test="startFiscalYear != null  and startFiscalYear != ''"> and t.fiscal_year &gt;= #{startFiscalYear}</if>
            <if test="finishFiscalYear != null  and finishFiscalYear != ''"> and t.fiscal_year &lt;= #{finishFiscalYear}</if>
            <!-- 数据范围过滤 -->
            ${params.dataScope}
        </where>
        order by t.update_time desc
    </select>

    <select id="selectMcBasicMoneyById" parameterType="Long" resultMap="McBasicMoneyResult">
        <include refid="selectMcBasicMoneyVo"/>
        where id = #{id}
    </select>

    <insert id="insertMcBasicMoney" parameterType="com.chinagas.modules.schsf.domain.McBasicMoney">
        insert into mc_basic_money
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="fiscalYear != null">fiscal_year,</if>
            <if test="regionName != null and regionName != ''">region_name,</if>
            <if test="groupName != null and groupName != ''">group_name,</if>
            <if test="companyName != null and companyName != ''">company_name,</if>
            <if test="companyCode != null and companyCode != ''">company_code,</if>
            <if test="province != null">province,</if>
            <if test="city != null">city,</if>
            <if test="district != null">district,</if>
            <if test="street != null">street,</if>
            <if test="vlgOrCmty != null">vlg_or_cmty,</if>
            <if test="respPerson != null">resp_person,</if>
            <if test="urbRurCls != null">urb_rur_cls,</if>
            <if test="budgConfPrev != null">budg_conf_prev,</if>
            <if test="budgConfNew != null">budg_conf_new,</if>
            <if test="budgTotal != null">budg_total,</if>
            <if test="quarterlyTarget != null">quarterly_target,</if>
            <if test="cnyGsgCharged != null">cny_gsg_charged,</if>
            <if test="cnyGsgUncharged != null">cny_gsg_uncharged,</if>
            <if test="cnyGsgTotal != null">cny_gsg_total,</if>
            <if test="cnyYrFull != null">cny_yr_full,</if>
            <if test="cnyYrInstal != null">cny_yr_instal,</if>
            <if test="cnyPrevFull != null">cny_prev_full,</if>
            <if test="cnyPrevInstall != null">cny_prev_install,</if>
            <if test="cnyMarketCumr != null">cny_market_cumr,</if>
            <if test="cnyFyCumReturn != null">cny_fy_cum_return,</if>
            <if test="cnyFpCumReturn != null">cny_fp_cum_return,</if>
            <if test="cnyInstCumReturn != null">cny_inst_cum_return,</if>
            <if test="cnyNewCumReturn != null">cny_new_cum_return,</if>
            <if test="cnyRcvblsCumReturn != null">cny_rcvbls_cum_return,</if>
            <if test="cnyBdgtCmplRate != null">cny_bdgt_cmpl_rate,</if>
            <if test="cnyRcvblsCmplRate != null">cny_rcvbls_cmpl_rate,</if>
            <if test="cnyCynCmplRate != null">cny_cyn_cmpl_rate,</if>
            <if test="cnyPtCmplRate != null">cny_pt_cmpl_rate,</if>
            <if test="remark != null">remark,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null and createBy != ''">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null and updateBy != ''">update_by,</if>
            <if test="defFlag != null and defFlag != ''">def_flag,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="fiscalYear != null">#{fiscalYear},</if>
            <if test="regionName != null and regionName != ''">#{regionName},</if>
            <if test="groupName != null and groupName != ''">#{groupName},</if>
            <if test="companyName != null and companyName != ''">#{companyName},</if>
            <if test="companyCode != null and companyCode != ''">#{companyCode},</if>
            <if test="province != null">#{province},</if>
            <if test="city != null">#{city},</if>
            <if test="district != null">#{district},</if>
            <if test="street != null">#{street},</if>
            <if test="vlgOrCmty != null">#{vlgOrCmty},</if>
            <if test="respPerson != null">#{respPerson},</if>
            <if test="urbRurCls != null">#{urbRurCls},</if>
            <if test="budgConfPrev != null">#{budgConfPrev},</if>
            <if test="budgConfNew != null">#{budgConfNew},</if>
            <if test="budgTotal != null">#{budgTotal},</if>
            <if test="quarterlyTarget != null">#{quarterlyTarget},</if>
            <if test="cnyGsgCharged != null">#{cnyGsgCharged},</if>
            <if test="cnyGsgUncharged != null">#{cnyGsgUncharged},</if>
            <if test="cnyGsgTotal != null">#{cnyGsgTotal},</if>
            <if test="cnyYrFull != null">#{cnyYrFull},</if>
            <if test="cnyYrInstal != null">#{cnyYrInstal},</if>
            <if test="cnyPrevFull != null">#{cnyPrevFull},</if>
            <if test="cnyPrevInstall != null">#{cnyPrevInstall},</if>
            <if test="cnyMarketCumr != null">#{cnyMarketCumr},</if>
            <if test="cnyFyCumReturn != null">#{cnyFyCumReturn},</if>
            <if test="cnyFpCumReturn != null">#{cnyFpCumReturn},</if>
            <if test="cnyInstCumReturn != null">#{cnyInstCumReturn},</if>
            <if test="cnyNewCumReturn != null">#{cnyNewCumReturn},</if>
            <if test="cnyRcvblsCumReturn != null">#{cnyRcvblsCumReturn},</if>
            <if test="cnyBdgtCmplRate != null">#{cnyBdgtCmplRate},</if>
            <if test="cnyRcvblsCmplRate != null">#{cnyRcvblsCmplRate},</if>
            <if test="cnyCynCmplRate != null">#{cnyCynCmplRate},</if>
            <if test="cnyPtCmplRate != null">#{cnyPtCmplRate},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null and createBy != ''">#{createBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateBy != null and updateBy != ''">#{updateBy},</if>
            <if test="defFlag != null and defFlag != ''">#{defFlag},</if>
         </trim>
    </insert>

    <update id="updateMcBasicMoney" parameterType="com.chinagas.modules.schsf.domain.McBasicMoney">
        update mc_basic_money
        <trim prefix="SET" suffixOverrides=",">
            <if test="fiscalYear != null">fiscal_year = #{fiscalYear},</if>
            <if test="regionName != null and regionName != ''">region_name = #{regionName},</if>
            <if test="groupName != null and groupName != ''">group_name = #{groupName},</if>
            <if test="companyName != null and companyName != ''">company_name = #{companyName},</if>
            <if test="companyCode != null and companyCode != ''">company_code = #{companyCode},</if>
            <if test="province != null">province = #{province},</if>
            <if test="city != null">city = #{city},</if>
            <if test="district != null">district = #{district},</if>
            <if test="street != null">street = #{street},</if>
            <if test="vlgOrCmty != null">vlg_or_cmty = #{vlgOrCmty},</if>
            <if test="respPerson != null">resp_person = #{respPerson},</if>
            <if test="urbRurCls != null">urb_rur_cls = #{urbRurCls},</if>
            <if test="budgConfPrev != null">budg_conf_prev = #{budgConfPrev},</if>
            <if test="budgConfNew != null">budg_conf_new = #{budgConfNew},</if>
            <if test="budgTotal != null">budg_total = #{budgTotal},</if>
            <if test="quarterlyTarget != null">quarterly_target = #{quarterlyTarget},</if>
            <if test="cnyGsgCharged != null">cny_gsg_charged = #{cnyGsgCharged},</if>
            <if test="cnyGsgUncharged != null">cny_gsg_uncharged = #{cnyGsgUncharged},</if>
            <if test="cnyGsgTotal != null">cny_gsg_total = #{cnyGsgTotal},</if>
            <if test="cnyYrFull != null">cny_yr_full = #{cnyYrFull},</if>
            <if test="cnyYrInstal != null">cny_yr_instal = #{cnyYrInstal},</if>
            <if test="cnyPrevFull != null">cny_prev_full = #{cnyPrevFull},</if>
            <if test="cnyPrevInstall != null">cny_prev_install = #{cnyPrevInstall},</if>
            <if test="cnyMarketCumr != null">cny_market_cumr = #{cnyMarketCumr},</if>
            <if test="cnyFyCumReturn != null">cny_fy_cum_return = #{cnyFyCumReturn},</if>
            <if test="cnyFpCumReturn != null">cny_fp_cum_return = #{cnyFpCumReturn},</if>
            <if test="cnyInstCumReturn != null">cny_inst_cum_return = #{cnyInstCumReturn},</if>
            <if test="cnyNewCumReturn != null">cny_new_cum_return = #{cnyNewCumReturn},</if>
            <if test="cnyRcvblsCumReturn != null">cny_rcvbls_cum_return = #{cnyRcvblsCumReturn},</if>
            <if test="cnyBdgtCmplRate != null">cny_bdgt_cmpl_rate = #{cnyBdgtCmplRate},</if>
            <if test="cnyRcvblsCmplRate != null">cny_rcvbls_cmpl_rate = #{cnyRcvblsCmplRate},</if>
            <if test="cnyCynCmplRate != null">cny_cyn_cmpl_rate = #{cnyCynCmplRate},</if>
            <if test="cnyPtCmplRate != null">cny_pt_cmpl_rate = #{cnyPtCmplRate},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            <if test="defFlag != null and defFlag != ''">def_flag = #{defFlag},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteMcBasicMoneyById" parameterType="Long">
        delete from mc_basic_money where id = #{id}
    </delete>

    <delete id="deleteMcBasicMoneyByIds" parameterType="String">
        delete from mc_basic_money where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

    <select id="selectMcBasicMoneyByData" resultMap="McBasicMoneyResult" parameterType="com.chinagas.modules.schsf.domain.McBasicMoney">
        <include refid="selectMcBasicMoneyVo"/>
        where 1=1
        and t.fiscal_year = #{fiscalYear}
        and t.region_name = #{regionName}
        and t.group_name =  #{groupName}
        and t.company_name = #{companyName}
        and t.company_code = #{companyCode}
        and t.province = #{province}
        and t.city = #{city}
        and t.district = #{district}
        and t.street = #{street}
        and t.vlg_or_cmty = #{vlgOrCmty}
    </select>

    <select id="selectMcBasicMoneySummaryList"  parameterType="com.chinagas.modules.schsf.domain.vo.McBasicMoneyVo" resultMap="McBasicMoneyResult">
        SELECT d.id, d.fiscal_year, d.region_name, d.group_name, d.company_name, d.company_code, d.province, d.city, d.district, d.street, d.vlg_or_cmty, d.resp_person, d.urb_rur_cls, d.budg_conf_prev, d.budg_conf_new, d.budg_total, d.quarterly_target, d.cny_gsg_charged, d.cny_gsg_uncharged, d.cny_gsg_total,
        d.cny_yr_full	,d.cny_yr_instal	,d.cny_prev_full	,d.cny_prev_install,
        (d.cny_yr_full+d.cny_yr_instal+d.cny_prev_full+d.cny_prev_install) AS cny_market_cumr,
        (d.cny_yr_full+d.cny_yr_instal+d.cny_prev_full+d.cny_prev_install+ IFNULL(d.cny_gsg_charged,0)) AS cny_fy_cum_return,
        (d.cny_yr_full+d.cny_prev_full) AS cny_fp_cum_return,
        (d.cny_yr_instal+d.cny_prev_install) AS cny_inst_cum_return,
        (d.cny_yr_full+d.cny_yr_instal) AS cny_new_cum_return,
        (d.cny_prev_full+d.cny_prev_install) AS cny_rcvbls_cum_return,
        (d.cny_yr_full+d.cny_yr_instal+d.cny_prev_full+d.cny_prev_install+ IFNULL(d.cny_gsg_charged,0)) / d.budg_total as cny_bdgt_cmpl_rate,
        (d.cny_prev_full+d.cny_prev_install) / IFNULL(d.budg_conf_prev,0)  as cny_rcvbls_cmpl_rate,
        (d.cny_yr_full+d.cny_yr_instal) / IFNULL(d.budg_conf_new,0) as cny_cyn_cmpl_rate,
        IFNULL(d.quarterly_target,0) / (d.cny_yr_full+d.cny_yr_instal+d.cny_prev_full+d.cny_prev_install+ IFNULL(d.cny_gsg_charged,0)) as cny_pt_cmpl_rate
        FROM (
                SELECT
                t.update_time,
                t.id,
                t.fiscal_year,
                t.region_name,
                t.group_name,
                t.company_name,
                t.company_code,
                t.province,
                t.city,
                t.district,
                t.street,
                t.vlg_or_cmty,
                t.resp_person,
                t.urb_rur_cls,
                t.budg_conf_prev,
                t.budg_conf_new,
                (IFNULL(t.budg_conf_prev,0) + IFNULL(t.budg_conf_new,0)) AS budg_total,
                t.quarterly_target,
                t.cny_gsg_charged,
                t.cny_gsg_uncharged,
                (IFNULL(t.cny_gsg_charged,0) + IFNULL(t.cny_gsg_uncharged,0)) AS cny_gsg_total,
                (IFNULL(t.cny_yr_full,0) + IFNULL(bnqk.cny_yr_full,0)) AS cny_yr_full,
                (IFNULL(t.cny_yr_instal,0) + IFNULL(bnfq.cny_yr_instal,0)) AS cny_yr_instal,
                (
                SELECT IFNULL(SUM(visit.charge_amt),0) + IFNULL(t.cny_prev_full,0)
                FROM mc_visit visit	WHERE visit.charge_type='2' 	AND visit.is_charged='Y'
                AND visit.company_code=t.company_code AND visit.urb_rur_cls=t.urb_rur_cls
                AND visit.user_province=t.province AND visit.user_city=t.city
                AND visit.user_district=t.district AND visit.user_street=t.street
                AND visit.vlg_or_cmty=t.vlg_or_cmty AND visit.fiscal_year &lt; t.fiscal_year
                ) AS cny_prev_full,
                (
                SELECT IFNULL(SUM(visit.charge_amt),0) + IFNULL(t.cny_prev_install,0)
                FROM mc_visit visit	WHERE visit.charge_type in ("1","4")  	AND visit.is_charged='Y'
                AND visit.company_code=t.company_code AND visit.urb_rur_cls=t.urb_rur_cls
                AND visit.user_province=t.province AND visit.user_city=t.city
                AND visit.user_district=t.district AND visit.user_street=t.street
                AND visit.vlg_or_cmty=t.vlg_or_cmty AND visit.fiscal_year &lt; t.fiscal_year
                ) AS cny_prev_install
                FROM mc_basic_money t
                LEFT JOIN (
                        SELECT fiscal_year, company_code, urb_rur_cls,
                        user_province, user_city, user_district, user_street, vlg_or_cmty,SUM(charge_amt) AS cny_yr_full
                        FROM mc_visit
                        WHERE 1=1  AND charge_type='2'
                        AND is_charged='Y'
                        GROUP BY
                        fiscal_year, company_code, urb_rur_cls,
                        user_province, user_city, user_district, user_street, vlg_or_cmty
                        ) bnqk on bnqk.fiscal_year = t.fiscal_year and bnqk.company_code=t.company_code and bnqk.urb_rur_cls=t.urb_rur_cls
                and bnqk.user_province=t.province and bnqk.user_city=t.city and bnqk.user_district=t.district and bnqk.user_street=t.street and bnqk.vlg_or_cmty=t.vlg_or_cmty
                LEFT JOIN (
                        SELECT fiscal_year, company_code, urb_rur_cls,
                        user_province, user_city, user_district, user_street, vlg_or_cmty,SUM(charge_amt) AS cny_yr_instal
                        FROM mc_visit
                        WHERE 1=1  AND charge_type in ("1","4")
                        AND is_charged='Y'
                        GROUP BY
                        fiscal_year, company_code, urb_rur_cls,
                        user_province, user_city, user_district, user_street, vlg_or_cmty
                        ) bnfq on bnfq.fiscal_year = t.fiscal_year and bnfq.company_code=t.company_code and bnfq.urb_rur_cls=t.urb_rur_cls
                and bnfq.user_province=t.province and bnfq.user_city=t.city and bnfq.user_district=t.district and bnfq.user_street=t.street and bnfq.vlg_or_cmty=t.vlg_or_cmty
                where  1=1
                    <if test="fiscalYear != null "> and t.fiscal_year = #{fiscalYear}</if>
                    <if test="regionName != null  and regionName != ''"> and t.region_name like concat('%', #{regionName}, '%')</if>
                    <if test="groupName != null  and groupName != ''"> and t.group_name like concat('%', #{groupName}, '%')</if>
                    <if test="companyName != null  and companyName != ''"> and t.company_name like concat('%', #{companyName}, '%')</if>
                    <if test="companyCode != null  and companyCode != ''"> and t.company_code = #{companyCode}</if>
                    <if test="province != null  and province != ''"> and t.province = #{province}</if>
                    <if test="city != null  and city != ''"> and t.city = #{city}</if>
                    <if test="district != null  and district != ''"> and t.district = #{district}</if>
                    <if test="street != null  and street != ''"> and t.street = #{street}</if>
                    <if test="vlgOrCmty != null  and vlgOrCmty != ''"> and t.vlg_or_cmty = #{vlgOrCmty}</if>
                    <if test="respPerson != null  and respPerson != ''"> and t.resp_person = #{respPerson}</if>
                    <if test="urbRurCls != null  and urbRurCls != ''"> and t.urb_rur_cls = #{urbRurCls}</if>
                    <if test="budgConfPrev != null "> and t.budg_conf_prev = #{budgConfPrev}</if>
                    <if test="budgConfNew != null "> and t.budg_conf_new = #{budgConfNew}</if>
                    <if test="budgTotal != null "> and t.budg_total = #{budgTotal}</if>
                    <if test="quarterlyTarget != null "> and t.quarterly_target = #{quarterlyTarget}</if>
                    <if test="cnyGsgCharged != null "> and t.cny_gsg_charged = #{cnyGsgCharged}</if>
                    <if test="cnyGsgUncharged != null "> and t.cny_gsg_uncharged = #{cnyGsgUncharged}</if>
                    <if test="cnyGsgTotal != null "> and t.cny_gsg_total = #{cnyGsgTotal}</if>
                    <if test="cnyYrFull != null "> and t.cny_yr_full = #{cnyYrFull}</if>
                    <if test="cnyYrInstal != null "> and t.cny_yr_instal = #{cnyYrInstal}</if>
                    <if test="cnyPrevFull != null "> and t.cny_prev_full = #{cnyPrevFull}</if>
                    <if test="cnyPrevInstall != null "> and t.cny_prev_install = #{cnyPrevInstall}</if>
                    <if test="cnyMarketCumr != null "> and t.cny_market_cumr = #{cnyMarketCumr}</if>
                    <if test="cnyFyCumReturn != null "> and t.cny_fy_cum_return = #{cnyFyCumReturn}</if>
                    <if test="cnyFpCumReturn != null "> and t.cny_fp_cum_return = #{cnyFpCumReturn}</if>
                    <if test="cnyInstCumReturn != null "> and t.cny_inst_cum_return = #{cnyInstCumReturn}</if>
                    <if test="cnyNewCumReturn != null "> and t.cny_new_cum_return = #{cnyNewCumReturn}</if>
                    <if test="cnyRcvblsCumReturn != null "> and t.cny_rcvbls_cum_return = #{cnyRcvblsCumReturn}</if>
                    <if test="cnyBdgtCmplRate != null "> and t.cny_bdgt_cmpl_rate = #{cnyBdgtCmplRate}</if>
                    <if test="cnyRcvblsCmplRate != null "> and t.cny_rcvbls_cmpl_rate = #{cnyRcvblsCmplRate}</if>
                    <if test="cnyCynCmplRate != null "> and t.cny_cyn_cmpl_rate = #{cnyCynCmplRate}</if>
                    <if test="cnyPtCmplRate != null "> and t.cny_pt_cmpl_rate = #{cnyPtCmplRate}</if>
                    <if test="defFlag != null  and defFlag != ''"> and t.def_flag = #{defFlag}</if>
                    <if test="startFiscalYear != null  and startFiscalYear != ''"> and t.fiscal_year &gt;= #{startFiscalYear}</if>
                    <if test="finishFiscalYear != null  and finishFiscalYear != ''"> and t.fiscal_year &lt;= #{finishFiscalYear}</if>
                    <!-- 数据范围过滤 -->
                    ${params.dataScope}
        ) d
        order by d.update_time desc

    </select>
</mapper>