import org.apache.ibatis.annotations.Mapper; | import org.apache.ibatis.annotations.Mapper; | ||||
import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||
import java.time.LocalDate; | |||||
import java.util.List; | import java.util.List; | ||||
@Mapper | @Mapper | ||||
public interface DkRecordMapper extends BaseMapperPlus<DkRecordMapper, DkCheckInRecord, DkCheckInRecordDTO> { | public interface DkRecordMapper extends BaseMapperPlus<DkRecordMapper, DkCheckInRecord, DkCheckInRecordDTO> { | ||||
public List<DkCheckInRecord> getCurrentDayRecord(@Param("userId") long userId); | |||||
public List<DkCheckInRecord> getCurrentDayRecord(@Param("userId") long userId, @Param("currentDate") LocalDate currentDate); | |||||
public List<DkCheckInRecord> queryCurrentDayOutRecord(@Param("userId") long userId); | public List<DkCheckInRecord> queryCurrentDayOutRecord(@Param("userId") long userId); | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.time.Duration; | import java.time.Duration; | ||||
import java.time.LocalDate; | |||||
import java.time.LocalTime; | import java.time.LocalTime; | ||||
import java.time.format.DateTimeFormatter; | import java.time.format.DateTimeFormatter; | ||||
import java.time.format.DateTimeParseException; | import java.time.format.DateTimeParseException; | ||||
@Override | @Override | ||||
public List<DkCheckInRecord> getCurrentDayRecord(AppDTO appDTO) { | public List<DkCheckInRecord> getCurrentDayRecord(AppDTO appDTO) { | ||||
List<DkCheckInRecord> currentDayRecords = dkRecordMapper.getCurrentDayRecord(appDTO.getUserId()); | |||||
LocalDate currentDate = LocalDate.now(); | |||||
List<DkCheckInRecord> currentDayRecords = dkRecordMapper.getCurrentDayRecord(appDTO.getUserId(), currentDate); | |||||
return currentDayRecords; | return currentDayRecords; | ||||
} | } | ||||
} | } |
<if test="userId != null and userId != ''"> | <if test="userId != null and userId != ''"> | ||||
AND sys_user_id = #{userId} | AND sys_user_id = #{userId} | ||||
</if> | </if> | ||||
<if test="currentDate != null "> | |||||
AND create_time = #{currentDate} | |||||
</if> | |||||
</where> | </where> | ||||
</select> | </select> | ||||