<?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.qy.worksheetsystem.model.mapper.PersonMapper">

    <select id="getPersonByUserId" resultType="java.util.Map" parameterType="String">
        select p.fid id,p.fnumber number,p.fname_l2 name,
        CONVERT(varchar(10) ,isnull(pp2.FEnterDate,''),120) enterDate,
        btype.fname_l2 btypeName,btype.fid btypeId
        from t_bd_person p
        left join t_pm_user pp on pp.fpersonid=p.fid
        left join T_HR_EMPLABORRELATION pp2 on pp2.FPersonID=p.fid
        left join T_HR_BDEmployeeType btype on btype.fid=pp2.FLaborRelationStateID
        where pp.fid=#{userid}
    </select>

    <select id="getPersonByOpenId" resultType="java.util.Map" parameterType="String">
        select p.fid id,p.fnumber number,p.fname_l2 name,
        CONVERT(varchar(10) ,isnull(pp2.FEnterDate,''),120) enterDate,
        btype.fname_l2 btypeName,btype.fid btypeId

        from t_bd_person p
        left join t_pm_user pp on pp.fpersonid=p.fid
        left join T_HR_EMPLABORRELATION pp2 on pp2.FPersonID=p.fid
        left join T_HR_BDEmployeeType btype on btype.fid=pp2.FLaborRelationStateID
        where pp.fopenid=#{openid}
    </select>

    <select id="getPersonByJobNo" resultType="java.util.Map" parameterType="String">
        select p.fid id,p.fnumber number,p.fname_l2 name,
        CONVERT(varchar(10) ,isnull(pp2.FEnterDate,''),120) enterDate,
        btype.fname_l2 btypeName,btype.fid btypeId
        from t_bd_person p
        left join t_pm_user pp on pp.fpersonid=p.fid
        left join T_HR_EMPLABORRELATION pp2 on pp2.FPersonID=p.fid
        left join T_HR_BDEmployeeType btype on btype.fid=pp2.FLaborRelationStateID
        where p.fnumber=#{jobNo}
    </select>
</mapper>