<?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.ruoyi.zhushi.mapper.DkRecordMapper">
    <resultMap id="DkRecordResult" type="com.ruoyi.zhushi.entity.DkCheckInRecord">
        <id property="id" column="id"/>
        <result property="sysUserId" column="sys_user_id"/>
        <result property="sysUserName" column="sys_user_name"/>
        <result property="checkInTime" column="check_in_time"/>
        <result property="latitude" column="latitude"/>
        <result property="longitude" column="longitude"/>
        <result property="checkInStatus" column="check_in_status"/>
        <result property="checkInType" column="check_in_type"/>
    </resultMap>

    <select id="getCurrentDayRecord" resultType="com.ruoyi.zhushi.entity.DkCheckInRecord">
        select * from dk_check_in_record
        <where>
            create_time >= CURDATE() AND create_time &lt; CURDATE() + INTERVAL 1 DAY
            <if test="userId != null and userId != ''">
                AND sys_user_id = #{userId}
            </if>
        </where>
    </select>

    <select id="queryConfigByUserId" resultType="com.ruoyi.zhushi.entity.DkAttendanceGroup">
        select DISTINCT t.* from dk_check_in_attendance_team_and_user  tu
        left join dk_check_in_attendance_team t on t.id = tu.attendance_team_id
        <where>
            <if test="userId != null and userId != ''">
                AND tu.user_id = #{userId}
            </if>
        </where>
    </select>
</mapper>
