疯狂的狮子li
2021-08-02 c813046594b82230cd2cb61622d68a4981096e08
ruoyi-framework/src/main/java/com/ruoyi/framework/mybatisplus/CreateAndUpdateMetaObjectHandler.java
@@ -1,11 +1,11 @@
package com.ruoyi.framework.mybatisplus;
import cn.hutool.core.lang.Validator;
import cn.hutool.http.HttpStatus;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
@@ -25,12 +25,12 @@
      try {
         //根据属性名字设置要填充的值
         if (metaObject.hasGetter("createTime")) {
            if (Validator.isEmpty(metaObject.getValue("createTime"))) {
            if (StringUtils.isEmpty(metaObject.getValue("createTime"))) {
               this.setFieldValByName("createTime", new Date(), metaObject);
            }
         }
         if (metaObject.hasGetter("createBy")) {
            if (Validator.isEmpty(metaObject.getValue("createBy"))) {
            if (StringUtils.isEmpty(metaObject.getValue("createBy"))) {
               this.setFieldValByName("createBy", getLoginUsername(), metaObject);
            }
         }
@@ -43,12 +43,12 @@
   public void updateFill(MetaObject metaObject) {
      try {
         if (metaObject.hasGetter("updateBy")) {
            if (Validator.isEmpty(metaObject.getValue("updateBy"))) {
            if (StringUtils.isEmpty(metaObject.getValue("updateBy"))) {
               this.setFieldValByName("updateBy", getLoginUsername(), metaObject);
            }
         }
         if (metaObject.hasGetter("updateTime")) {
            if (Validator.isEmpty(metaObject.getValue("updateTime"))) {
            if (StringUtils.isEmpty(metaObject.getValue("updateTime"))) {
               this.setFieldValByName("updateTime", new Date(), metaObject);
            }
         }