<?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.ruoyi.ibs.grid.mapper.GridVirtualCountMapper">

    <resultMap type="GridVirtualCountLingshou" id="GridVirtualCountLingshouResult">
        <result property="dt"    column="dt"    />
        <result property="gridId"    column="grid_id"    />
        <result property="gridName"    column="grid_name"    />
        <result property="gridType"    column="grid_type"    />
        <result property="createBy"    column="create_by"    />
        <result property="deptType"    column="dept_type"    />
        <result property="deptId"    column="dept_id"    />
        <result property="deptName"    column="dept_name"    />
        <result property="outletsId"    column="outlets_id"    />
        <result property="outletsName"    column="outlets_name"    />
        <result property="userName"    column="user_name"    />
        <result property="custNum"    column="cust_num"    />
        <result property="curBalD"    column="cur_bal_d"    />
        <result property="curBalT"    column="cur_bal_t"    />
        <result property="balLoan"    column="bal_loan"    />
        <result property="curBal5Bad"    column="cur_bal_5_bad"    />
        <result property="curDAve"    column="cur_d_ave"    />
        <result property="curTAve"    column="cur_t_ave"    />
        <result property="loanAve"    column="loan_ave"    />
        <result property="phRat"    column="ph_rat"    />
        <result property="sxRat"    column="sx_rat"    />
        <result property="yxhtRat"    column="yxht_rat"    />
        <result property="xykRat"    column="xyk_rat"    />
        <result property="fshlRat"    column="fshl_rat"    />
        <result property="sdRat"    column="sd_rat"    />
        <result property="etcRat"    column="etc_rat"    />
        <result property="dianRat"    column="dian_rat"    />
        <result property="blackRat"    column="black_rat"    />
        <result property="badRat"    column="bad_rat"    />
        <result property="badBalRat"    column="bad_bal_rat"    />
        <result property="phNum"    column="ph_num"    />
        <result property="sxNum"    column="sx_num"    />
        <result property="yxhtNum"    column="yxht_num"    />
        <result property="xykNum"    column="xyk_num"    />
        <result property="fshlNum"    column="fshl_num"    />
        <result property="sdNum"    column="sd_num"    />
        <result property="etcNum"    column="etc_num"    />
        <result property="dianNum"    column="dian_num"    />
        <result property="blackNum"    column="black_num"    />
        <result property="badNum"    column="bad_num"    />
        <result property="opsDept"    column="ops_dept"    />
    </resultMap>


    <resultMap type="GridVirtualCountGongsi" id="GridVirtualCountGongsiResult">
        <result property="dt"    column="dt"    />
        <result property="gridId"    column="grid_id"    />
        <result property="gridName"    column="grid_name"    />
        <result property="gridType"    column="grid_type"    />
        <result property="createBy"    column="create_by"    />
        <result property="deptType"    column="dept_type"    />
        <result property="deptId"    column="dept_id"    />
        <result property="deptName"    column="dept_name"    />
        <result property="outletsId"    column="outlets_id"    />
        <result property="outletsName"    column="outlets_name"    />
        <result property="userName"    column="user_name"    />
        <result property="custNum"    column="cust_num"    />
        <result property="hqCurBalance"    column="hq_cur_balance"    />
        <result property="bzCurBalance"    column="bz_cur_balance"    />
        <result property="loanBalanceCny"    column="loan_balance_cny"    />
        <result property="financeProd711Balance"    column="finance_prod_711_balance"    />
        <result property="financeProd716Balance"    column="finance_prod_716_balance"    />
        <result property="loanYearDailyaverage"    column="loan_year_dailyaverage"    />
        <result property="htqyRat"    column="htqy_rat"    />
        <result property="qfcdRat"    column="qfcd_rat"    />
        <result property="txRat"    column="tx_rat"    />
        <result property="bhRat"    column="bh_rat"    />
        <result property="yxdfgzRat"    column="yxdfgz_rat"    />
        <result property="dkdfRat"    column="dkdf_rat"    />
        <result property="dksfRat"    column="dksf_rat"    />
        <result property="dkshfRat"    column="dkshf_rat"    />
        <result property="pjbRat"    column="pjb_rat"    />
        <result property="czbRat"    column="czb_rat"    />
        <result property="sfbRat"    column="sfb_rat"    />
        <result property="mrbRat"    column="mrb_rat"    />
        <result property="szstRat"    column="szst_rat"    />
        <result property="khRat"    column="kh_rat"    />
        <result property="gjjsywRat"    column="gjjsyw_rat"    />
        <result property="yqjshRat"    column="yqjsh_rat"    />
        <result property="htqyNum"    column="htqy_num"    />
        <result property="qfcdNum"    column="qfcd_num"    />
        <result property="txNum"    column="tx_num"    />
        <result property="bhNum"    column="bh_num"    />
        <result property="yxdfgzNum"    column="yxdfgz_num"    />
        <result property="ustrCountPerM"    column="ustr_count_per_m"    />
        <result property="ustrBalM"    column="ustr_bal_m"    />
        <result property="dkdfNum"    column="dkdf_num"    />
        <result property="dksfNum"    column="dksf_num"    />
        <result property="dkshfNum"    column="dkshf_num"    />
        <result property="pjbNum"    column="pjb_num"    />
        <result property="czbNum"    column="czb_num"    />
        <result property="sfbNum"    column="sfb_num"    />
        <result property="mrbNum"    column="mrb_num"    />
        <result property="szstNum"    column="szst_num"    />
        <result property="khNum"    column="kh_num"    />
        <result property="gjjsywNum"    column="gjjsyw_num"    />
        <result property="yqjshNum"    column="yqjsh_num"    />
        <result property="opsDept"    column="ops_dept"    />
    </resultMap>

    <resultMap type="GridVirtualCustGongsi" id="GridVirtualCustGongsiResult">
        <result property="custName"    column="cust_name"    />
        <result property="socialCreditCode"    column="social_credit_code"    />
        <result property="custIsn"    column="cust_isn"    />
        <result property="hqCurBalance"    column="hq_cur_balance"    />
        <result property="bzCurBalance"    column="bz_cur_balance"    />
        <result property="isCredit"    column="is_credit"    />
        <result property="loanBalanceCny"    column="loan_balance_cny"    />
        <result property="loanYearDailyaverage"    column="loan_year_dailyaverage"    />
        <result property="isHtqy"    column="is_htqy"    />
        <result property="financeProd716OpenFlag"    column="finance_prod_716_open_flag"    />
        <result property="financeProd716Balance"    column="finance_prod_716_balance"    />
        <result property="financeProd711OpenFlag"    column="finance_prod_711_open_flag"    />
        <result property="financeProd711Balance"    column="finance_prod_711_balance"    />
        <result property="intlBussinessJcbhOpenFlag"    column="intl_bussiness_jcbh_open_flag"    />
        <result property="isUstr"    column="is_ustr"    />
        <result property="ustrCountPerM"    column="ustr_count_per_m"    />
        <result property="ustrBalM"    column="ustr_bal_m"    />
        <result property="elecchargeSignFlag"    column="eleccharge_sign_flag"    />
        <result property="waterchargeSignFlag"    column="watercharge_sign_flag"    />
        <result property="taxdeductionSignFlag"    column="taxdeduction_sign_flag"    />
        <result property="pjb"    column="pjb"    />
        <result property="czb"    column="czb"    />
        <result property="sfb"    column="sfb"    />
        <result property="mrb"    column="mrb"    />
        <result property="szst"    column="szst"    />
        <result property="isOpenSts"    column="is_open_sts"    />
        <result property="intlBussinessOpenFlag"    column="intl_bussiness_open_flag"    />
        <result property="intlBussiness325OpenFlag"    column="intl_bussiness_325_open_flag"    />
        <result property="opsDept"    column="ops_dept"    />
        <result property="custType"    column="cust_type"    />
        <result property="gridId"    column="grid_id"    />
        <result property="gridName"    column="grid_name"    />
        <result property="gridType"    column="grid_type"    />
        <result property="deptType"    column="dept_type"    />
        <result property="deptId"    column="dept_id"    />
        <result property="deptName"    column="dept_name"    />
        <result property="outletsId"    column="outlets_id"    />
        <result property="outletsName"    column="outlets_name"    />
        <result property="userName"    column="user_name"    />
    </resultMap>

    <resultMap type="GridVirtualCustLingshou" id="GridVirtualCustLingshouResult">
        <result property="custName"    column="cust_name"    />
        <result property="custIdc"    column="cust_idc"    />
        <result property="custIsn"    column="cust_isn"    />
        <result property="curBalD"    column="cur_bal_d"    />
        <result property="curBalT"    column="cur_bal_t"    />
        <result property="balLoan"    column="bal_loan"    />
        <result property="curBal5Bad"    column="cur_bal_5_bad"    />
        <result property="curDAve"    column="cur_d_ave"    />
        <result property="curTAve"    column="cur_t_ave"    />
        <result property="loanAve"    column="loan_ave"    />
        <result property="isPh"    column="is_ph"    />
        <result property="isSx"    column="is_sx"    />
        <result property="isYxht"    column="is_yxht"    />
        <result property="isXyk"    column="is_xyk"    />
        <result property="fshl"    column="fshl"    />
        <result property="isSd"    column="is_sd"    />
        <result property="etc"    column="etc"    />
        <result property="dian"    column="dian"    />
        <result property="isBlack"    column="is_black"    />
        <result property="isBad"    column="is_bad"    />
        <result property="opsDept"    column="ops_dept"    />
        <result property="custType"    column="cust_type"    />
        <result property="gridId"    column="grid_id"    />
        <result property="gridName"    column="grid_name"    />
        <result property="gridType"    column="grid_type"    />
        <result property="deptType"    column="dept_type"    />
        <result property="deptId"    column="dept_id"    />
        <result property="deptName"    column="dept_name"    />
        <result property="outletsId"    column="outlets_id"    />
        <result property="outletsName"    column="outlets_name"    />
        <result property="userName"    column="user_name"    />
    </resultMap>

    <sql id="selectGridVirtualCountLingshouVo">
        select dt, grid_name, grid_type, create_by, dept_id, dept_name, outlets_id, outlets_name, user_name, cust_num, cur_bal_d, cur_bal_t, bal_loan, cur_bal_5_bad, cur_d_ave, cur_t_ave, loan_ave, ph_rat, sx_rat, yxht_rat, xyk_rat, fshl_rat, sd_rat, etc_rat, dian_rat, black_rat, bad_rat, bad_bal_rat, ph_num, sx_num, yxht_num, xyk_num, fshl_num, sd_num, etc_num, dian_num, black_num, bad_num, ops_dept from grid_virtual_count_lingshou
    </sql>

    <select id="selectGridVirtualCountLingshouList" resultMap="GridVirtualCountLingshouResult">
        SELECT ls.dt, ls.grid_id, ls.grid_name, ls.dept_type, ls.dept_id, ls.dept_name, ls.outlets_id, ls.outlets_name, ls.user_name, ls.cust_num, ls.cur_bal_d, ls.cur_bal_t, ls.bal_loan, ls.cur_bal_5_bad, ls.cur_d_ave, ls.cur_t_ave, ls.loan_ave, ls.ph_rat, ls.sx_rat, ls.yxht_rat, ls.xyk_rat, ls.fshl_rat, ls.sd_rat, ls.etc_rat, ls.dian_rat, ls.black_rat, ls.bad_rat, ls.bad_bal_rat, ls.ph_num, ls.sx_num, ls.yxht_num, ls.xyk_num, ls.fshl_num, ls.sd_num, ls.etc_num, ls.dian_num, ls.black_num, ls.bad_num, ls.ops_dept
        ,concat(su.nick_name,'-',ls.create_by) as create_by,
        CASE
        WHEN ls.grid_type = 1 THEN '菜场'
        WHEN ls.grid_type = 2 THEN '政府单位'
        WHEN ls.grid_type = 3 THEN '事业单位'
        WHEN ls.grid_type = 4 THEN '社区'
        WHEN ls.grid_type = 5 THEN '商圈'
        WHEN ls.grid_type = 6 THEN '企业'
        WHEN ls.grid_type = 7 THEN '市场园区'
        WHEN ls.grid_type = 8 THEN '教育'
        WHEN ls.grid_type = 9 THEN '其他'
        ELSE ls.grid_type
        END AS grid_type,
        ls.zf_365cnt, ls.zf_180cnt, ls.zf_90cnt, ls.zf_30cnt, ls.zf_365rt, ls.zf_180rt, ls.zf_90rt, ls.zf_30rt
        FROM grid_virtual_count_lingshou ls
        left join sys_user su on ls.create_by = su.user_name
        <where>
            <if test=" dt != null  and dt != ''">and dt = #{dt}</if>
            <if test=" gridName != null  and gridName != ''">and ls.grid_name like concat('%',concat(#{gridName},'%'))</if>
            <if test=" gridType != null  and gridType != ''">and ls.grid_type like concat('%',concat(#{gridType},'%'))</if>
            <if test=" isHead == true">and ls.dept_type = 'grid'</if>
            <if test=" isBranch == true">and ls.dept_id like concat('%',concat(#{deptId},'%')) and dept_type = 'branch'</if>
            <if test=" isOutlet == true">and ls.outlets_id like concat('%',concat(#{deptId},'%')) and dept_type = 'outlet'</if>
            <if test=" isManager == true">and ls.user_name like concat('%',concat(#{userName},'%'))  and dept_type = 'manager'</if>
        </where>
    </select>

    <select id="selectGridVirtualCountGongsiList" resultMap="GridVirtualCountGongsiResult">
        SELECT gs.dt, gs.grid_id, gs.grid_name, gs.dept_type, gs.dept_id, gs.dept_name, gs.outlets_id, gs.outlets_name, gs.user_name, gs.cust_num, gs.hq_cur_balance, gs.bz_cur_balance, gs.loan_balance_cny, gs.finance_prod_711_balance, gs.finance_prod_716_balance, gs.loan_year_dailyaverage, gs.htqy_rat, gs.qfcd_rat, gs.tx_rat, gs.bh_rat, gs.yxdfgz_rat, gs.dkdf_rat, gs.dksf_rat, gs.dkshf_rat, gs.pjb_rat, gs.czb_rat, gs.sfb_rat, gs.mrb_rat, gs.szst_rat, gs.kh_rat, gs.gjjsyw_rat, gs.yqjsh_rat, gs.htqy_num, gs.qfcd_num, gs.tx_num, gs.bh_num, gs.yxdfgz_num, gs.ustr_count_per_m, gs.ustr_bal_m, gs.dkdf_num, gs.dksf_num, gs.dkshf_num, gs.pjb_num, gs.czb_num, gs.sfb_num, gs.mrb_num, gs.szst_num, gs.kh_num, gs.gjjsyw_num, gs.yqjsh_num, gs.ops_dept
        ,concat(su.nick_name,'-',gs.create_by) as create_by,
        CASE
        WHEN gs.grid_type = 1 THEN '菜场'
        WHEN gs.grid_type = 2 THEN '政府单位'
        WHEN gs.grid_type = 3 THEN '事业单位'
        WHEN gs.grid_type = 4 THEN '社区'
        WHEN gs.grid_type = 5 THEN '商圈'
        WHEN gs.grid_type = 6 THEN '企业'
        WHEN gs.grid_type = 7 THEN '市场园区'
        WHEN gs.grid_type = 8 THEN '教育'
        WHEN gs.grid_type = 9 THEN '其他'
        ELSE gs.grid_type
        END AS grid_type,
        gs.zf_365cnt, gs.zf_180cnt, gs.zf_90cnt, gs.zf_30cnt, gs.zf_365rt, gs.zf_180rt, gs.zf_90rt, gs.zf_30rt
        FROM grid_virtual_count_gongsi gs
        left join sys_user su on gs.create_by = su.user_name
        <where>
            <if test=" dt != null  and dt != ''">and dt = #{dt}</if>
            <if test=" gridName != null  and gridName != ''">and gs.grid_name like concat('%',concat(#{gridName},'%'))</if>
            <if test=" gridType != null  and gridType != ''">and gs.grid_type like concat('%',concat(#{gridType},'%'))</if>
            <if test=" isHead == true">and gs.dept_type = 'grid'</if>
            <if test=" isBranch == true">and gs.dept_id like concat('%',concat(#{deptId},'%')) and dept_type = 'branch'</if>
            <if test=" isOutlet == true">and gs.outlets_id like concat('%',concat(#{deptId},'%')) and dept_type = 'outlet'</if>
            <if test=" isManager == true">and gs.user_name like concat('%',concat(#{userName},'%')) and dept_type = 'manager'</if>
        </where>
    </select>

    <select id="selectGridVirtualCountgsCustList" resultMap="GridVirtualCustGongsiResult">
        select cust_name, social_credit_code, cust_isn, hq_cur_balance, bz_cur_balance, is_credit, loan_balance_cny, loan_year_dailyaverage, is_htqy, finance_prod_716_open_flag, finance_prod_716_balance, finance_prod_711_open_flag, finance_prod_711_balance, intl_bussiness_jcbh_open_flag, is_ustr, ustr_count_per_m, ustr_bal_m, eleccharge_sign_flag, watercharge_sign_flag, taxdeduction_sign_flag, pjb, czb, sfb, mrb, szst, is_open_sts, intl_bussiness_open_flag, intl_bussiness_325_open_flag, ops_dept, cust_type, grid_id, grid_name, grid_type, dept_type, dept_id, dept_name, outlets_id, outlets_name, user_name,
        is_365zf, is_180zf, is_90zf, is_30zf
        from grid_virtual_cust_gongsi
        <where>
            <if test=" dt != null  and dt != ''">and dt = #{dt}</if>
            <if test=" gridId != null  and gridId != ''">and FIND_IN_SET(#{gridId}, grid_id) > 0</if>
            <if test=" custName != null  and custName != ''">and cust_name like concat('%',concat(#{custName},'%'))</if>
            <if test=" socialCreditCode != null  and socialCreditCode != ''">and social_credit_code like  concat('%',#{socialCreditCode},'%') </if>
            <if test=" isBranch == true">and dept_id like concat('%',concat(#{deptId},'%'))</if>
            <if test=" isOutlet == true">and outlets_id like concat('%',concat(#{deptId},'%'))</if>
            <if test=" isManager == true">and user_name like concat('%',concat(#{userName},'%'))</if>
        </where>
    </select>


    <select id="selectGridVirtualCountlsCustList" resultMap="GridVirtualCustLingshouResult">
        select cust_name, cust_idc, cust_isn, cur_bal_d, cur_bal_t, bal_loan, cur_bal_5_bad, cur_d_ave, cur_t_ave, loan_ave, is_ph, is_sx, is_yxht, is_xyk, fshl, is_sd, etc, dian, is_black, is_bad, ops_dept, cust_type, grid_id, grid_name, grid_type, dept_type, dept_id, dept_name, outlets_id, outlets_name, user_name,
        is_365zf, is_180zf, is_90zf, is_30zf
        from grid_virtual_cust_lingshou
        <where>
            <if test=" dt != null  and dt != ''">and dt = #{dt}</if>
            <if test=" gridId != null  and gridId != ''">and FIND_IN_SET(#{gridId}, grid_id) > 0</if>
            <if test=" custName != null  and custName != ''">and cust_name like concat('%',concat(#{custName},'%'))</if>
            <if test=" custIdc != null  and custIdc != ''">and cust_idc like concat('%',#{custIdc},'%') </if>
            <if test=" isBranch == true">and dept_id like concat('%',concat(#{deptId},'%'))</if>
            <if test=" isOutlet == true">and outlets_id like concat('%',concat(#{deptId},'%'))</if>
            <if test=" isManager == true">and user_name like concat('%',concat(#{userName},'%'))</if>
        </where>
    </select>







    <select id="selectGridVirtualCountLingshouByDt" parameterType="String" resultMap="GridVirtualCountLingshouResult">
        <include refid="selectGridVirtualCountLingshouVo"/>
        where dt = #{dt}
    </select>

    <insert id="insertGridVirtualCountLingshou" parameterType="GridVirtualCountLingshou">
        insert into grid_virtual_count_lingshou
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="dt != null">dt,</if>
            <if test="gridName != null">grid_name,</if>
            <if test="gridType != null">grid_type,</if>
            <if test="createBy != null">create_by,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="deptName != null">dept_name,</if>
            <if test="outletsId != null">outlets_id,</if>
            <if test="outletsName != null">outlets_name,</if>
            <if test="userName != null">user_name,</if>
            <if test="custNum != null">cust_num,</if>
            <if test="curBalD != null">cur_bal_d,</if>
            <if test="curBalT != null">cur_bal_t,</if>
            <if test="balLoan != null">bal_loan,</if>
            <if test="curBal5Bad != null">cur_bal_5_bad,</if>
            <if test="curDAve != null">cur_d_ave,</if>
            <if test="curTAve != null">cur_t_ave,</if>
            <if test="loanAve != null">loan_ave,</if>
            <if test="phRat != null">ph_rat,</if>
            <if test="sxRat != null">sx_rat,</if>
            <if test="yxhtRat != null">yxht_rat,</if>
            <if test="xykRat != null">xyk_rat,</if>
            <if test="fshlRat != null">fshl_rat,</if>
            <if test="sdRat != null">sd_rat,</if>
            <if test="etcRat != null">etc_rat,</if>
            <if test="dianRat != null">dian_rat,</if>
            <if test="blackRat != null">black_rat,</if>
            <if test="badRat != null">bad_rat,</if>
            <if test="badBalRat != null">bad_bal_rat,</if>
            <if test="phNum != null">ph_num,</if>
            <if test="sxNum != null">sx_num,</if>
            <if test="yxhtNum != null">yxht_num,</if>
            <if test="xykNum != null">xyk_num,</if>
            <if test="fshlNum != null">fshl_num,</if>
            <if test="sdNum != null">sd_num,</if>
            <if test="etcNum != null">etc_num,</if>
            <if test="dianNum != null">dian_num,</if>
            <if test="blackNum != null">black_num,</if>
            <if test="badNum != null">bad_num,</if>
            <if test="opsDept != null">ops_dept,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="dt != null">#{dt},</if>
            <if test="gridName != null">#{gridName},</if>
            <if test="gridType != null">#{gridType},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="deptName != null">#{deptName},</if>
            <if test="outletsId != null">#{outletsId},</if>
            <if test="outletsName != null">#{outletsName},</if>
            <if test="userName != null">#{userName},</if>
            <if test="custNum != null">#{custNum},</if>
            <if test="curBalD != null">#{curBalD},</if>
            <if test="curBalT != null">#{curBalT},</if>
            <if test="balLoan != null">#{balLoan},</if>
            <if test="curBal5Bad != null">#{curBal5Bad},</if>
            <if test="curDAve != null">#{curDAve},</if>
            <if test="curTAve != null">#{curTAve},</if>
            <if test="loanAve != null">#{loanAve},</if>
            <if test="phRat != null">#{phRat},</if>
            <if test="sxRat != null">#{sxRat},</if>
            <if test="yxhtRat != null">#{yxhtRat},</if>
            <if test="xykRat != null">#{xykRat},</if>
            <if test="fshlRat != null">#{fshlRat},</if>
            <if test="sdRat != null">#{sdRat},</if>
            <if test="etcRat != null">#{etcRat},</if>
            <if test="dianRat != null">#{dianRat},</if>
            <if test="blackRat != null">#{blackRat},</if>
            <if test="badRat != null">#{badRat},</if>
            <if test="badBalRat != null">#{badBalRat},</if>
            <if test="phNum != null">#{phNum},</if>
            <if test="sxNum != null">#{sxNum},</if>
            <if test="yxhtNum != null">#{yxhtNum},</if>
            <if test="xykNum != null">#{xykNum},</if>
            <if test="fshlNum != null">#{fshlNum},</if>
            <if test="sdNum != null">#{sdNum},</if>
            <if test="etcNum != null">#{etcNum},</if>
            <if test="dianNum != null">#{dianNum},</if>
            <if test="blackNum != null">#{blackNum},</if>
            <if test="badNum != null">#{badNum},</if>
            <if test="opsDept != null">#{opsDept},</if>
        </trim>
    </insert>

    <update id="updateGridVirtualCountLingshou" parameterType="GridVirtualCountLingshou">
        update grid_virtual_count_lingshou
        <trim prefix="SET" suffixOverrides=",">
            <if test="gridName != null">grid_name = #{gridName},</if>
            <if test="gridType != null">grid_type = #{gridType},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="deptName != null">dept_name = #{deptName},</if>
            <if test="outletsId != null">outlets_id = #{outletsId},</if>
            <if test="outletsName != null">outlets_name = #{outletsName},</if>
            <if test="userName != null">user_name = #{userName},</if>
            <if test="custNum != null">cust_num = #{custNum},</if>
            <if test="curBalD != null">cur_bal_d = #{curBalD},</if>
            <if test="curBalT != null">cur_bal_t = #{curBalT},</if>
            <if test="balLoan != null">bal_loan = #{balLoan},</if>
            <if test="curBal5Bad != null">cur_bal_5_bad = #{curBal5Bad},</if>
            <if test="curDAve != null">cur_d_ave = #{curDAve},</if>
            <if test="curTAve != null">cur_t_ave = #{curTAve},</if>
            <if test="loanAve != null">loan_ave = #{loanAve},</if>
            <if test="phRat != null">ph_rat = #{phRat},</if>
            <if test="sxRat != null">sx_rat = #{sxRat},</if>
            <if test="yxhtRat != null">yxht_rat = #{yxhtRat},</if>
            <if test="xykRat != null">xyk_rat = #{xykRat},</if>
            <if test="fshlRat != null">fshl_rat = #{fshlRat},</if>
            <if test="sdRat != null">sd_rat = #{sdRat},</if>
            <if test="etcRat != null">etc_rat = #{etcRat},</if>
            <if test="dianRat != null">dian_rat = #{dianRat},</if>
            <if test="blackRat != null">black_rat = #{blackRat},</if>
            <if test="badRat != null">bad_rat = #{badRat},</if>
            <if test="badBalRat != null">bad_bal_rat = #{badBalRat},</if>
            <if test="phNum != null">ph_num = #{phNum},</if>
            <if test="sxNum != null">sx_num = #{sxNum},</if>
            <if test="yxhtNum != null">yxht_num = #{yxhtNum},</if>
            <if test="xykNum != null">xyk_num = #{xykNum},</if>
            <if test="fshlNum != null">fshl_num = #{fshlNum},</if>
            <if test="sdNum != null">sd_num = #{sdNum},</if>
            <if test="etcNum != null">etc_num = #{etcNum},</if>
            <if test="dianNum != null">dian_num = #{dianNum},</if>
            <if test="blackNum != null">black_num = #{blackNum},</if>
            <if test="badNum != null">bad_num = #{badNum},</if>
            <if test="opsDept != null">ops_dept = #{opsDept},</if>
        </trim>
        where dt = #{dt}
    </update>

    <delete id="deleteGridVirtualCountLingshouByDt" parameterType="String">
        delete from grid_virtual_count_lingshou where dt = #{dt}
    </delete>

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