Explorar o código

新增和修改 不可见和不可修改的列单独处理

shiqian %!s(int64=4) %!d(string=hai) anos
pai
achega
abaaa73571

+ 11 - 6
boman-web-core/src/main/java/com/boman/web/core/domain/TableContext.java

@@ -21,8 +21,7 @@ import javax.annotation.Resource;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
-import static com.boman.common.core.utils.obj.ObjectUtils.ltZero;
-import static com.boman.common.core.utils.obj.ObjectUtils.requireNonNull;
+import static com.boman.common.core.utils.obj.ObjectUtils.*;
 import static com.boman.domain.constant.MaskConstant.*;
 import static com.boman.domain.constant.MaskConstant.*;
 import static com.boman.web.core.utils.AuthUtils.*;
 import static com.boman.web.core.utils.AuthUtils.*;
 import static com.boman.web.core.utils.ColumnUtils.withoutHr;
 import static com.boman.web.core.utils.ColumnUtils.withoutHr;
@@ -118,18 +117,24 @@ public class TableContext {
                 if (column.getColumnName().equalsIgnoreCase(entry.getKey())) {
                 if (column.getColumnName().equalsIgnoreCase(entry.getKey())) {
                     // 新增
                     // 新增
                     if (ActionType.INSERT.equals(context.getActionType())) {
                     if (ActionType.INSERT.equals(context.getActionType())) {
-                        // 新增可修改, 并且新增可见,把新增的字段单独拿出来
+                        // 新增可可见, 并且新增修改,把新增的字段单独拿出来
                         if (INSERT_CAN_EDIT.equals(insertCanEdit) && INSERT_VISIBLE.equals(insertVisible)) {
                         if (INSERT_CAN_EDIT.equals(insertCanEdit) && INSERT_VISIBLE.equals(insertVisible)) {
                             commitData.put(entry.getKey(), entry.getValue());
                             commitData.put(entry.getKey(), entry.getValue());
                         } else {
                         } else {
-                            // ignore
+                            // 如果新增不可见,新增也不可以修改,但是你是外键的话,就可以修改
+                            if (isNotEmpty(column.getForeignKey())) {
+                                commitData.put(entry.getKey(), entry.getValue());
+                            }
                         }
                         }
                     } else {
                     } else {
-                        // 编辑可修改, 并且编辑可见
+                        // 编辑可见, 并且编辑可修改
                         if (UPDATE_CAN_EDIT.equals(updateCanEdit) && UPDATE_VISIBLE.equals(updateVisible)) {
                         if (UPDATE_CAN_EDIT.equals(updateCanEdit) && UPDATE_VISIBLE.equals(updateVisible)) {
                             commitData.put(entry.getKey(), entry.getValue());
                             commitData.put(entry.getKey(), entry.getValue());
                         } else {
                         } else {
-                            // ignore
+                            // 如果编辑不可见,编辑也不可以修改,但是你是外键的话,就可以修改
+                            if (isNotEmpty(column.getForeignKey())) {
+                                commitData.put(entry.getKey(), entry.getValue());
+                            }
                         }
                         }
                     }
                     }
                 }
                 }