<?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="jnpf.workflow.mapper.SelfApproveUserMapper" >

<!--    批量新增借调申请中的被借调用户信息-->
    <insert id="addList">
        insert into ftb_attendance_self_approve_user (  F_Self_Id,   F_User_Id   )
        values
        <foreach collection="userIds" item="item" separator=",">
            ( #{id}, #{item})
        </foreach>
    </insert>
    <insert id="addUserList">
        insert into ftb_attendance_self_approve_user (  F_Self_Id,   F_User_Id ,F_User_Name   )
        values
        <foreach collection="userSelfDtos" item="item" separator=",">
            ( #{id}, #{item.userId},#{item.userName})
        </foreach>
    </insert>
<!--    绑定被借调用户-->
    <insert id="addUserListForOa">
        insert into ftb_attendance_self_approve_user (  F_Self_Id,   F_User_Id    )
        values
        <foreach collection="userIds" item="item" separator=",">
            ( #{id}, #{item})
        </foreach>
    </insert>
    <!--    根据借调申请id删除关联的用户信息-->
    <delete id="deleteById">
        delete from ftb_attendance_self_approve_user
        where F_Self_Id = #{id}
    </delete>
<!--    获取借调审批对应的借调用户列表-->
    <select id="getListById" resultType="jnpf.model.workflow.dto.UserSelfDto">
        select  F_User_Id userId, F_User_Name userName
        from  ftb_attendance_self_approve_user
        where F_Self_Id = #{id}
    </select>
    <select id="getIdListById" resultType="java.lang.String">
        select  F_User_Id
        from  ftb_attendance_self_approve_user
        where F_Self_Id = #{id}
    </select>
</mapper>