<?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.jeeplus.business.humanResources.mapper.StaffHeirMapper">
    <update id="updateHeirStatusById">
        update staff_heir set status = #{status},update_by_id = #{userId} where id=#{id}
    </update>

    <select id="findHeirById" resultType="com.jeeplus.business.humanResources.service.dto.StaffHeirDTO">
        select
            a.id,
            a.create_by_id,
            a.create_time,
            a.heir,
            a.status,
            a.proc_ins_id,
            a.process_definition_id,
            su.name as createName,
            so.name as officeName
        from
            staff_heir a
        left join sys_user su on a.create_by_id = su.id and su.del_flag = '0'
        left join sys_office so on su.office_id = so.id and so.del_flag = '0'
        where a.id=#{id}
    </select>

    <select id="getList" resultType="com.jeeplus.business.humanResources.service.dto.StaffHeirDTO">
        select
            a.id,
            a.create_by_id,
            a.create_time,
            a.heir,
            a.status,
            a.proc_ins_id,
            a.process_definition_id
        from
            staff_heir a
        where a.del_flag = '0'
    </select>
    <update id="updateUserById">
        update sys_user set login_flag = #{loginFlag} where id = #{id}
    </update>
</mapper>