<?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.QueryBIArchievementDataMapper">
    
    <!-- 查询坐席车非渗透率报表 -->
    <select id="queryBITelsalerAttachingRate" statementType="STATEMENT" resultMap="BITelsalerAttachingRate" useCache="false" flushCache="true">
    SELECT t.部门,
       t.经办,
       t."车险保费(万)" as 车险保费,
       t.车险保费占比,
       t."非车保费(万)" as 非车保费,
       t.当月保费渗透率,
       t.保费渗透率环比上月,
       t.当月客户渗透率,
       t.客户渗透率环比上月,
       t.当月车非客均保费,
       t.客均保费环比上月
    FROM BI电销坐席车非渗透率跟踪表 t
   ORDER BY t.部门
    </select>
    <!-- 坐席车非渗透率报表记录 -->
    <resultMap id="BITelsalerAttachingRate" type="com.cpic.xim.mybatis.pojo.BITelsalerAttachingRateRecord">
        <result property="departmentName" column="部门" javaType="String" jdbcType="VARCHAR" />
        <result property="telsalerName" column="经办" javaType="String" jdbcType="VARCHAR" />
        <result property="motoPremium" column="车险保费" javaType="double" jdbcType="DOUBLE" />
        <result property="motoPremiumProportion" column="车险保费占比" javaType="double" jdbcType="DOUBLE" />
        <result property="nomotoPremium" column="非车保费" javaType="double" jdbcType="DOUBLE" />
        <result property="attachingRate" column="当月保费渗透率" javaType="double" jdbcType="DOUBLE" />
        <result property="attachingRateChange" column="保费渗透率环比上月" javaType="double" jdbcType="DOUBLE" />
        <result property="customerHandleRate" column="当月客户渗透率" javaType="double" jdbcType="DOUBLE" />
        <result property="customerHandleRateChange" column="客户渗透率环比上月" javaType="double" jdbcType="DOUBLE" />
        <result property="noMotoPremiumPerCustomer" column="当月车非客均保费" javaType="double" jdbcType="DOUBLE" />
        <result property="noMotoPremiumPerCustomerChange" column="客均保费环比上月" javaType="double" jdbcType="DOUBLE" />
    </resultMap>

    <!-- 坐席续保率 -->
    <select id="queryBITesalerRenewalRate" statementType="STATEMENT" resultMap="BITelsalerRenewalRate" useCache="false" flushCache="true">
        select t.责任部门,
            t.责任人,
            t."机构目标值1(%)" as 机构目标值,
            t."到期数-全月" as 到期数全月,
            t."序时到期数占比(%)" as 序时到期数占比,
            t."个车续保率（序时）(%)" as 个车续保率序时,
            t."个车续保率（全月）(%)" as 个车续保率全月,
            t."环比昨日(%)" as 环比昨日,
            t."环比上月(%)" as 环比上月
        from "BI电销坐席续保率跟踪表-24年" t
    </select>
    <resultMap id="BITelsalerRenewalRate" type="com.cpic.xim.mybatis.pojo.BITelsalerRenewalRateRecord">
        <result property="责任部门" column="责任部门" javaType="String" jdbcType="VARCHAR" />
        <result property="责任人" column="责任人" javaType="String" jdbcType="VARCHAR" />
        <result property="机构目标值" column="机构目标值" javaType="double" jdbcType="DOUBLE" />
        <result property="到期数全月" column="到期数全月" javaType="double" jdbcType="DOUBLE" />
        <result property="序时到期数占比" column="序时到期数占比" javaType="double" jdbcType="DOUBLE" />
        <result property="个车续保率序时" column="个车续保率序时" javaType="double" jdbcType="DOUBLE" />
        <result property="个车续保率全月" column="个车续保率全月" javaType="double" jdbcType="DOUBLE" />
        <result property="环比昨日" column="环比昨日" javaType="double" jdbcType="DOUBLE" />
        <result property="环比上月" column="环比上月" javaType="double" jdbcType="DOUBLE" />
        <!-- <result property="平均提前签单天数" column="平均提前签单天数" javaType="int" jdbcType="DOUBLE" /> -->
        <!-- <result property="环比" column="环比" javaType="int" jdbcType="DOUBLE" /> -->
    </resultMap>

    <!-- 机构渗透率 -->
    <select id="queryBIDepartmentAttachingRate" statementType="STATEMENT" resultMap="BIDepartmentAttachingRate" useCache="false" flushCache="true">
        select t.部门,
            t."目标值-机构" as 目标值机构,
            t.目标差距,
            t.车险保费,
            t.车险保费占比,
            t.非车保费,
            t.当月保费渗透率,
            t.保费渗透率环比上月,
            t.当月客户渗透率,
            t.客户渗透率环比上月,
            t.当月车非客均保费,
            t.客均保费环比上月,
            t.车险客户数
        from BI机构渗透率跟踪表 t
    </select>
    <resultMap id="BIDepartmentAttachingRate" type="com.cpic.xim.mybatis.pojo.BIDepartmentAttachingRateRecord">
        <result column="部门" property="departmentName" jdbcType="VARCHAR" javaType="String" />
        <result column="目标值机构" property="departmentObject" jdbcType="DOUBLE" javaType="double" />
        <result column="目标差距" property="objectGap" jdbcType="DOUBLE" javaType="double" />
        <result column="车险保费" property="motoPremium" jdbcType="DOUBLE" javaType="double" />
        <result column="车险保费占比" property="motoPremiumProPortion" jdbcType="DOUBLE" javaType="double" />
        <result column="非车保费" property="nomotoPremium" jdbcType="DOUBLE" javaType="double" />
        <result column="当月保费渗透率" property="attachingRate" jdbcType="DOUBLE" javaType="double" />
        <result column="保费渗透率环比上月" property="attachingRateChange" jdbcType="DOUBLE" javaType="double" />
        <result column="当月客户渗透率" property="customerHandleRate" jdbcType="DOUBLE" javaType="double" />
        <result column="客户渗透率环比上月" property="customerHandleRateChange" jdbcType="DOUBLE" javaType="double" />
        <result column="当月车非客均保费" property="premiumPerCustomer" jdbcType="DOUBLE" javaType="double" />
        <result column="客均保费环比上月" property="premiumPerCustomerChange" jdbcType="DOUBLE" javaType="double" />
        <result column="车险客户数" property="motoInsuranceCustomerCount" jdbcType="INTEGER" javaType="int" />
    </resultMap>

    <!-- 机构续保率 -->
    <select id="queryBIDepartmentRenewalRate" statementType="STATEMENT" resultMap="BIDepartmentRenewalRate" useCache="false" flushCache="true">
         select t.责任部门,
                t."机构目标值1(%)" as 机构目标值,
                t."到期数-全月" as 到期数全月,
                t."序时到期数占比(%)" as 序时到期数占比,
                t."个车续保率（序时）(%)" as 个车续保率序时,
                t."个车续保率（全月）(%)" as 个车续保率全月,
                t."环比昨日(%)" as 环比昨日,
                t."环比上月(%)" as 环比上月
           from "BI机构续保率跟踪表-24年" t
    </select>
    <resultMap id="BIDepartmentRenewalRate" type="com.cpic.xim.mybatis.pojo.BIDepartmentRenewalRateRecord">
        <result column="责任部门" property="责任部门" jdbcType="VARCHAR" javaType="String" />
        <result column="机构目标值" property="机构目标值" jdbcType="DOUBLE" javaType="double" />
        <result column="到期数全月" property="到期数全月" jdbcType="INTEGER" javaType="int" />
        <result column="序时到期数占比" property="序时到期数占比" jdbcType="DOUBLE" javaType="double" />
        <result column="个车续保率序时" property="个车续保率序时" jdbcType="DOUBLE" javaType="double" />
        <result column="个车续保率全月" property="个车续保率全月" jdbcType="DOUBLE" javaType="double" />
        <result column="环比昨日" property="环比昨日" jdbcType="DOUBLE" javaType="double" />
        <result column="环比上月" property="环比上月" jdbcType="DOUBLE" javaType="double" />
        <!-- <result column="平均提前签单天数" property="平均提前签单天数" jdbcType="INTEGER" javaType="int" /> -->
        <!-- <result column="环比" property="环比" jdbcType="DOUBLE" javaType="double" /> -->
    </resultMap>
</mapper>