<?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.gyt.shr.mapper.EleProofMapper">



    <select id="getCertificatByPerson" parameterType="String" resultMap="DetailedCertificationBillResultMap">
        SELECT
            bill.fnumber    as fnumber,
            ftype.fname_l2  as typeName,
            bill.FBIZDATE   as bizDate,
            mlogs.fid         as fid,
            bill.FPersonID    as personId,
            mlogs.CFUrldir    as urlDir,
            mlogs.CFFileName  as fileName,
            mlogs.CFUrlPath   as urlPath
        FROM T_HR_HRCertificationBill bill
                 LEFT JOIN CT_LOG_MessageLogs mlogs
                           ON bill.fnumber COLLATE Chinese_PRC_CI_AS = mlogs.CFBillNo COLLATE Chinese_PRC_CI_AS
                               AND bill.FPersonID = mlogs.CFPersonID
                 LEFT JOIN T_HR_HRCertificationBillType ftype
                           ON bill.FCertificationBillTypeId = ftype.fid
        WHERE mlogs.CFPersonID = #{CFPersonID} and mlogs.cfisvaild = 1
        ORDER BY mlogs.cftime DESC
    </select>

    <resultMap id="DetailedCertificationBillResultMap" type="com.gyt.shr.entity.DetailedCertificationBill">
        <result property="fnumber"  column="fnumber" jdbcType="VARCHAR"/>
        <result property="typeName" column="typeName" jdbcType="VARCHAR"/>
        <result property="bizDate"  column="bizDate" jdbcType="DATE"/>
        <result property="fid"      column="fid" jdbcType="VARCHAR"/>
        <result property="personId" column="personId" jdbcType="VARCHAR"/>
        <result property="urlPath"  column="urlPath" jdbcType="VARCHAR"/>
    </resultMap>

</mapper>
