<?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.xrtymis.mapper.DutyrosterMapper">

    <resultMap id="dutyrosterMap" type="com.tofly.xrtymis.entity.Dutyroster">
        <id property="id" column="ID"/>
        <result property="dutyUser" column="DUTY_USER"/>
        <result property="workTime" column="WORK_TIME"/>
        <result property="dutyDate" column="DUTY_DATE"/>
        <result property="createTime" column="CREATE_TIME"/>
        <result property="createUser" column="CREATE_USER"/>
        <result property="deptId" column="DEPT_ID"/>
        <result property="isHis" column="IS_HIS"/>
        <association property="dutyUserName" column="DUTY_USER"
                     select="com.tofly.baseapi.mapper.ToflyCodeCommonMapper.getUserName"/>
        <association property="createUserName" column="CREATE_USER"
                     select="com.tofly.baseapi.mapper.ToflyCodeCommonMapper.getUserName"/>
        <association property="workName" column="WORK_TIME" select="getWorkName"/>
    </resultMap>

    <select id="getWorkName" resultType="string">
        select decode(#{workTime}, '1', '白班', '2', '夜班', '3', '休息')
        from dual
    </select>
</mapper>
