<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper  PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cpic.xim.mybatis.mapper.ImportBIArchievementDataMapper">
    <insert id="insertTelsalerAttachingRateDataToDB" parameterType="com.cpic.xim.mybatis.pojo.BITelsalerAttachingRateRecord">
        insert into BI电销坐席车非渗透率跟踪表 ( "部门","经办","车险保费(万)","车险保费占比","非车保费(万)",
        "当月保费渗透率","保费渗透率环比上月","当月客户渗透率","客户渗透率环比上月",
        "当月车非客均保费","客均保费环比上月" )
        values ( #{departmentName}, #{telsalerName}, #{motoPremium}, #{motoPremiumProportion}, #{nomotoPremium}, 
                 #{attachingRate},  #{attachingRateChange}, #{customerHandleRate},
                 #{customerHandleRateChange}, #{noMotoPremiumPerCustomer}, #{noMotoPremiumPerCustomerChange} )
    </insert>

    <insert id="insertTelsalerRenewalRateDataToDB" parameterType="com.cpic.xim.mybatis.pojo.BITelsalerRenewalRateRecord">
        insert into "BI电销坐席续保率跟踪表-24年" ("责任部门","责任人","机构目标值1(%)","到期数-全月",
                                         "序时到期数占比(%)","个车续保率（序时）(%)","个车续保率（全月）(%)",
                                         "环比昨日(%)","环比上月(%)")
        values (#{责任部门},#{责任人},#{机构目标值},#{到期数全月},#{序时到期数占比},
        #{个车续保率序时},#{个车续保率全月},#{环比昨日},#{环比上月} )
    </insert>

    <insert id="insertDepartmentAttachingRateDataToDB" parameterType="com.cpic.xim.mybatis.pojo.BIDepartmentAttachingRateRecord">
        insert into BI机构渗透率跟踪表 ( 部门,"目标值-机构",目标差距,"车险保费",
        车险保费占比,"非车保费",当月保费渗透率,保费渗透率环比上月,当月客户渗透率,
        客户渗透率环比上月,当月车非客均保费,客均保费环比上月,车险客户数)
        values (#{departmentName},#{departmentObject},#{objectGap},#{motoPremium},
        #{motoPremiumProPortion},#{nomotoPremium},#{attachingRate},#{attachingRateChange},
        #{customerHandleRate},#{customerHandleRateChange},#{premiumPerCustomer},#{premiumPerCustomerChange},
        #{motoInsuranceCustomerCount} )
    </insert>

    <insert id="insertDepartmentRenewalRateDataToDB" parameterType="com.cpic.xim.mybatis.pojo.BIDepartmentRenewalRateRecord" >
        insert into "BI机构续保率跟踪表-24年"( "责任部门","机构目标值1(%)","到期数-全月" ,"序时到期数占比(%)","个车续保率（序时）(%)",
        "个车续保率（全月）(%)","环比昨日(%)","环比上月(%)")
        values (#{责任部门},#{机构目标值},#{到期数全月},#{序时到期数占比},
        #{个车续保率序时},#{个车续保率全月},#{环比昨日},#{环比上月} )
    </insert>

    <select id="cleanTelsalerAttachingRateData" statementType="CALLABLE">
        call TELSALE_BI_UTILS.清理BI电销坐席车非渗透率跟踪表()
    </select>
    <select id="cleanTelsalerRenewalRateData" statementType="CALLABLE">
        call TELSALE_BI_UTILS.清理BI电销坐席续保率跟踪表()
    </select>
    <select id="cleanDepartmentAttachingRateData" statementType="CALLABLE">
        call TELSALE_BI_UTILS.清理BI部门渗透率跟踪表()
    </select>

    <select id="cleanDepartmentRenewalRateData" statementType="CALLABLE">
        call TELSALE_BI_UTILS.清理BI部门续保率跟踪表()
    </select>
</mapper>