<?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.LeakAssessmentMapper">

    <resultMap id="leakAssessmentMap" type="com.tofly.xrtygis.entity.LeakAssessment">
        <id property="id" column="ID"/>
        <result property="dmaLevle" column="DMA_LEVLE"/>
        <result property="leakAssessment" column="LEAK_ASSESSMENT"/>
        <result property="leakUp" column="LEAK_UP"/>
        <result property="leakDown" column="LEAK_DOWN"/>
        <result property="createTime" column="CREATE_TIME"/>
        <result property="createUser" column="CREATE_USER"/>
        <association property="createUserName" column="CREATE_USER"
                     select="com.tofly.xrtygis.mapper.IFileMapper.getUserName"/>
        <association property="dmaLevleName"  column="DMA_LEVLE" select="getDmaLevleName"/>
        <association property="leakAssessmentName"  column="LEAK_ASSESSMENT" select="getLeakAssessmentName"/>
    </resultMap>
    <select id="getDmaLevleName" resultType="string">
        SELECT decode(#{dmaLevle},'1','一级','2','二级','3','三级') as dmaLevleName FROM dual
    </select>

    <select id="getLeakAssessmentName" resultType="string">
        SELECT decode(#{leakAssessment},'0','合格','1','一般','2','严重') as leakAssessmentName FROM dual
    </select>

</mapper>
