he2802 2 жил өмнө
parent
commit
325887bb79

+ 7 - 3
zhongzheng-framework/src/main/java/com/zhongzheng/framework/mybatisplus/CreateAndUpdateMetaObjectHandler.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.SecurityUtils;
 import org.apache.ibatis.reflection.MetaObject;
+import org.springframework.beans.factory.annotation.Value;
 
 /**
  * MP注入处理器
@@ -12,11 +13,14 @@ import org.apache.ibatis.reflection.MetaObject;
  */
 public class CreateAndUpdateMetaObjectHandler implements MetaObjectHandler {
 
+	@Value("${mybatis-plus.tenant.enabled-tenant:true}")
+	private boolean enabledTenant;
+
 	@Override
 	public void insertFill(MetaObject metaObject) {
 		//根据属性名字设置要填充的值
 		if (metaObject.hasGetter("createTime")) {
-			if (metaObject.getValue("createTime") == null) {
+			if (metaObject.getValue("createTime") == null && enabledTenant) {
 				this.setFieldValByName("createTime", DateUtils.getNowDate(), metaObject);
 			}
 		}
@@ -30,12 +34,12 @@ public class CreateAndUpdateMetaObjectHandler implements MetaObjectHandler {
 	@Override
 	public void updateFill(MetaObject metaObject) {
 		if (metaObject.hasGetter("updateBy")) {
-			if (metaObject.getValue("updateBy") == null) {
+			if (metaObject.getValue("updateBy" ) == null) {
 				this.setFieldValByName("updateBy", SecurityUtils.getUsername(), metaObject);
 			}
 		}
 		if (metaObject.hasGetter("updateTime")) {
-			if (metaObject.getValue("updateTime") == null) {
+			if (metaObject.getValue("updateTime") == null && enabledTenant) {
 				this.setFieldValByName("updateTime", DateUtils.getNowDate(), metaObject);
 			}
 		}

+ 0 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/ITopGoodsService.java

@@ -2,12 +2,9 @@ package com.zhongzheng.modules.top.goods.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.zhongzheng.modules.goods.vo.TopGoodsVo;
-import com.zhongzheng.modules.top.goods.bo.TopGoodsAddBo;
-import com.zhongzheng.modules.top.goods.bo.TopGoodsEditBo;
 import com.zhongzheng.modules.top.goods.bo.TopGoodsQueryBo;
 import com.zhongzheng.modules.top.goods.domain.TopGoods;
 
-import java.util.Collection;
 import java.util.List;
 
 /**