<?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="cn.com.countrygarden.bi.main.dao.reportCityData.CityCompanyDataMapper">

    <resultMap id="BaseResultMap2" type="cn.com.countrygarden.bi.main.dto.reportCityData.CcdrDto" >
        <id column="id" property="id"  />
        <result column="city_company_name" property="cityCompanyName"  />
        <result column="city_company_code" property="cityCompanyCode"  />
        <result column="province" property="province"  />
        <result column="city" property="city"  />
        <result column="borough" property="borough"  />
        <result column="region" property="region"  />
        <result column="property_name" property="propertyName"  />
        <result column="nc_system_account" property="ncSystemAccount"  />
        <result column="nc_system_number" property="ncSystemNumber"  />
        <result column="nc_person_number" property="ncPersonNumber"  />
        <result column="manage_time" property="manageTime"  />
        <result column="manage_project_number" property="manageProjectNumber" jdbcType="INTEGER" />
        <result column="manage_project_area" property="manageProjectArea" jdbcType="DECIMAL" />
        <result column="valuation_adjustment_mechanism_first" property="valuationAdjustmentMechanismFirst"  />
        <result column="valuation_adjustment_mechanism_second" property="valuationAdjustmentMechanismSecond"  />
        <result column="valuation_adjustment_mechanism_thirdly" property="valuationAdjustmentMechanismThirdly"  />
        <result column="valuation_charge_area" property="valuationChargeArea" jdbcType="DECIMAL" />
        <result column="valuation_net_profit" property="valuationNetProfit" jdbcType="DECIMAL" />
        <result column="valuation_sales_revenue" property="valuationSalesRevenue" jdbcType="DECIMAL" />
        <result column="valuation_other" property="valuationOther"  />
        <result column="first_charge_area" property="firstChargeArea" jdbcType="DECIMAL" />
        <result column="first_net_pofit" property="firstNetPofit" jdbcType="DECIMAL" />
        <result column="first_sales_revenue" property="firstSalesRevenue" jdbcType="DECIMAL" />
        <result column="first_other" property="firstOther"  />
        <result column="second_charge_area" property="secondChargeArea" jdbcType="DECIMAL" />
        <result column="second_net_pofit" property="secondNetPofit" jdbcType="DECIMAL" />
        <result column="second_sales_revenue" property="secondSalesRevenue" jdbcType="DECIMAL" />
        <result column="second_other" property="secondOther"  />
        <result column="thirdly_charge_area" property="thirdlyChargeArea" jdbcType="DECIMAL" />
        <result column="thirdly_net_pofit" property="thirdlyNetPofit" jdbcType="DECIMAL" />
        <result column="thirdly_sales_revenue" property="thirdlySalesRevenue" jdbcType="DECIMAL" />
        <result column="thirdly_other" property="thirdlyOther"  />
        <result column="fourthly_charge_area" property="fourthlyChargeArea" jdbcType="DECIMAL" />
        <result column="fourthly_net_pofit" property="fourthlyNetPofit" jdbcType="DECIMAL" />
        <result column="fourthly_sales_revenue" property="fourthlySalesRevenue" jdbcType="DECIMAL" />
        <result column="fourthly_other" property="fourthlyOther"  />
        <result column="fifth_charge_area" property="fifthChargeArea" jdbcType="DECIMAL" />
        <result column="fifth_net_pofit" property="fifthNetPofit" jdbcType="DECIMAL" />
        <result column="fifth_sales_revenue" property="fifthSalesRevenue" jdbcType="DECIMAL" />
        <result column="fifth_other" property="fifthOther"  />
        <result column="is_delete" property="isDelete" jdbcType="INTEGER" />
        <result column="create_date" property="createDate"  />
        <result column="create_by" property="createBy"  />
        <result column="last_update_date" property="lastUpdateDate"  />
        <result column="last_update_by" property="lastUpdateBy"  />
        <collection property="cclDtoList" ofType="cn.com.countrygarden.bi.main.dto.reportCityData.CclDto" select="getCclDtoListById" column="id">

        </collection>
        <collection property="ccsjDtoList" ofType="cn.com.countrygarden.bi.main.dto.reportCityData.CcsjDto" select="getccsjDtoListById" column="id">

        </collection>
        <collection property="ccsrDtoList" ofType="cn.com.countrygarden.bi.main.dto.reportCityData.CcsrDto" select="getccsrDtoListById" column="id" >

        </collection>
        <collection property="ccufDtoList" ofType="cn.com.countrygarden.bi.main.dto.reportCityData.CcufDto" select="getccufDtoListByParanId" column="id" >

        </collection>
    </resultMap>

    <resultMap id="ccldMap" type="cn.com.countrygarden.bi.main.dto.reportCityData.CclDto">
        <id column="ccl_id" property="id" />
        <result column="city_company_data_report_id" property="cityCompanyDataReportId"  />
        <result column="leader_name" property="leaderName"  />
        <result column="leader_tel" property="leaderTel" />
        <result column="ccl_create_date" property="createDate"  />
        <result column="ccl_create_by" property="createBy" />
        <result column="ccl_last_update_date" property="lastUpdateDate" />
        <result column="ccl_last_update_by" property="lastUpdateBy"/>
    </resultMap>

    <resultMap id="ccsjMap" type="cn.com.countrygarden.bi.main.dto.reportCityData.CcsjDto">
        <id column="ccsj_id" property="id"  />
        <result column="city_company_data_report_id" property="cityCompanyDataReportId"  />
        <result column="joint_name" property="jointName"  />
        <result column="joint_tel" property="jointTel"  />
        <result column="ccsj_create_date" property="createDate"  />
        <result column="ccsj_create_by" property="createBy"  />
        <result column="ccsj_last_update_date" property="lastUpdateDate"  />
        <result column="ccsj_last_update_by" property="lastUpdateBy"  />
    </resultMap>

    <resultMap id="ccsrMap" type="cn.com.countrygarden.bi.main.dto.reportCityData.CcsrDto" >
        <id column="ccsr_id" property="id"  />
        <result column="city_company_data_report_id" property="cityCompanyDataReportId"  />
        <result column="shareholder_name" property="shareholderName"  />
        <result column="shareholder_ratio" property="shareholderRatio"  />
        <result column="ccsr_create_date" property="createDate"  />
        <result column="ccsr_create_by" property="createBy"  />
        <result column="ccsr_last_update_date" property="lastUpdateDate"  />
        <result column="ccsr_last_update_by" property="lastUpdateBy"  />
    </resultMap>
    <resultMap id="ccufMap" type="cn.com.countrygarden.bi.main.dto.reportCityData.CcufDto" >
        <id column="ccuf_id" property="id"  />
        <result column="city_company_data_report_id" property="cityCompanyDataReportId"  />
        <result column="file_name" property="fileName"  />
        <result column="file_real_name" property="fileRealName"  />
        <result column="file_url" property="fileUrl"  />
        <result column="file_type" property="fileType"  />
        <result column="file_tab" property="fileTab"  />
        <result column="ccuf_create_date" property="createDate" />
        <result column="ccuf_create_by" property="createBy"  />
        <result column="ccuf_last_update_date" property="lastUpdateDate"  />
        <result column="ccuf_last_update_by" property="lastUpdateBy"  />
    </resultMap>

    <!-- 查询城市数据上报主表数据 -->
    <select id="queryData" parameterType="Integer" resultMap="BaseResultMap2">
       SELECT a.*
        FROM city_company_data_report a
        WHERE a.id=#{ccdrId} AND is_delete = 0
    </select>

    <select id="getCclDtoListById" resultMap="ccldMap">
        SELECT
            id AS ccl_id,
            city_company_data_report_id,
            leader_name,
            leader_tel,
            create_by AS ccl_create_by,
            create_date AS ccl_create_date,
            last_update_by AS ccl_last_update_by,
            last_update_date AS ccl_last_update_date
        FROM city_company_leader
        WHERE city_company_data_report_id = #{id} AND is_delete = 0
    </select>

    <select id="getccsjDtoListById" resultMap="ccsjMap">
        SELECT
            id AS ccsj_id,
            city_company_data_report_id,
            joint_name,
            joint_tel,
            create_by AS ccsj_create_by,
            create_date AS ccsj_create_date,
            last_update_by AS ccsj_last_update_by,
            last_update_date AS ccsj_last_update_date
        FROM city_company_shareholder_joint
        WHERE city_company_data_report_id = #{id} AND is_delete = 0
    </select>

    <select id="getccsrDtoListById" resultMap="ccsrMap">
        SELECT
            id AS ccsr_id,
            city_company_data_report_id,
            create_by AS ccsr_create_by,
            create_date AS ccsr_create_date,
            shareholder_name,
            shareholder_ratio,
            last_update_by AS ccsr_last_update_by,
            last_update_date AS ccsr_last_update_date
        FROM city_company_shareholder_ratio
        WHERE city_company_data_report_id = #{id} AND is_delete = 0
    </select>

    <select id="getccufDtoListByParanId" resultMap="ccufMap">
        SELECT
            id AS ccuf_id,
            city_company_data_report_id,
            create_by AS ccuf_create_by,
            create_date AS ccuf_create_date,
            file_name,
            file_real_name,
            file_url,
            file_type,
            file_tab,
            last_update_by AS ccuf_last_update_by,
            last_update_date AS ccuf_last_update_date
        FROM city_company_upload_file
        WHERE city_company_data_report_id = #{id} AND is_delete = 0
    </select>

    <select id="getCcufDtoListById" resultMap="ccufMap">
        SELECT
            id AS ccuf_id,
            city_company_data_report_id,
            create_by AS ccuf_create_by,
            create_date AS ccuf_create_date,
            file_name,
            file_real_name,
            file_url,
            file_type,
            file_tab,
            last_update_by AS ccuf_last_update_by,
            last_update_date AS ccuf_last_update_date
        FROM city_company_upload_file
        WHERE id = #{id}
    </select>

    <select id="queryUnionData" parameterType="cn.com.countrygarden.bi.main.dto.reportCityData.CcdrDto" resultMap="BaseResultMap2">
        SELECT a.*
        FROM city_company_data_report a
        <where>
            is_delete = 0
            <if test="cityCompanyName!=null and cityCompanyName!=''">
                AND a.city_company_name LIKE CONCAT('%',#{cityCompanyName},'%')
            </if>
            <if test="cityCompanyCode!=null and cityCompanyCode!=''">
                AND a.city_company_code = #{cityCompanyCode}
            </if>
        </where>
    </select>

    <!-- 新增主表数据 -->
    <insert id="addData" parameterType="cn.com.countrygarden.bi.main.dto.reportCityData.CcdrDto" useGeneratedKeys="true" keyProperty="id" >
        insert into city_company_data_report
        <trim prefix="(" suffix=")" suffixOverrides="," >
            <if test="cityCompanyName != null and cityCompanyName != ''" >
                city_company_name,
            </if>
            city_company_code,
            <if test="province != null and province != ''" >
                province,
            </if>
            city,
            borough,
            region,
            property_name,
            nc_system_account,
            <if test="ncSystemNumber != null and ncSystemNumber != ''" >
                nc_system_number,
            </if>
            <if test="ncPersonNumber != null and ncPersonNumber != ''" >
                nc_person_number,
            </if>
            manage_time,
            manage_project_number,
            manage_project_area,
            valuation_adjustment_mechanism_first,
            valuation_adjustment_mechanism_second,
            valuation_adjustment_mechanism_thirdly,
            valuation_charge_area,
            valuation_net_profit,
            valuation_sales_revenue,
            valuation_other,
            first_charge_area,
            first_net_pofit,
            first_sales_revenue,
            first_other,
            second_charge_area,
            second_net_pofit,
            second_sales_revenue,
            second_other,
            thirdly_charge_area,
            thirdly_net_pofit,
            thirdly_sales_revenue,
            thirdly_other,
            fourthly_charge_area,
            fourthly_net_pofit,
            fourthly_sales_revenue,
            fourthly_other,
            fifth_charge_area,
            fifth_net_pofit,
            fifth_sales_revenue,
            fifth_other,
            create_date,
            create_by,
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides="," >
            <if test="cityCompanyName != null and cityCompanyName != ''" >
                #{cityCompanyName},
            </if>
            #{cityCompanyCode},
            <if test="province != null and province != ''" >
                #{province},
            </if>
            #{city},
            #{borough},
            #{region},
            #{propertyName},
            #{ncSystemAccount},
            <if test="ncSystemNumber != null and ncSystemNumber != ''" >
                #{ncSystemNumber},
            </if>
            <if test="ncPersonNumber != null and ncPersonNumber != ''" >
                #{ncPersonNumber},
            </if>
            #{manageTime},
            #{manageProjectNumber},
            #{manageProjectArea},
            #{valuationAdjustmentMechanismFirst},
            #{valuationAdjustmentMechanismSecond},
            #{valuationAdjustmentMechanismThirdly},
            #{valuationChargeArea},
            #{valuationNetProfit},
            #{valuationSalesRevenue},
            #{valuationOther},
            #{firstChargeArea},
            #{firstNetPofit},
            #{firstSalesRevenue},
            #{firstOther},
            #{secondChargeArea},
            #{secondNetPofit},
            #{secondSalesRevenue},
            #{secondOther},
            #{thirdlyChargeArea},
            #{thirdlyNetPofit},
            #{thirdlySalesRevenue},
            #{thirdlyOther},
            #{fourthlyChargeArea},
            #{fourthlyNetPofit},
            #{fourthlySalesRevenue},
            #{fourthlyOther},
            #{fifthChargeArea},
            #{fifthNetPofit},
            #{fifthSalesRevenue},
            #{fifthOther},
            #{createDate},
            #{createBy},
        </trim>
    </insert>

    <insert id="addCclData" parameterType="cn.com.countrygarden.bi.main.dto.reportCityData.CcdrDto" >
        insert into city_company_leader ( city_company_data_report_id, leader_name,
        leader_tel, create_date, create_by,  last_update_date, last_update_by)
        values
        <foreach collection ="cclDtoList" item="ccl" separator =",">
            (#{id}, #{ccl.leaderName},
            #{ccl.leaderTel}, NOW(), #{ccl.createBy},
            NOW(), #{ccl.lastUpdateBy})
        </foreach>
    </insert>

    <insert id="addCclDto" parameterType="cn.com.countrygarden.bi.main.dto.reportCityData.CclDto" >
        insert into city_company_leader ( city_company_data_report_id, leader_name,
        leader_tel, create_date, create_by,  last_update_date, last_update_by)
        values
            (#{cityCompanyDataReportId}, #{leaderName},
            #{leaderTel}, NOW(), #{createBy},
            NOW(), #{lastUpdateBy})
    </insert>

    <insert id="addCcsjData" parameterType="cn.com.countrygarden.bi.main.dto.reportCityData.CcdrDto" >
        insert into city_company_shareholder_joint (city_company_data_report_id, joint_name,
        joint_tel, create_date, create_by,
        last_update_date, last_update_by)
        values
        <foreach collection ="ccsjDtoList" item="ccsj" separator =",">
            (#{id}, #{ccsj.jointName}, #{ccsj.jointTel}, NOW(),
            #{ccsj.createBy}, NOW(), #{ccsj.lastUpdateBy})
        </foreach>
    </insert>

    <insert id="addCcsjDto" parameterType="cn.com.countrygarden.bi.main.dto.reportCityData.CcsjDto" >
        insert into city_company_shareholder_joint (city_company_data_report_id, joint_name,
        joint_tel, create_date, create_by,
        last_update_date, last_update_by)
        values

            (#{cityCompanyDataReportId}, #{jointName}, #{jointTel}, NOW(),
            #{createBy}, NOW(), #{lastUpdateBy})

    </insert>

    <insert id="addCcsrData" parameterType="cn.com.countrygarden.bi.main.dto.reportCityData.CcdrDto" >
        insert into city_company_shareholder_ratio (city_company_data_report_id, shareholder_name,
        shareholder_ratio, create_date, create_by,
        last_update_date, last_update_by)
        values
        <foreach collection ="ccsrDtoList" item="ccsr" separator =",">
            (#{id}, #{ccsr.shareholderName},
            #{ccsr.shareholderRatio}, NOW(), #{ccsr.createBy},
            NOW(), #{ccsr.lastUpdateBy})
        </foreach>
    </insert>

    <insert id="addCcsrDto" parameterType="cn.com.countrygarden.bi.main.dto.reportCityData.CcsrDto" >
        insert into city_company_shareholder_ratio (city_company_data_report_id, shareholder_name,
        shareholder_ratio, create_date, create_by,
        last_update_date, last_update_by)
        values
            (#{cityCompanyDataReportId}, #{shareholderName},
            #{shareholderRatio}, NOW(), #{createBy},
            NOW(), #{lastUpdateBy})

    </insert>

    <insert id="addCcufData" parameterType="cn.com.countrygarden.bi.main.dto.reportCityData.CcufDto" >
        insert into city_company_upload_file
        (city_company_data_report_id, file_name,file_url,
        file_type,file_tab,file_real_name,
        create_date,create_by, last_update_date,
        last_update_by)
        values
        <foreach collection ="ccufDtoList" item="ccuf" separator =",">
            (#{id},
            #{ccuf.fileName},#{ccuf.fileUrl}, #{ccuf.fileType},
            #{ccuf.fileTab},
            #{ccuf.fileRealName},
            NOW(),#{ccuf.createBy},NOW(),
            #{ccuf.lastUpdateBy})
        </foreach>
    </insert>

    <insert id="addCcufDto" parameterType="cn.com.countrygarden.bi.main.dto.reportCityData.CcufDto" >
        insert into city_company_upload_file
        (city_company_data_report_id, file_name,file_url,
        file_type,file_tab,file_real_name,
        create_date,create_by, last_update_date,
        last_update_by)
        values
            (#{cityCompanyDataReportId},
            #{fileName},#{fileUrl}, #{fileType},
            #{fileTab},
            #{fileRealName},
            NOW(),#{createBy},NOW(),
            #{lastUpdateBy})
    </insert>

    <update id="updateData" parameterType="cn.com.countrygarden.bi.main.dto.reportCityData.CcufDto" >
        update city_company_data_report
        <set >
            <if test="cityCompanyName != null and cityCompanyName != ''" >
                city_company_name = #{cityCompanyName},
            </if>
            city_company_code = #{cityCompanyCode},
            <if test="province != null and province != ''" >
                province = #{province},
            </if>
            city = #{city},
            borough = #{borough},
            region = #{region},
            property_name = #{propertyName},
            nc_system_account = #{ncSystemAccount},
            <if test="ncSystemNumber != null and ncSystemNumber != ''" >
                nc_system_number = #{ncSystemNumber},
            </if>
            <if test="ncPersonNumber != null and ncPersonNumber != ''" >
                nc_person_number = #{ncPersonNumber},
            </if>
            manage_time = #{manageTime},
            manage_project_number = #{manageProjectNumber},
            manage_project_area = #{manageProjectArea},
            valuation_adjustment_mechanism_first = #{valuationAdjustmentMechanismFirst},
            valuation_adjustment_mechanism_second = #{valuationAdjustmentMechanismSecond},
            valuation_adjustment_mechanism_thirdly = #{valuationAdjustmentMechanismThirdly},
            valuation_charge_area = #{valuationChargeArea},
            valuation_net_profit = #{valuationNetProfit},
            valuation_sales_revenue = #{valuationSalesRevenue},
            valuation_other = #{valuationOther},
            first_charge_area = #{firstChargeArea},
            first_net_pofit = #{firstNetPofit},
            first_sales_revenue = #{firstSalesRevenue},
            first_other = #{firstOther},
            second_charge_area = #{secondChargeArea},
            second_net_pofit = #{secondNetPofit},
            second_sales_revenue = #{secondSalesRevenue},
            second_other = #{secondOther},
            thirdly_charge_area = #{thirdlyChargeArea},
            thirdly_net_pofit = #{thirdlyNetPofit},
            thirdly_sales_revenue = #{thirdlySalesRevenue},
            thirdly_other = #{thirdlyOther},
            fourthly_charge_area = #{fourthlyChargeArea},
            fourthly_net_pofit = #{fourthlyNetPofit},
            fourthly_sales_revenue = #{fourthlySalesRevenue},
            fourthly_other = #{fourthlyOther},
            fifth_charge_area = #{fifthChargeArea},
            fifth_net_pofit = #{fifthNetPofit},
            fifth_sales_revenue = #{fifthSalesRevenue},
            fifth_other = #{fifthOther},
            is_delete = #{isDelete},
            last_update_date = #{lastUpdateDate},
            last_update_by = #{lastUpdateBy},
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>

    <update id="updateCclDto" parameterType="cn.com.countrygarden.bi.main.dto.reportCityData.CcdrDto" >
        update city_company_leader
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="leader_name = case" suffix="end,">
                <foreach collection="cclDtoList" item="i" index="index">
                    when id=#{i.id} then #{i.leaderName}
                </foreach>
            </trim>
            <trim prefix=" leader_tel =case" suffix="end,">
                <foreach collection="cclDtoList" item="i" index="index">
                    when id=#{i.id} then #{i.leaderTel}
                </foreach>
            </trim>
            <trim prefix=" last_update_date =case" suffix="end,">
                <foreach collection="cclDtoList" item="i" index="index">
                    when id=#{i.id} then NOW()
                </foreach>
            </trim>
            <trim prefix=" last_update_by =case" suffix="end,">
                <foreach collection="cclDtoList" item="i" index="index">
                    when id=#{i.id} then #{i.lastUpdateBy}
                </foreach>
            </trim>
        </trim>
        where
        <foreach collection="cclDtoList" separator="or" item="i" index="index" >
            id=#{i.id}
        </foreach>
    </update>

    <update id="updateCcsjDto" parameterType="cn.com.countrygarden.bi.main.dto.reportCityData.CcdrDto" >
        update city_company_shareholder_joint
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="joint_name = case" suffix="end,">
                <foreach collection="ccsjDtoList" item="i" index="index">
                    when id=#{i.id} then #{i.jointName}
                </foreach>
            </trim>
            <trim prefix=" joint_tel =case" suffix="end,">
                <foreach collection="ccsjDtoList" item="i" index="index">
                    when id=#{i.id} then #{i.jointTel}
                </foreach>
            </trim>
            <trim prefix=" last_update_date =case" suffix="end,">
                <foreach collection="ccsjDtoList" item="i" index="index">
                    when id=#{i.id} then NOW()
                </foreach>
            </trim>
            <trim prefix=" last_update_by =case" suffix="end,">
                <foreach collection="ccsjDtoList" item="i" index="index">
                    when id=#{i.id} then #{i.lastUpdateBy}
                </foreach>
            </trim>
        </trim>
        where
        <foreach collection="ccsjDtoList" separator="or" item="i" index="index" >
            id=#{i.id}
        </foreach>
    </update>

    <update id="updateCcsrDto" parameterType="cn.com.countrygarden.bi.main.dto.reportCityData.CcdrDto" >
        update city_company_shareholder_ratio
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="shareholder_name = case" suffix="end,">
                <foreach collection="ccsrDtoList" item="i" index="index">
                    when id=#{i.id} then #{i.shareholderName}
                </foreach>
            </trim>
            <trim prefix=" shareholder_ratio =case" suffix="end,">
                <foreach collection="ccsrDtoList" item="i" index="index">
                    when id=#{i.id} then #{i.shareholderRatio}
                </foreach>
            </trim>
            <trim prefix=" last_update_date =case" suffix="end,">
                <foreach collection="ccsrDtoList" item="i" index="index">
                    when id=#{i.id} then NOW()
                </foreach>
            </trim>
            <trim prefix=" last_update_by =case" suffix="end,">
                <foreach collection="ccsrDtoList" item="i" index="index">
                    when id=#{i.id} then #{i.lastUpdateBy}
                </foreach>
            </trim>
        </trim>
        where
        <foreach collection="ccsrDtoList" separator="or" item="i" index="index" >
            id=#{i.id}
        </foreach>
    </update>

    <update id="updateCcufDto" parameterType="cn.com.countrygarden.bi.main.dto.reportCityData.CcdrDto" >
        update city_company_upload_file
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="file_name = case" suffix="end,">
                <foreach collection="ccufDtoList" item="i" index="index">
                    when id=#{i.id} then #{i.fileName}
                </foreach>
            </trim>
            <trim prefix=" file_url =case" suffix="end,">
                <foreach collection="ccufDtoList" item="i" index="index">
                    when id=#{i.id} then #{i.fileUrl}
                </foreach>
            </trim>
            <trim prefix=" file_type =case" suffix="end,">
                <foreach collection="ccufDtoList" item="i" index="index">
                    when id=#{i.id} then #{i.fileType}
                </foreach>
            </trim>
            <trim prefix=" file_tab =case" suffix="end,">
                <foreach collection="ccufDtoList" item="i" index="index">
                    when id=#{i.id} then #{i.fileTab}
                </foreach>
            </trim>
            <trim prefix=" file_real_name =case" suffix="end,">
                <foreach collection="ccufDtoList" item="i" index="index">
                    when id=#{i.id} then #{i.fileRealName}
                </foreach>
            </trim>
            <trim prefix=" last_update_date =case" suffix="end,">
                <foreach collection="ccsrDtoList" item="i" index="index">
                    when id=#{i.id} then NOW()
                </foreach>
            </trim>
            <trim prefix=" last_update_by =case" suffix="end,">
                <foreach collection="ccsrDtoList" item="i" index="index">
                    when id=#{i.id} then #{i.lastUpdateBy}
                </foreach>
            </trim>
        </trim>
        where
        <foreach collection="ccsrDtoList" separator="or" item="i" index="index" >
            id=#{i.id}
        </foreach>
    </update>

    <update id="deleteCclData"  >
        UPDATE city_company_leader SET is_delete = 1 WHERE city_company_data_report_id=#{ccdrId}
    </update>
    <update id="deleteCcsjData" >
        UPDATE city_company_shareholder_joint SET is_delete = 1  WHERE city_company_data_report_id=#{ccdrId}
    </update>
    <update id="deleteCcsrData" >
         UPDATE city_company_shareholder_ratio SET is_delete = 1 WHERE city_company_data_report_id=#{ccdrId}
    </update>
    <update id="deleteCcufData" >
        UPDATE city_company_upload_file SET is_delete = 1 WHERE city_company_data_report_id=#{ccdrId}
    </update>
    <update id="deleteData"     >
        UPDATE city_company_data_report SET is_delete = 1 WHERE id=#{ccdrId}
    </update>
    <update id="deleteCcl"      >
        UPDATE city_company_leader SET is_delete = 1 WHERE id=#{cclId}
    </update>
    <update id="deleteCcsj"     >
        UPDATE city_company_shareholder_joint SET is_delete = 1 WHERE id=#{ccsjId}
    </update>
    <update id="deleteCcsr"     >
         UPDATE city_company_shareholder_ratio SET is_delete = 1 WHERE id=#{ccsrId}
    </update>
    <update id="deleteCcuf"     >
         UPDATE city_company_upload_file SET is_delete = 1 WHERE id=#{fileId}
    </update>
</mapper>