<?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.tofly.xrtygis.mapper.TfKpiPersonManageMapper">

    <resultMap id="tfKpiPersonManageMap" type="com.tofly.xrtygis.entity.TfKpiPersonManage">
        <id property="id" column="ID"/>
        <result property="assessPerson" column="ASSESS_PERSON"/>
        <result property="assessDuty" column="ASSESS_DUTY"/>
        <result property="assessArea" column="ASSESS_AREA"/>
        <result property="createUser" column="CREATE_USER"/>
        <result property="createTime" column="CREATE_TIME"/>
        <result property="assessStandard" column="ASSESS_STANDARD"/>
        <result property="assessContent" column="ASSESS_CONTENT"/>
        <result property="assessType" column="ASSESS_TYPE"/>
        <association property="assessContentName"  column="ASSESS_CONTENT" select="getAssessContentName" ></association>
        <association property="assessTypeName" column="ASSESS_TYPE" select="getAssessTypeName"></association>
        <association property="createUserName"  column="CREATE_USER" select="com.tofly.xrtygis.mapper.IFileMapper.getUserName" ></association>
        <association property="assessPersonName"  column="ASSESS_PERSON" select="com.tofly.xrtygis.mapper.IFileMapper.getUserName" ></association>
        <association property="assessDutyName"  column="ASSESS_DUTY" select="getAssessDutyName" ></association>
        <association property="areaLevel"  column="ASSESS_AREA" select="getAreaLevelName" ></association>
        <association property="assessAreaName"  column="ASSESS_AREA" select="getAssessAreaName" ></association>
    </resultMap>

    <select id="getAssessTypeName" resultType="string">
        SELECT decode(#{assessType},'1','按季度','2','按年度') as assessTypeName FROM dual
    </select>

    <select id="getAssessContentName" resultType="string">
        SELECT CNAME
        FROM
            TF_YWPN_SYSCHILDCODE_D
        WHERE
            PCID =1001
          AND
            CCODE = #{assessContent}
    </select>

    <select id="getAssessDutyName" resultType="string">
        SELECT decode(#{assessDuty},'1','巡线人员','2','处漏人员','3','区域运维人员') as assessDutyName FROM dual
    </select>

    <select id="getAreaLevelName" resultType="string">
        select PARTITION_LEVEL as areaLevel
        from TF_YWPN_DMAREGION_W
        where DMA_CODE = #{assessArea}
    </select>

    <select id="getAssessAreaName" resultType="string">
        select DMA_NAME
        from TF_YWPN_DMAREGION_W
        where DMA_CODE = #{assessArea}
    </select>

</mapper>