1
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package com.kkz.kpersonalre.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @ClassName MyMetaObjectHandler
|
||||
* @Description 自动填充功能
|
||||
* @Author 孔成文
|
||||
* @Date 2022/9/7 15:12
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler {
|
||||
|
||||
/**
|
||||
* 默认未逻辑删除
|
||||
*/
|
||||
private final boolean DEL_FLAG = false;
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
//此项自动填充,但数据库内也会自动填充,双重保险
|
||||
this.strictInsertFill(metaObject, "deleted", boolean.class, DEL_FLAG);
|
||||
this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
this.strictInsertFill(metaObject, "updatedTime", LocalDateTime.class, LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
@@ -121,11 +121,11 @@ public class AlarmServiceImpl implements AlarmService {
|
||||
public R<LocalTime> getAlarm(String username) {
|
||||
|
||||
//判断今天是不是工作日
|
||||
DateWeekdayEntity dateWeekdayEntity = dateWeekdayMapper.selectOne(new LambdaQueryWrapper<DateWeekdayEntity>()
|
||||
.eq(DateWeekdayEntity::getDate, LocalDate.now()));
|
||||
if (BeanUtil.isEmpty(dateWeekdayEntity) || dateWeekdayEntity.getHolidayFlag()) {
|
||||
return R.failed("今天放假");
|
||||
}
|
||||
// DateWeekdayEntity dateWeekdayEntity = dateWeekdayMapper.selectOne(new LambdaQueryWrapper<DateWeekdayEntity>()
|
||||
// .eq(DateWeekdayEntity::getDate, LocalDate.now()));
|
||||
// if (BeanUtil.isEmpty(dateWeekdayEntity) || dateWeekdayEntity.getHolidayFlag()) {
|
||||
// return R.failed("今天放假");
|
||||
// }
|
||||
//找到人
|
||||
PersonConfigEntity personConfigEntity = personConfigMapper.selectOne(new LambdaQueryWrapper<PersonConfigEntity>()
|
||||
.eq(PersonConfigEntity::getPerson, username));
|
||||
@@ -193,7 +193,9 @@ public class AlarmServiceImpl implements AlarmService {
|
||||
LambdaQueryWrapper<LocationUploadEntity> query = new LambdaQueryWrapper<>();
|
||||
query
|
||||
.eq(LocationUploadEntity::getLocationConfigId, locationId)
|
||||
.eq(LocationUploadEntity::getPersonConfigId, personId);
|
||||
.eq(LocationUploadEntity::getPersonConfigId, personId)
|
||||
.ge(LocationUploadEntity::getCreateTime, LocalDate.now())
|
||||
;
|
||||
List<LocationUploadEntity> locationUploadEntities = locationUploadMapper.selectList(query);
|
||||
if (locationUploadEntities.isEmpty()) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user