浏览代码

Merge remote-tracking branch 'origin/master'

Administrator 4 年之前
父节点
当前提交
bc0658aba5

+ 11 - 0
boman-common/boman-common-core/src/main/java/com/boman/common/core/utils/obj/ObjectUtils.java

@@ -219,6 +219,17 @@ public class ObjectUtils {
     }
 
 
+    public static <V> List<V> map(Map<String, V> input, Function<String, V> function) {
+        requireNonNull(input, "map is null");
+        List<V> result = new ArrayList<>(input.size());
+        for (Map.Entry<String, V> entry : input.entrySet()) {
+            result.add(entry.getValue());
+        }
+
+        return result;
+    }
+
+
     /**
      * 功能描述: 根据规则获取单个
      *

+ 45 - 0
boman-web-core/src/main/java/com/boman/web/core/controller/CommonController.java

@@ -0,0 +1,45 @@
+package com.boman.web.core.controller;
+
+import com.boman.common.core.web.domain.AjaxResult;
+import com.boman.web.core.domain.BaseTableDTO;
+import com.boman.web.core.service.common.ICommonService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+/**
+ * @author shiqian
+ * @date 2021年04月15日 16:25
+ **/
+@RestController
+@RequestMapping("common/")
+public class CommonController {
+
+    @Resource
+    private ICommonService commonService;
+
+    /**
+     * 功能描述: 根据表名和id查找
+     *
+     * @param tableName tableName
+     * @param id        id
+     * @return com.boman.common.core.web.domain.AjaxResult
+     */
+    @GetMapping("/tableName/{tableName}/id/{id}")
+    public AjaxResult getById(@PathVariable("tableName") String tableName, @PathVariable("id") Long id) {
+        return AjaxResult.success(commonService.getById(tableName, id));
+    }
+
+    /**
+     * 功能描述: 根据表名和自定义字段查找
+     *
+     * @param tableName tableName
+     * @param id        id
+     * @return com.boman.common.core.web.domain.AjaxResult
+     */
+    @PostMapping
+    public AjaxResult getByMap(@RequestBody BaseTableDTO dto) {
+        return AjaxResult.success(commonService.getByMap(dto.getTable(), dto.getFixedData()));
+    }
+
+}

+ 0 - 20
boman-web-core/src/main/java/com/boman/web/core/domain/BaseTableDTO.java

@@ -22,11 +22,6 @@ public class BaseTableDTO {
     @JSONField(name = "table")
     private String table;
 
-    @JSONField(name = "delMTable")
-    private Boolean delMTable;
-
-    @JSONField(name = "tabItem")
-    private JSONObject tabItem;
 
     public Long getObjId() {
         return objId;
@@ -52,19 +47,4 @@ public class BaseTableDTO {
         this.table = table;
     }
 
-    public Boolean getDelMTable() {
-        return delMTable;
-    }
-
-    public void setDelMTable(Boolean delMTable) {
-        this.delMTable = delMTable;
-    }
-
-    public JSONObject getTabItem() {
-        return tabItem;
-    }
-
-    public void setTabItem(JSONObject tabItem) {
-        this.tabItem = tabItem;
-    }
 }

+ 0 - 60
boman-web-core/src/main/java/com/boman/web/core/domain/MainTableRecord.java

@@ -1,60 +0,0 @@
-package com.boman.web.core.domain;
-
-import com.alibaba.fastjson.JSONObject;
-import com.boman.gen.domain.GenTable;
-import lombok.Data;
-import lombok.Getter;
-import lombok.Setter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author shiqian
- * @description
- * @date 2021年03月22日 10:04
- **/
-public class MainTableRecord {
-
-    private static final Logger LOGGER = LoggerFactory.getLogger(MainTableRecord.class);
-
-    private TableServiceContext context;
-    private RowRecord mainData;
-
-    @Setter
-    @Getter
-    private RowResult result;
-
-
-    public MainTableRecord(TableServiceContext context, GenTable genTable, Long id, JSONObject fixedData, JSONObject delTables) {
-        this.context = context;
-        this.mainData = new RowRecord(id, genTable, fixedData);
-    }
-
-    public Long getId() {
-        return mainData.getId();
-    }
-
-    public void setId(Long value) {
-        mainData.setId(value);
-    }
-
-    public GenTable getTable() {
-        return mainData.getGenTable();
-    }
-
-    public JSONObject getCommitData() {
-        return mainData.getCommitData();
-    }
-
-    public JSONObject getOriginalData() {
-        return mainData.getOriginalData();
-    }
-
-    public RowRecord getMainData() {
-        return mainData;
-    }
-
-    public void setMainData(RowRecord mainData) {
-        this.mainData = mainData;
-    }
-}

+ 0 - 100
boman-web-core/src/main/java/com/boman/web/core/domain/RowRecord.java

@@ -1,100 +0,0 @@
-package com.boman.web.core.domain;
-
-import com.alibaba.fastjson.JSONObject;
-import com.boman.gen.domain.GenTable;
-import lombok.Data;
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * @author zc
- * @date 2019/02/19
- */
-@Slf4j
-public class RowRecord {
-
-    private GenTable genTable;
-
-    private Long id;
-
-    //提交过来的数据
-    private JSONObject postData = new JSONObject();
-
-    //原数据
-    private JSONObject originalData = new JSONObject();
-
-    //新数据
-    private JSONObject newData;
-
-    //将要提交到数据库中的数据
-    private JSONObject commitData = new JSONObject();
-
-    public RowRecord(Long id, GenTable genTable, JSONObject fixedData) {
-        this.id = id;
-        this.genTable = genTable;
-
-        if (fixedData == null) {
-            fixedData = new JSONObject();
-        }
-
-        fixedData.forEach((fieldName, fieldValue)->{
-            postData.put(fieldName.toUpperCase(), fieldValue);
-        });
-
-        for (String key : postData.keySet()) {
-            commitData.put(key, postData.get(key));
-        }
-
-        JSONObject jsonObject = new JSONObject();
-        jsonObject.put("baseData", originalData);
-        jsonObject.put("data", commitData);
-        newData = new JSONObject(jsonObject);
-    }
-
-    public GenTable getGenTable() {
-        return genTable;
-    }
-
-    public void setGenTable(GenTable genTable) {
-        this.genTable = genTable;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public JSONObject getPostData() {
-        return postData;
-    }
-
-    public void setPostData(JSONObject postData) {
-        this.postData = postData;
-    }
-
-    public JSONObject getOriginalData() {
-        return originalData;
-    }
-
-    public void setOriginalData(JSONObject originalData) {
-        this.originalData = originalData;
-    }
-
-    public JSONObject getNewData() {
-        return newData;
-    }
-
-    public void setNewData(JSONObject newData) {
-        this.newData = newData;
-    }
-
-    public JSONObject getCommitData() {
-        return commitData;
-    }
-
-    public void setCommitData(JSONObject commitData) {
-        this.commitData = commitData;
-    }
-}

+ 0 - 185
boman-web-core/src/main/java/com/boman/web/core/domain/TableServiceContext.java

@@ -1,185 +0,0 @@
-package com.boman.web.core.domain;
-
-import com.alibaba.fastjson.JSONObject;
-import com.boman.common.core.utils.SpringUtils;
-import com.boman.common.redis.RedisKey;
-import com.boman.common.redis.service.RedisService;
-import com.boman.gen.domain.GenTable;
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
-
-import javax.annotation.Resource;
-import java.sql.Timestamp;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author shiqian
- * @description
- * @date 2021年03月22日 09:58
- **/
-@Service
-public class TableServiceContext {
-
-    private final static String PREFIX = "Controller:/event/do";
-
-    /**
-     * 当前表
-     */
-    private GenTable table;
-
-    /**
-     * 真实表名
-     */
-    private String realTableName;
-
-    /**
-     * 动作名(ADD,SAVE,SUBMIT,VOID,UNSUBMIT)
-     */
-    private String actionName;   //Controller:/event/doAdd
-
-    /**
-     * 业务发生的时间戳
-     */
-    private Timestamp currentTime;
-
-    /**
-     * 上行的数据
-     * 每个row对象对应到一条单据(如果存在事务,应该在这个级别上体现)
-     */
-    private List<MainTableRecord> rows;
-
-    /**
-     * 本次请求存放的临时数据
-     * !!慎用,最好不要在各个对象间传递
-     */
-    private Map<String, Object> values;
-
-    private boolean isDelMtable;
-
-    /**
-     * 是否批量新增
-     */
-    private boolean isInsertBacth = false;
-
-    private TableServiceContext() {
-        values = Maps.newHashMap();
-    }
-
-
-    @Resource
-    private RedisService redisService;
-
-    public static TableServiceContext createFrom(BaseTableDTO baseTableDTO) {
-        TableServiceContext result = new TableServiceContext();
-        String tableName = baseTableDTO.getTable();
-        if (StringUtils.isEmpty(tableName)) {
-            throw new IllegalArgumentException("表名参数不能为空");
-        }
-
-        //从redis中获取表信息
-        RedisService redisService = SpringUtils.getBean(RedisService.class);
-        result.table = redisService.getCacheObject(RedisKey.TABLE_INFO + tableName);
-
-        if (result.table == null) {
-            throw new IllegalArgumentException(tableName + "表信息不存在");
-        }
-
-        result.realTableName = result.table.getTableName();
-        if (Strings.isNullOrEmpty(result.realTableName)) {
-            throw new IllegalArgumentException(tableName + "表名不存在");
-        }
-
-        // 前台传过来的数据
-        JSONObject fixedData = baseTableDTO.getFixedData();
-        //删除
-        Boolean isdelmtable = baseTableDTO.getDelMTable();
-        JSONObject tabItem = baseTableDTO.getTabItem();
-        if (isdelmtable != null) {
-            result.isDelMtable = isdelmtable;
-        }
-
-        // 获取objid判断 新增或更新
-        Long objid = baseTableDTO.getObjId();
-        MainTableRecord mainRowData = new MainTableRecord(result, result.table, objid, fixedData, tabItem);
-        result.rows = Lists.newArrayList();
-        result.rows.add(mainRowData);
-
-        return result;
-    }
-
-    public GenTable getTable() {
-        return table;
-    }
-
-    public void setTable(GenTable table) {
-        this.table = table;
-    }
-
-    public String getRealTableName() {
-        return realTableName;
-    }
-
-    public void setRealTableName(String realTableName) {
-        this.realTableName = realTableName;
-    }
-
-    public String getActionName() {
-        return actionName;
-    }
-
-    public void setActionName(String actionName) {
-        this.actionName = actionName;
-    }
-
-    public Timestamp getCurrentTime() {
-        return currentTime;
-    }
-
-    public void setCurrentTime(Timestamp currentTime) {
-        this.currentTime = currentTime;
-    }
-
-    public List<MainTableRecord> getRows() {
-        return rows;
-    }
-
-    public void setRows(List<MainTableRecord> rows) {
-        this.rows = rows;
-    }
-
-    public Map<String, Object> getValues() {
-        return values;
-    }
-
-    public void setValues(Map<String, Object> values) {
-        this.values = values;
-    }
-
-    public boolean isDelMtable() {
-        return isDelMtable;
-    }
-
-    public void setDelMtable(boolean delMtable) {
-        isDelMtable = delMtable;
-    }
-
-    public boolean isInsertBacth() {
-        return isInsertBacth;
-    }
-
-    public void setInsertBacth(boolean insertBacth) {
-        isInsertBacth = insertBacth;
-    }
-//
-//    public Collection<Filter> getFilters() {
-//        return filters;
-//    }
-//
-//    public void setFilters(Collection<Filter> filters) {
-//        this.filters = filters;
-//    }
-}

+ 6 - 6
boman-web-core/src/main/java/com/boman/web/core/mapper/StandardlyMapper.java

@@ -107,7 +107,7 @@ public interface StandardlyMapper {
      * @param id        主键值
      * @return com.alibaba.fastjson.JSONObject
      */
-    @Select("select * from ${tableName} where ${pkName} = #{id}")
+    @Select("select * from ${tableName} where ${pkName} = #{id} limit 1")
     JSONObject selectById(@Param("tableName") String tableName
             , @Param("pkName") String pkName, @Param("id") Long id);
 
@@ -165,13 +165,13 @@ public interface StandardlyMapper {
 
     /**
      * 功能描述: 根据tableName和map(属性名和属性值)进行查查
-     * {@link SqlProvider#selectByMap(java.util.Map)}
+     * {@link SqlProvider#getByMap(java.util.Map)}
      * @param tableName tableName
      * @param param     属性名和属性值
      * @return java.util.List<com.alibaba.fastjson.JSONObject>
      */
-    @SelectProvider(type = SqlProvider.class, method = "selectByMap")
-    List<JSONObject> selectByMap(@Param("tableName") String tableName, @Param("param") Map<String, Object> param);
+    @SelectProvider(type = SqlProvider.class, method = "getByMap")
+    List<JSONObject> getByMap(@Param("tableName") String tableName, @Param("param") JSONObject param);
 
 
     public static class SqlProvider {
@@ -538,8 +538,8 @@ public interface StandardlyMapper {
             return result;
         }
 
-        public String selectByMap(Map<String, Object> para) {
-            Map<String, Object> param = (Map<String, Object>) para.get("param");
+        public String getByMap(Map<String, Object> para) {
+            JSONObject param = (JSONObject) para.get("param");
             String tableName = (String) para.get("tableName");
 
             StringBuilder wholeSql = new StringBuilder();

+ 9 - 12
boman-web-core/src/main/java/com/boman/web/core/service/TableServiceCmdService.java

@@ -299,9 +299,9 @@ public class TableServiceCmdService {
                     String fkTableName = fkGenTable.getTableName();
                     Object primaryTableFKvalue = json.get(selfColumnName);
                     // "DEPT_ID": {"value": 104, "name": "开发部"}
-                    Map<String, Object> param = Maps.newHashMap();
+                    JSONObject param = new JSONObject();
                     param.put(fkColumnName, primaryTableFKvalue);
-                    List<JSONObject> fkList = selectService.selectByMap(fkTableName, param);
+                    List<JSONObject> fkList = selectService.getByMap(fkTableName, param);
 
                     for (JSONObject object : fkList) {
                         Object value = object.get(dkColumnName);
@@ -376,30 +376,27 @@ public class TableServiceCmdService {
      * @return com.boman.common.core.web.domain.AjaxResult
      */
     public AjaxResult getObject(BaseTableSaveDTO dto) {
-        requireNonNull(dto.getTable());
+        String tableName = requireNonNull(dto.getTable());
 
-        GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, dto.getTable());
+        GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, tableName);
         String pkName = IdUtils.getPkName(genTable.getColumns());
         JSONObject fixedData = dto.getFixedData();
-        fixedData = ifNullSetEmpty(fixedData);
         Long id = fixedData.getLong(FormDataConstant.ID);
         requireNonNull(id);
         List<GenTableColumn> columns = genTable.getColumns();
         // id = -1时,查询该表单对应的字段名称
         if (ltZero(id)) {
-            return getByTableName(genTable.getTableName(), columns);
+            return getByTableName(tableName, columns);
         }
 
         // 默认查所有字段,不支持自定义
-        JSONObject json = selectService.selectById(genTable.getTableName(), pkName, id);
-        // name=username, value=zhangsan, type=input, types=[{},{}]
+        JSONObject json = selectService.selectById(tableName, pkName, id);
 
         handler(Collections.singletonList(json), columns);
 
-        List<JSONObject> list = packSingleObj(json, columns);
         JSONObject result = new JSONObject();
-        result.put(SHOW_DATA, list);
-        result.put(BUTTON_LIST, getButton(genTable.getTableName()));
+        result.put(SHOW_DATA, packSingleObj(json, columns));
+        result.put(BUTTON_LIST, getButton(tableName));
         return AjaxResult.success(result);
     }
 
@@ -744,7 +741,7 @@ public class TableServiceCmdService {
      * @param tableName      表名
      * @return com.boman.gen.domain.GenTable
      */
-    private GenTable getTableFromRedisByTableName(String redisKeyPrefix, String tableName) {
+    public GenTable getTableFromRedisByTableName(String redisKeyPrefix, String tableName) {
         tableName = tableName.trim().toLowerCase();
         String key = requireNonNull(redisKeyPrefix) + requireNonNull(tableName);
         GenTable genTable = redisService.getCacheObject(key);

+ 13 - 5
boman-web-core/src/main/java/com/boman/web/core/service/save/BaseSaveServiceImpl.java

@@ -5,6 +5,7 @@ import com.boman.common.core.constant.CacheConstants;
 import com.boman.common.core.utils.SecurityUtils;
 import com.boman.common.core.utils.obj.ObjectUtils;
 import com.boman.common.redis.service.RedisService;
+import com.boman.common.security.service.TokenService;
 import com.boman.gen.domain.GenTableColumn;
 import com.boman.system.api.model.LoginUser;
 import com.boman.web.core.constant.FormDataConstant;
@@ -57,7 +58,7 @@ public class BaseSaveServiceImpl implements IBaseSaveService {
 
         // 默认创建人和创建时间是都有的
         commitData.put(FormDataConstant.CREATE_TIME.toUpperCase(), currentTime);
-        commitData.put(FormDataConstant.CREATE_BY.toUpperCase(), "张三");
+        commitData.put(FormDataConstant.CREATE_BY.toUpperCase(), SecurityUtils.getUserId());
         int ret = mapper.insert(tableName, commitData);
         if (ret > 0) {
             LOGGER.info("保存成功,保存的数据为:{}", commitData);
@@ -68,19 +69,26 @@ public class BaseSaveServiceImpl implements IBaseSaveService {
         return RowResult.error("失败");
     }
 
-    private void handlerDefaultValue(JSONObject jsonObject, List<GenTableColumn> columns) {
+    /**
+     * 功能描述: 新增的时候处理默认值, 从redis中拿到存在token中的userEnv对象,根据数据库中存的默认值的key,和userEnv中的key做比对,
+     * 从中取出作为字段的默认值,redis中存userEnv的位置:{@link TokenService#packUserEnv(com.boman.system.api.model.LoginUser)}
+     *
+     * @param commitData commitData
+     * @param columns 所有的列
+     */
+    private void handlerDefaultValue(JSONObject commitData, List<GenTableColumn> columns) {
         String token = SecurityUtils.getToken();
         LoginUser loginUser = redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
         JSONObject userEnv = loginUser.getUserEnv();
         for (GenTableColumn column : columns) {
             // 有默认值的列, 并且前台传过来的key中不包含
             if (ObjectUtils.isNotEmpty(column.getDefaultValue())
-                    && !jsonObject.containsKey(column.getColumnName().toLowerCase())
-                    && !jsonObject.containsKey(column.getColumnName().toUpperCase())) {
+                    && !commitData.containsKey(column.getColumnName().toLowerCase())
+                    && !commitData.containsKey(column.getColumnName().toUpperCase())) {
                 String dbDefaultValue = column.getDefaultValue();
                 String defaultValue = ColumnUtils.parseVariables(dbDefaultValue);
                 String variables = dbDefaultValue.equalsIgnoreCase(defaultValue) ? dbDefaultValue : userEnv.getString(defaultValue);
-                jsonObject.put(column.getColumnName(), variables);
+                commitData.put(column.getColumnName(), variables);
             }
         }
     }

+ 6 - 4
boman-web-core/src/main/java/com/boman/web/core/service/select/BaseSelectServiceImpl.java

@@ -9,7 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
-import java.util.Map;
 
 import static com.boman.common.core.utils.obj.ObjectUtils.requireNonNull;
 
@@ -42,7 +41,7 @@ public class BaseSelectServiceImpl implements IBaseSelectService {
     public List<JSONObject> selectByCondition(String tableName, JSONObject condition
             , JSONObject packCondition, JSONArray showData, String orderBy, Integer limit, Integer offset) {
         requireNonNull(tableName, "表名为空");
-        requireNonNull(showData, "数据库中此表: [" + tableName + "] , 没有列表展示的字段");
+        requireNonNull(showData, "表: [" + tableName + "] , 过滤了可展示字段,一个展示字段都没有,还查个鬼啊");
         requireNonNull(orderBy);
         return mapper.selectByCondition(tableName, condition, packCondition, showData, orderBy, limit, offset);
     }
@@ -55,9 +54,12 @@ public class BaseSelectServiceImpl implements IBaseSelectService {
      * @return java.util.List<com.alibaba.fastjson.JSONObject>
      */
     @Override
-    public List<JSONObject> selectByMap(String tableName, Map<String, Object> param) {
+    public List<JSONObject> getByMap(String tableName, JSONObject param) {
         requireNonNull(tableName, "表名为空");
-        return mapper.selectByMap(tableName, param);
+
+        // 判断condition中列是否都在此table中
+
+        return mapper.getByMap(tableName, param);
     }
 
     /**

+ 2 - 3
boman-web-core/src/main/java/com/boman/web/core/service/select/IBaseSelectService.java

@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 
 import java.util.List;
-import java.util.Map;
 
 /**
  * @author shiqian
@@ -19,7 +18,7 @@ public interface IBaseSelectService {
      * @param param     属性名和属性值
      * @return java.util.List<com.alibaba.fastjson.JSONObject>
      */
-    List<JSONObject> selectByMap(String tableName, Map<String, Object> param);
+    List<JSONObject> getByMap(String tableName, JSONObject param);
 
     /**
      * 功能描述: 根据条件查询
@@ -62,7 +61,7 @@ public interface IBaseSelectService {
      * @param tableName 表名
      * @param pkName    主键名称
      * @param idList    主键值
-     * @param showData  需要展示的列
+     * @param showData  需要展示的列,若为空,查所有
      * @return com.alibaba.fastjson.JSONObject
      */
     List<JSONObject> selectByIdList(String tableName, String pkName, List<Long> idList, JSONArray showData);

+ 24 - 5
boman-web-core/src/main/java/com/boman/web/core/utils/ColumnUtils.java

@@ -2,16 +2,17 @@ package com.boman.web.core.utils;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.boman.common.core.utils.SecurityUtils;
 import com.boman.gen.domain.GenTableColumn;
 import com.boman.web.core.constant.FormDataConstant;
 import com.google.common.collect.Lists;
 
 import java.sql.Timestamp;
 import java.util.List;
+import java.util.Map;
 import java.util.function.Predicate;
 
-import static com.boman.common.core.utils.obj.ObjectUtils.isEmpty;
-import static com.boman.common.core.utils.obj.ObjectUtils.requireNonNull;
+import static com.boman.common.core.utils.obj.ObjectUtils.*;
 import static com.boman.web.core.constant.FormDataConstant.HR;
 
 /**
@@ -31,7 +32,7 @@ public class ColumnUtils {
         for (GenTableColumn column : columns) {
             // 判断是否有修改人、修改时间
             if (FormDataConstant.UPDATE_BY.equalsIgnoreCase(column.getColumnName())) {
-                jsonObject.put(FormDataConstant.UPDATE_BY, "张三");
+                jsonObject.put(FormDataConstant.UPDATE_BY, SecurityUtils.getUserId());
             }
             if (FormDataConstant.UPDATE_TIME.equalsIgnoreCase(column.getColumnName())) {
                 jsonObject.put(FormDataConstant.UPDATE_TIME, currentTime);
@@ -78,7 +79,7 @@ public class ColumnUtils {
     }
 
     /**
-     * 功能描述: 按照predicate的规则过滤allColumns中包含data并且符合过滤规则的数据
+     * 功能描述: 按照predicate的规则过滤allColumns中包含data并且符合过滤规则的数据, <p>过滤掉hr !!!</p>
      *
      * @param allColumns 所有的列
      * @param sort       同{@link ColumnUtils#filterData(java.util.List, int, java.util.function.Predicate)}
@@ -93,6 +94,10 @@ public class ColumnUtils {
         if (dataIsEmpty) {
             // data为空,拿出所有列中列表可见的
             for (GenTableColumn allColumn : allColumns) {
+                if (HR.equalsIgnoreCase(allColumn.getHtmlType())) {
+                    continue;
+                }
+
                 String columnName = allColumn.getColumnName();
 //                String columnName = allColumn.getColumnName().toUpperCase();
                 String[] maskArray = requireNonNull(allColumn.getMask(), "mask is empty").split("");
@@ -107,6 +112,9 @@ public class ColumnUtils {
             for (GenTableColumn allColumn : allColumns) {
                 String columnName = allColumn.getColumnName();
 //                String columnName = allColumn.getColumnName().toUpperCase();
+                if (HR.equalsIgnoreCase(allColumn.getHtmlType())) {
+                    continue;
+                }
                 if (data.contains(columnName.toUpperCase()) || data.contains(columnName.toLowerCase())) {
                     String[] maskArray = requireNonNull(allColumn.getMask(), "mask is empty").split("");
                     assert maskArray.length == 6;
@@ -126,4 +134,15 @@ public class ColumnUtils {
         return variables.replaceAll("\\$", "");
     }
 
-}
+
+    public <T> void checkColumn(Map<String, T> form, List<GenTableColumn> allColumns){
+        requireNonNull(form, "jsonObject is empty");
+        requireNonNull(allColumns, "allColumns is empty");
+
+
+        List<String> all = map(allColumns, GenTableColumn::getColumnName);
+//        map(form, );
+
+
+    }
+}

+ 17 - 1
ruoyi-ui/src/api/system/form.js

@@ -15,4 +15,20 @@ export function getObject(data) {
     method: 'POST',
     data
   })
-}
+}
+// 获取表单tab数据
+ export function geteditindeTab(data) {
+   return request({
+     url: '/boman-web-core/p/cs/objectTab',
+     method: 'POST',
+     data
+   })
+ }
+ 
+ export function listIndex(data) {
+   return request({
+     url: '/boman-web-core/p/cs/queryList',
+     method: 'post',
+     data: data
+   })
+ }

+ 1 - 1
ruoyi-ui/src/api/system/table.js

@@ -11,7 +11,7 @@ export function getQueryList(data) {
 // 获取表单查询字段、按钮、表头
 export function getTableQuery(data) {
   return request({
-    url: '/boman-web-core/p/cs/getTableQuery',
+    url: '/boman-web-core/p/cs/getObject',
     method: 'POST',
     data
   })

+ 2 - 2
ruoyi-ui/src/settings.js

@@ -1,7 +1,7 @@
 module.exports = {
   title: '潜山市云数据中心',
-  urls: `http://192.168.101.11:8090`,
-  // urls: `http://192.168.101.110:8080`,
+  // urls: `http://192.168.101.11:8090`,
+  urls: `http://192.168.101.110:8080`,
   // urls: `http://192.168.101.49:8080`,
 
   // urls: `http://192.168.101.10:8080`,

+ 17 - 10
ruoyi-ui/src/views/system/editing/index.vue

@@ -18,7 +18,7 @@
     <!-- 内容 -->
     <div class="eniting_nav">
      <el-collapse v-model="activeNames" @change="handleChange">
-       <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in taleLisst" :key="index" class="eitde">
+       <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in queryData.showData" :key="index" class="eitde">
          <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="120px">
            <el-row >
              <el-col :span="24"  :key="index">
@@ -108,7 +108,11 @@
            taleLisst:[]  ,//列表数据
            // 按钮参数
            tableZbie:{
-             table:'obj_test'
+             table:'obj_test',
+             isUi:true,
+             fixedData:{
+               id:-1
+             }
            },
            tableZbietabg:{
              table:'sys_user'
@@ -132,7 +136,7 @@
         };
       },
       mounted() {
-        this.edingelsie()
+        // this.edingelsie()
         // button
         this.init()
         // tab
@@ -166,16 +170,16 @@
               },
         enditTab(index){
          this.num = index
-         // this.tabledeLise.table = this.tabldie[index].tableName
-         // this.formeanti.table = this.tabldie[index].tableName
-         // this.forme.table = this.tabldie[index].tableName
+         this.tabledeLise.table = this.tabldie[index].tableName
+         this.formeanti.table = this.tabldie[index].tableName
+         this.forme.table = this.tabldie[index].tableName
          if(index == 0){
           this.tabledeLise.table = 'obj_test'
          }else if(index ==1){
           this.tabledeLise.table = 'sys_config'
          }
          this.tableZbie.table = this.tabldie[index].tableName
-         this.edingelsie()
+         // this.edingelsie()
          this.init()
         },
         // 按钮
@@ -314,6 +318,9 @@
     }
   }
   .eniting_nav{
+    // .el-form-item{
+    //   width: 25% !important;
+    //   }
     .el-collapse-item__content{
       padding-bottom: 0;
     }
@@ -328,9 +335,9 @@
       color: #3C8DBC;
       line-height: 36px;
     }
-    .el-form-item__content{
-      width: 55%;
-    }
+    // .el-form-item__content{
+    //   width: 65%;
+    // }
     .textarea_et{
     width: 95%;
     .el-form-item__content{

+ 152 - 43
ruoyi-ui/src/views/system/form/index.vue

@@ -1,43 +1,39 @@
 <template>
   <div class="tabForm">
     <div class="tabForm_header">
-      <div class="table_headerBtun">
-        <el-button type="primary" plain @click="headerBtn(item)" v-for="(item,index) in tabList.buttonList.split('')" :key="index">{{item | btnConversion}}</el-button>
+      <div class="table_headerBtun" v-if="queryData.buttonList">
+        <el-button type="primary" plain @click="headerBtn(item)" v-for="(item,index) in queryData.buttonList.split('')" :key="index">{{item | btnConversion}}</el-button>
       </div>
     </div>
     <!-- 内容 -->
     <div class="table_nav">
       <el-collapse v-model="activeNames">
-        <el-collapse-item :title="title" :name="index" v-for="(item,index) in 1" :key="index" class="eitde">
-          <el-form :model="queryParams" ref="queryForm" :inline="true">
+        <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in queryData.showData" :key="index" class="eitde">
+          <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="120px">
             <el-row :gutter="0">
-              <el-col :span="6" v-for="(item,index) in 8" :key="index">
-                <el-form-item :label="labletit" prop="dictName">
-                  <el-input v-model="queryParams.dictName" placeholder="请输入字典名称" clearable size="small"
-                    @keyup.enter.native="handleQuery" />
-                </el-form-item>
+              <el-col :span="24"  :key="index">
+                  <dynamic-forms :ref="items.columnName" :config="queryParams" @inputs = "changeFn" :formConfig="items" v-for="(items,indexs) in item.hrChildren" :key='indexs' />
               </el-col>
             </el-row>
           </el-form>
         </el-collapse-item>
-
         <!-- 列表 -->
-        <el-collapse-item :title="title" :name="index" v-for="(item,index) in 1" :key="index" class="eitde">
+        <el-collapse-item :title="title" name="index"  class="eitde">
           <div class="ppl">
-            <p v-for="(item,index) in 6" :key="index" @click="enditTab(index)">
+            <p v-for="(item,index) in tabldie" :key="index" @click="enditTab(index)">
               <img src="../../../assets/images/icon_tbtab_normal.png" alt="" class="index_headerImg" v-if="numtab !== index">
               <img src="../../../assets/images/icon_tbtab_selected.png" alt="" class="index_headerImg" v-if="numtab == index">
-              <span :class="[index == numtab ? 'span' : '']">列表名称</span>
+              <span :class="[index == numtab ? 'span' : '']">{{item.tableComment}}</span>
             </p>
           </div>
-          <el-form style="margin-top: 30px;" :model="queryParams" ref="queryForm" :inline="true" label-width="118px">
+        <!--  <el-form style="margin-top: 30px;" :model="queryParams" ref="queryForm" :inline="true" label-width="120px">
             <el-form-item label="岗位编码" prop="postCode" v-for="(item,index) in 2" :key="index">
               <el-input v-model="queryParams.postCode" placeholder="请输入岗位编码" clearable size="small" @keyup.enter.native="handleQuery" />
             </el-form-item>
             <el-form-item>
               <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
             </el-form-item>
-          </el-form>
+          </el-form> -->
           <el-divider></el-divider>
           <el-table stripe v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
             <el-table-column label="序号" align="center" prop="noticeId" width="80" />
@@ -57,21 +53,22 @@
           </el-table>
           <div class="index_haderPagin">
             <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="currentPage3"
-              :page-size="queryParams.pageSize" layout="prev, pager, next, jumper" :total="1000">
+              :page-size="queryParamslist.pageSize" layout="prev, pager, next, jumper" :total="1000">
             </el-pagination>
           </div>
         </el-collapse-item>
 
       </el-collapse>
     </div>
-
   </div>
 </template>
 
 <script>
   import {
     getTableQuery,
-    getObject
+    getObject,
+    geteditindeTab,
+    listIndex
   } from '@/api/system/form.js'
 
   export default {
@@ -83,29 +80,36 @@
         tabList: {},
         currentPage3: 0,
         activeNames: ['1'],
-        title: '单表1',
+        title: '列表',
         objParams: {
           table: 'sys_config',
           fixedData: {
             id: -1
-          }
+          },
+          isUi:true
         },
+        queryData: {},
         // 查询参数
         queryParams: {
-          pageNum: 1,
-          pageSize: 10,
           dictName: undefined,
           dictType: undefined,
           status: undefined
         },
+        queryParamslist: {
+          pageNo: 1,
+          pageSize: 10,
+          orderBy:'create_time desc',
+          table: 'sys_config',
+        },
         labletit: '查询参数1233',
         surlable: '实际数据库表',
-        postList: [{
-          date: '2016-05-02',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1518 弄'
-        }],
-        numtab: 0
+        postList: [],
+        numtab: 0,
+        tabldie:[],
+        tabShoes:false,//tab 显示隐藏
+        tableZbietabg:{
+          table:'sys_user'
+        },
       };
     },
     filters:{
@@ -132,18 +136,16 @@
     },
     mounted() {
       this.init()
+      this.edingelsietab()
     },
     methods: {
       handleCurrentChange() {
-        
+
       },
       handleSizeChange() {
-        
-      },
-      handleSelectionChange() {
 
       },
-      handleQuery() {
+      handleSelectionChange() {
 
       },
       headerBtn(item) {
@@ -172,23 +174,130 @@
         }
       },
       init() {
-        getTableQuery({
-          table: 'sys_config'
-        }).then(res => {
-          this.tabList = res.data
-          console.log(res)
-        })
         getObject(this.objParams).then(res => {
           console.log(res)
+          let data = res.data
+          this.queryData = data
+          console.log(this.queryData,567)
         })
       },
+      // tab数据
+      edingelsietab(){
+        console.log(4566)
+        geteditindeTab(this.tableZbietabg).then(response => {
+          if(response.data.ref.length !==0){
+            this.tabldie = response.data.ref
+            this.tabShoes = true
+          }else{
+            this.tabShoes = false
+          }
+          // this.msgSuccess("反提交成功");
+          // this.open = false;
+          // this.getList();
+        });
+      },
+      // 列表数据
+      foremliseju(){
+       listIndex(this.queryParamslist).then(res => {
+         console.log(res)
+         let data = res.data
+         this.postList = data
+         console.log(this.postList,567)
+       })
+      },
       // tab点击
       tabSbu(index) {
         this.num = index
       },
       enditTab(index) {
         this.numtab = index
-      }
+      },
+      changeFn(obj) {
+        for(let key in obj){
+          this.queryParams[key] = obj[key]
+        }
+      },
+      resetQuery() {
+
+      },
+      /** 搜索按钮操作 */
+      handleQuery(index) {
+         console.log(index,4)
+         for(let item of this.queryData.showData){
+           for(var i = 0 ; i < item.hrChildren.length ; i++){
+             if(item.hrChildren[i].htmlType == 'checkbox' || item.hrChildren[i].htmlType == 'imageUpload' || item.hrChildren[i].htmlType == 'fileUpload'){
+               this.queryParams[item.hrChildren[i].columnName] = this.$refs[item.hrChildren[i].columnName][0].config
+             } else{
+               this.queryParams[item.hrChildren[i].columnName] = this.$refs[item.hrChildren[i].columnName][0].config[item.hrChildren[i].columnName]
+             }
+           }
+         }
+         console.log(this.queryParams)
+         if(index == 'D'){
+           //删除
+           this.handleDelete(index)
+         }else if(index == 'S'){
+           //提交  保存
+            this.formeanti.table = 'obj_test'
+            this.formeanti.commitData = []
+            this.formy.status = 1
+            this.formy.id = 0
+            this.formeanti.commitData.push(this.formy)
+            console.log(this.formeanti)
+           // this.antiSubmission()
+         }else if(index == 'U'){
+           //反提交  保存
+            this.formeanti.table = 'obj_test'
+            this.formeanti.commitData = []
+            this.formy.status = 2
+            this.formy.id = 0
+            this.formeanti.commitData.push(this.formy)
+            console.log(this.formeanti)
+           // this.antiSubmission()
+         }else if(index == 'M'){
+           // 修改
+           this.forme.table = 'obj_test'
+           this.forme.objId = 1
+           this.forme.fixedData = this.queryParams
+           // this.submitForm()
+         }else if(index == 'A'){
+           //新增
+           this.forme.table = 'obj_test'
+           this.forme.objId = -1
+           this.forme.fixedData = this.queryParams
+           // this.submitForm()
+         }
+
+        console.log(this.forme)
+        // this.getList();
+      },
+     /** 新增 修改提交按钮 */
+     submitForm: function() {
+             addbjectSave(this.forme).then(response => {
+               this.msgSuccess("保存成功");
+               this.open = false;
+               // this.getList();
+             });
+     },
+     // 提交反提交
+     antiSubmission(){
+       if (this.formy.status == 1) {
+         // 提交
+         tableSubimt(this.formeanti).then(response => {
+           this.msgSuccess("提交成功");
+           // this.open = false;
+           // this.getList();
+         });
+       } else if(this.formy.status == 2){
+         // 反提交
+         tableSubimtanit(this.formeanti).then(response => {
+           this.msgSuccess("反提交成功");
+           // this.open = false;
+           // this.getList();
+         });
+       }
+     },
+
     },
   };
 </script>
@@ -213,9 +322,9 @@
         line-height: 36px;
       }
 
-      .el-form-item__content {
-        width: 55%;
-      }
+      // .el-form-item__content {
+      //   width: 55%;
+      // }
 
       .el-collapse {
         border-top: 0;

+ 15 - 9
ruoyi-ui/src/views/system/table/index.vue

@@ -10,7 +10,7 @@
     <!-- 内容 -->
     <div class="table_nav headertable_nav">
       <el-collapse v-model="activeNames" @change="handleChange">
-        <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in taleLisst" :key="index" >
+        <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in queryData.showData" :key="index" >
           <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="120px">
             <el-row :gutter="0">
               <el-col :span="24"  :key="index">
@@ -18,7 +18,7 @@
               </el-col>
             </el-row>
           </el-form>
-        </el-collapse-item> 
+        </el-collapse-item>
       </el-collapse>
     </div>
   </div>
@@ -50,7 +50,12 @@
         },
         labletit: '查询参数1233',
         tableZbie:{
-          table:'obj_test'
+          table:'obj_test',
+          isUi:true,
+          fixedData:{
+            id:-1
+          }
+
         },
         taleLisst:[],
         forme:{
@@ -92,7 +97,7 @@
     },
     mounted() {
       this.init()
-      this.tablsie()
+      // this.tablsie()
     },
     methods: {
       changeFn(obj) {
@@ -106,7 +111,7 @@
       /** 搜索按钮操作 */
       handleQuery(index) {
          console.log(index,4)
-         for(let item of this.taleLisst){
+         for(let item of this.queryData.showData){
            for(var i = 0 ; i < item.hrChildren.length ; i++){
              if(item.hrChildren[i].htmlType == 'checkbox' || item.hrChildren[i].htmlType == 'imageUpload' || item.hrChildren[i].htmlType == 'fileUpload'){
                this.queryParams[item.hrChildren[i].columnName] = this.$refs[item.hrChildren[i].columnName][0].config
@@ -115,6 +120,7 @@
              }
            }
          }
+         console.log(this.queryParams)
          if(index == 'D'){
            //删除
            this.handleDelete(index)
@@ -126,7 +132,7 @@
             this.formy.id = 0
             this.formeanti.commitData.push(this.formy)
             console.log(this.formeanti)
-           this.antiSubmission()
+           // this.antiSubmission()
          }else if(index == 'U'){
            //反提交  保存
             this.formeanti.table = 'obj_test'
@@ -135,19 +141,19 @@
             this.formy.id = 0
             this.formeanti.commitData.push(this.formy)
             console.log(this.formeanti)
-           this.antiSubmission()
+           // this.antiSubmission()
          }else if(index == 'M'){
            // 修改
            this.forme.table = 'obj_test'
            this.forme.objId = 1
            this.forme.fixedData = this.queryParams
-           this.submitForm()
+           // this.submitForm()
          }else if(index == 'A'){
            //新增
            this.forme.table = 'obj_test'
            this.forme.objId = -1
            this.forme.fixedData = this.queryParams
-           this.submitForm()
+           // this.submitForm()
          }
 
         console.log(this.forme)