<!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.GridUnionCountMapper">

    <select id="selectLsCountList" resultType="com.ruoyi.ibs.grid.domain.entity.GridUnionCmpmLingshou">
        SELECT dt, dept_type, ops_dept, dept_id, outlets_id, 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, zf_365cnt, zf_180cnt, zf_90cnt, zf_30cnt, zf_365rt, zf_180rt, zf_90rt, zf_30rt
        FROM grid_union_cmpm_lingshou
        <where>
            dept_type = #{userRole}
            <if test=" isBranch == true">
                and dept_id = #{deptId}
            </if>
            <if test=" isOutlet == true">
                and outlets_id = #{deptId}
            </if>
            <if test=" isManager == true">
                and user_name = #{userName}
            </if>
        </where>
    </select>

    <select id="selectGsCountList" resultType="com.ruoyi.ibs.grid.domain.entity.GridUnionCmpmGongsi">
        SELECT dt, dept_type, ops_dept, dept_id, outlets_id, user_name, cust_num, hq_cur_balance, bz_cur_balance,
        loan_balance_cny, finance_prod_711_balance, finance_prod_716_balance, loan_year_dailyaverage, htqy_rat,
        qfcd_rat, tx_rat, bh_rat, yxdfgz_rat, dkdf_rat, dksf_rat, dkshf_rat, pjb_rat, czb_rat, sfb_rat, mrb_rat,
        szst_rat, kh_rat, gjjsyw_rat, yqjsh_rat, htqy_num, qfcd_num, tx_num, bh_num, yxdfgz_num, ustr_count_per_m,
        ustr_bal_m, dkdf_num, dksf_num, dkshf_num, pjb_num, czb_num, sfb_num, mrb_num, szst_num, kh_num, gjjsyw_num,
        yqjsh_num, zf_365cnt, zf_180cnt, zf_90cnt, zf_30cnt, zf_365rt, zf_180rt, zf_90rt, zf_30rt
        FROM grid_union_cmpm_gongsi
        <where>
            dept_type = #{userRole}
            <if test=" isBranch == true">
                and dept_id = #{deptId}
            </if>
            <if test=" isOutlet == true">
                and outlets_id = #{deptId}
            </if>
            <if test=" isManager == true">
                and user_name = #{userName}
            </if>
        </where>
    </select>
    <select id="selectLsCustList" resultType="com.ruoyi.ibs.grid.domain.entity.GridUnionCustLingshou">
        SELECT ops_dept, dept_id, dept_name, outlets_id, outlets_name, user_name, 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, is_365zf, is_180zf, is_90zf, is_30zf,cust_type
        FROM grid_union_cust_lingshou
        <where>
            <if test=" dt != null  and dt != ''">and dt = #{dt}</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>
            <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('%',concat(#{custIdc},'%'))
            </if>
        </where>
    </select>


    <select id="selectGsCustList" resultType="com.ruoyi.ibs.grid.domain.entity.GridUnionCustGongsi">
        SELECT ops_dept, dept_id, dept_name, outlets_id, outlets_name, user_name, 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, is_365zf, is_180zf, is_90zf, is_30zf,cust_type
        FROM grid_union_cust_gongsi
        <where>
            <if test=" dt != null  and dt != ''">and dt = #{dt}</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>
            <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('%',concat(#{socialCreditCode},'%'))
            </if>
        </where>
    </select>

    <select id="selectLsCustListLimit" resultType="com.ruoyi.ibs.grid.domain.entity.GridUnionCustLingshou">
        SELECT ops_dept, dept_id, dept_name, outlets_id, outlets_name, user_name, 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, is_365zf, is_180zf, is_90zf, is_30zf,cust_type
        FROM grid_union_cust_lingshou
        <where>
            <if test=" dt != null  and dt != ''">and dt = #{dt}</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>
            <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('%',concat(#{custIdc},'%'))
            </if>
        </where>
        limit 1000
    </select>


    <select id="selectGsCustListLimit" resultType="com.ruoyi.ibs.grid.domain.entity.GridUnionCustGongsi">
        SELECT ops_dept, dept_id, dept_name, outlets_id, outlets_name, user_name, 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, is_365zf, is_180zf, is_90zf, is_30zf,cust_type
        FROM grid_union_cust_gongsi
        <where>
            <if test=" dt != null  and dt != ''">and dt = #{dt}</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>
            <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('%',concat(#{socialCreditCode},'%'))
            </if>
        </where>
        limit 1000
    </select>
</mapper>