<?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.attendance.mapper.AttendanceSelfApproveMapper" >

  <sql id="Base_Column_List" >
    F_Id, F_Group_Id, F_Self_Group_Id, F_User_Id, F_Start_Time, F_End_Time, F_Departure_Time, 
    f_flowtaskid, f_flowid, F_UniqueId, F_TenantId
  </sql>
<!--  时间段内存在多个考勤组查询对应的借调信息-->
    <select id="getSelfApprove" resultType="jnpf.model.attendance.vo.DailyRuleResultVo">
      SELECT F_Start_Time inPoint ,F_End_Time outPoint , F_Departure_Time departureTime,F_Back_Time backTime ,(
          select  F_GroupName from ftb_attendance_group where F_Id = asa.F_Group_Id
        ) groupName
      FROM ftb_attendance_self_approve asa
      LEFT JOIN ftb_attendance_self_approve_user asau ON asa.F_Id = asau.F_Self_Id
      WHERE asa.F_Status = 1 AND asau.F_User_Id = #{userId}
         <![CDATA[
          AND DATE_FORMAT(F_Start_Time,'%Y-%m-%d %H:%i') < DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i')
          AND DATE_FORMAT(F_End_Time,'%Y-%m-%d %H:%i') > DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i')
        ]]>
    </select>

    <!--  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >-->
<!--    delete from ftb_attendance_self_approve-->
<!--    where F_Id = #{fId,jdbcType=VARCHAR}-->
<!--  </delete>-->
<!--  <insert id="insert" parameterType="com.shs.cts.util.domain.po.experience.AttendanceSelfApprove" >-->
<!--    insert into ftb_attendance_self_approve (F_Id, F_Group_Id, F_Self_Group_Id, -->
<!--      F_User_Id, F_Start_Time, F_End_Time, -->
<!--      F_Departure_Time, f_flowtaskid, f_flowid, -->
<!--      F_UniqueId, F_TenantId)-->
<!--    values (#{fId,jdbcType=VARCHAR}, #{fGroupId,jdbcType=VARCHAR}, #{fSelfGroupId,jdbcType=VARCHAR}, -->
<!--      #{fUserId,jdbcType=VARCHAR}, #{fStartTime,jdbcType=TIMESTAMP}, #{fEndTime,jdbcType=TIMESTAMP}, -->
<!--      #{fDepartureTime,jdbcType=TIMESTAMP}, #{fFlowtaskid,jdbcType=VARCHAR}, #{fFlowid,jdbcType=VARCHAR}, -->
<!--      #{fUniqueid,jdbcType=VARCHAR}, #{fTenantid,jdbcType=VARCHAR})-->
<!--  </insert>-->
<!-- -->
<!--  <update id="updateByPrimaryKey" parameterType="com.shs.cts.util.domain.po.experience.AttendanceSelfApprove" >-->
<!--    update ftb_attendance_self_approve-->
<!--    set F_Group_Id = #{fGroupId,jdbcType=VARCHAR},-->
<!--      F_Self_Group_Id = #{fSelfGroupId,jdbcType=VARCHAR},-->
<!--      F_User_Id = #{fUserId,jdbcType=VARCHAR},-->
<!--      F_Start_Time = #{fStartTime,jdbcType=TIMESTAMP},-->
<!--      F_End_Time = #{fEndTime,jdbcType=TIMESTAMP},-->
<!--      F_Departure_Time = #{fDepartureTime,jdbcType=TIMESTAMP},-->
<!--      f_flowtaskid = #{fFlowtaskid,jdbcType=VARCHAR},-->
<!--      f_flowid = #{fFlowid,jdbcType=VARCHAR},-->
<!--      F_UniqueId = #{fUniqueid,jdbcType=VARCHAR},-->
<!--      F_TenantId = #{fTenantid,jdbcType=VARCHAR}-->
<!--    where F_Id = #{fId,jdbcType=VARCHAR}-->
<!--  </update>-->



</mapper>