diff --git a/src/main/java/com/ydool/platform/mybatis/handler/CustomMetaObjectHandler.java b/src/main/java/com/ydool/platform/mybatis/handler/CustomMetaObjectHandler.java index 16d6a2f..b6fea7f 100644 --- a/src/main/java/com/ydool/platform/mybatis/handler/CustomMetaObjectHandler.java +++ b/src/main/java/com/ydool/platform/mybatis/handler/CustomMetaObjectHandler.java @@ -25,10 +25,10 @@ public class CustomMetaObjectHandler implements MetaObjectHandler { */ @Override public void insertFill(MetaObject metaObject) { - String scheduled = getScheduled(); - this.setFieldValByName("createdId", StrUtil.isNotBlank(scheduled) ? "":StpUtil.getLoginIdAsString(), metaObject); + Boolean flag = getScheduled(); + this.setFieldValByName("createdId", flag ? null:StpUtil.getLoginIdAsString(), metaObject); this.setFieldValByName("createdAt", LocalDateTime.now(), metaObject); - this.setFieldValByName("updatedId", StrUtil.isNotBlank(scheduled) ? "":StpUtil.getLoginIdAsString(), metaObject); + this.setFieldValByName("updatedId", flag ? null:StpUtil.getLoginIdAsString(), metaObject); this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject); } @@ -39,14 +39,18 @@ public class CustomMetaObjectHandler implements MetaObjectHandler { */ @Override public void updateFill(MetaObject metaObject) { - String scheduled = getScheduled(); - this.setFieldValByName("updatedId", StrUtil.isNotBlank(scheduled) ? "":StpUtil.getLoginIdAsString(), metaObject); + Boolean flag = getScheduled(); + this.setFieldValByName("updatedId", flag ? null:StpUtil.getLoginIdAsString(), metaObject); this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject); } - public String getScheduled() { + public Boolean getScheduled() { + Boolean flag= false; String scheduled = CacheUtil.get(ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, "scheduled").toString(); - return scheduled; + if ("true".equals(scheduled)){ + return flag = true; + } + return flag; } } diff --git a/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java b/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java index 518f891..82d1c22 100644 --- a/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java +++ b/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java @@ -12,6 +12,7 @@ import com.ydool.common.base.BaseService; import com.ydool.common.cache.ConfigCache; import com.ydool.common.constant.UrlConstant; import com.ydool.common.data.dto.AjaxResult; +import com.ydool.common.utils.CacheUtil; import com.ydool.common.utils.HttpServletUtil; import com.ydool.common.utils.PasswordUtil; import com.ydool.common.utils.RsaUtil; @@ -84,7 +85,7 @@ public class AuthServiceImpl extends BaseService implements IA // 第1步,先登录上 StpUtil.login(loginUser.getId()); - + CacheUtil.put(ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, "scheduled", false); boolean flag = updateById(loginUser); if (flag) { diff --git a/src/main/resources/ehcache.xml b/src/main/resources/ehcache.xml index 8bafcae..13c5bcd 100644 --- a/src/main/resources/ehcache.xml +++ b/src/main/resources/ehcache.xml @@ -97,13 +97,13 @@ overflowToDisk="false"> - +