|
@@ -17,7 +17,6 @@ import com.boman.domain.SysDictData;
|
|
|
import com.boman.domain.constant.*;
|
|
|
import com.boman.gen.api.RemoteGenTableColumnService;
|
|
|
import com.boman.gen.api.RemoteGenTableService;
|
|
|
-//import com.boman.gen.controller.MyController;
|
|
|
import com.boman.domain.GenTable;
|
|
|
import com.boman.domain.GenTableColumn;
|
|
|
import com.boman.system.api.RemoteDictDataService;
|
|
@@ -32,6 +31,7 @@ import com.boman.web.core.utils.IdUtils;
|
|
|
import com.google.common.base.Strings;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import org.apache.commons.lang3.BooleanUtils;
|
|
|
+import org.apache.commons.lang3.math.NumberUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -122,8 +122,10 @@ public class TableServiceCmdService {
|
|
|
Object value =entry.getValue();
|
|
|
for (GenTableColumn column : columns) {
|
|
|
if (entry.getKey().equals(column.getColumnName())
|
|
|
- && ArrayUtils.arraysContains(GenConstants.COLUMNTYPE_NUMBER, getDbType(column.getColumnType()))) {
|
|
|
- if (!(value instanceof Number)) {
|
|
|
+ && ArrayUtils.arraysContains(GenConstants.COLUMNTYPE_NUMBER, getDbType(column.getColumnType()))) {
|
|
|
+ if ((value instanceof Number)) {
|
|
|
+ // ignore 这里的if不能删掉,因为else if有一个强转
|
|
|
+ } else if (!NumberUtils.isCreatable(((String) value))) {
|
|
|
throw new IllegalArgumentException(column.getColumnComment() + "只能输入数字");
|
|
|
}
|
|
|
}
|
|
@@ -289,33 +291,6 @@ public class TableServiceCmdService {
|
|
|
jsonObject.put(SINGLE_OBJ_NAME, primaryTableFkValue);
|
|
|
jsonObject.put(SINGLE_OBJ_VALUE, value);
|
|
|
json.put(selfColumnName.toLowerCase(), jsonObject);
|
|
|
-
|
|
|
-
|
|
|
- // method();=> fkTableName、fkColumnName
|
|
|
- // 外键在table_column中的id
|
|
|
-// Long fkColumnId = Long.parseLong(column.getForeignKey());
|
|
|
-// GenTableColumn fkTableColumn = remoteGenTableColumnService.getById(fkColumnId);
|
|
|
-// String fkColumnName = fkTableColumn.getColumnName();
|
|
|
-// Long fkTableId = fkTableColumn.getTableId();
|
|
|
-// GenTable fkGenTable = remoteGenTableService.getByTableId(fkTableId);
|
|
|
-// // 显示键 table_column 表的id
|
|
|
-// Long dkColumnId = fkGenTable.getDkColumn();
|
|
|
-// GenTableColumn dkTableColumn = remoteGenTableColumnService.getById(dkColumnId);
|
|
|
-// String dkColumnName = dkTableColumn.getColumnName();
|
|
|
-// String fkTableName = fkGenTable.getTableName();
|
|
|
-// Object primaryTableFkValue = json.get(selfColumnName);
|
|
|
-// // "DEPT_ID": {"value": 104, "name": "开发部"}
|
|
|
-// JSONObject param = new JSONObject();
|
|
|
-// param.put(fkColumnName, primaryTableFkValue);
|
|
|
-// List<JSONObject> fkList = selectService.getByMap(fkTableName, param);
|
|
|
-//
|
|
|
-// for (JSONObject object : fkList) {
|
|
|
-// Object value = object.get(dkColumnName);
|
|
|
-// jsonObject.put(SINGLE_OBJ_NAME, primaryTableFkValue);
|
|
|
-// jsonObject.put(SINGLE_OBJ_VALUE, value);
|
|
|
-// json.put(selfColumnName.toLowerCase(), jsonObject);
|
|
|
-// break;
|
|
|
-// }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -479,7 +454,7 @@ public class TableServiceCmdService {
|
|
|
/**
|
|
|
* 功能描述: 获取表单查询字段、按钮、表头
|
|
|
* 注意: 都是从redis中拿的,如果数据库和redis不一致,则需刷新一下redis
|
|
|
- * 刷新的入口为 {@link MyController#loadTable(GenTable)}
|
|
|
+ *
|
|
|
* <p>
|
|
|
* eg:{
|
|
|
* "table": "sys_config",
|
|
@@ -515,13 +490,14 @@ public class TableServiceCmdService {
|
|
|
jsonObject.put(FormDataConstant.BUTTON_LIST, Strings.nullToEmpty(genTable.getMenuRole()));
|
|
|
|
|
|
jsonObject.put(ViewConst.VIEW_TYPE, Strings.nullToEmpty(genTable.getTplCategory()));
|
|
|
+ jsonObject.put(RULES, packRequireColumn(columns));
|
|
|
return AjaxResult.success(jsonObject);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 功能描述: 获取表单查询字段
|
|
|
* 注意: 都是从redis中拿的,如果数据库和redis不一致,则需刷新一下redis
|
|
|
- * 刷新的入口为 {@link MyController#loadTable(GenTable)}
|
|
|
+ *
|
|
|
* <p>
|
|
|
* eg:{
|
|
|
* "table": "sys_config"
|