|
@@ -18,6 +18,7 @@ import com.boman.gen.controller.MyController;
|
|
|
import com.boman.gen.domain.GenTable;
|
|
|
import com.boman.gen.domain.GenTableColumn;
|
|
|
import com.boman.gen.domain.GenTableRelation;
|
|
|
+import com.boman.gen.util.GenUtils;
|
|
|
import com.boman.system.api.RemoteDictDataService;
|
|
|
import com.boman.system.api.domain.SysFile;
|
|
|
import com.boman.web.core.constant.FormDataConstant;
|
|
@@ -124,7 +125,7 @@ public class TableServiceCmdService {
|
|
|
* @return com.boman.common.core.web.domain.AjaxResult
|
|
|
*/
|
|
|
public AjaxResult objectDelete(BaseTableSaveDTO dto) {
|
|
|
- requireNonNull(dto.getTable());
|
|
|
+ requireNonNull(dto.getTable(), "tableName = [" + dto.getTable() + "] 此表不存在");
|
|
|
Long[] idArr = CollectionUtils.listToArray(dto.getIdList());
|
|
|
requireNonNull(idArr);
|
|
|
// 拿到pkName
|
|
@@ -151,7 +152,7 @@ public class TableServiceCmdService {
|
|
|
* @return com.boman.common.core.web.domain.AjaxResult
|
|
|
*/
|
|
|
public AjaxResult objectLogicDelete(BaseTableSaveDTO dto) {
|
|
|
- requireNonNull(dto.getTable());
|
|
|
+ requireNonNull(dto.getTable(), "tableName = [" + dto.getTable() + "] 此表不存在");
|
|
|
Long[] idArr = CollectionUtils.listToArray(dto.getIdList());
|
|
|
requireNonNull(idArr);
|
|
|
|
|
@@ -178,7 +179,7 @@ public class TableServiceCmdService {
|
|
|
* @return com.boman.common.core.web.domain.AjaxResult
|
|
|
*/
|
|
|
public AjaxResult queryList(BaseTableSaveDTO dto) {
|
|
|
- requireNonNull(dto.getTable());
|
|
|
+ requireNonNull(dto.getTable(), "tableName = [" + dto.getTable() + "] 此表不存在");
|
|
|
|
|
|
// 拿到每个字段对应的查询类型,=、 like、 >、 <
|
|
|
GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, dto.getTable());
|
|
@@ -378,7 +379,7 @@ public class TableServiceCmdService {
|
|
|
* @return com.boman.common.core.web.domain.AjaxResult
|
|
|
*/
|
|
|
public AjaxResult getObject(BaseTableSaveDTO dto) {
|
|
|
- String tableName = requireNonNull(dto.getTable());
|
|
|
+ String tableName = requireNonNull(dto.getTable(), "tableName = [" + dto.getTable() + "] 此表不存在");
|
|
|
|
|
|
GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, tableName);
|
|
|
String pkName = IdUtils.getPkName(genTable.getColumns());
|
|
@@ -394,7 +395,8 @@ public class TableServiceCmdService {
|
|
|
// 默认查所有字段,不支持自定义
|
|
|
JSONObject json = selectService.selectById(tableName, pkName, id);
|
|
|
requireNonNull(json, "id 为[" + id + "]的数据不存在, 表名为[" + tableName + "]");
|
|
|
- List<GenTableColumn> parentColumns = filter(columns, col -> HR.equalsIgnoreCase(col.getHtmlType()));
|
|
|
+ List<GenTableColumn> parentColumns = GenUtils.filterHrAndSort(columns);
|
|
|
+
|
|
|
// 处理成hr的形式
|
|
|
for (GenTableColumn hrColumn : parentColumns) {
|
|
|
List<GenTableColumn> children = Lists.newArrayListWithCapacity(16);
|
|
@@ -796,7 +798,7 @@ public class TableServiceCmdService {
|
|
|
* @return com.boman.common.core.web.domain.AjaxResult
|
|
|
*/
|
|
|
public AjaxResult getByTableName(BaseTableSaveDTO condition) {
|
|
|
- requireNonNull(condition.getTable(), "表名为空");
|
|
|
+ requireNonNull(condition.getTable(), "tableName = [" + condition.getTable() + "] 此表不存在");
|
|
|
requireNonNull(condition.getIsUi(), "根据表名获取表字段,未传 isUi 这个字段");
|
|
|
GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, condition.getTable());
|
|
|
List<GenTableColumn> allColumns = genTable.getColumns();
|
|
@@ -813,7 +815,8 @@ public class TableServiceCmdService {
|
|
|
}
|
|
|
|
|
|
public AjaxResult getByTableName(String tableName, List<GenTableColumn> allColumns) {
|
|
|
- List<GenTableColumn> parentColumns = filter(allColumns, col -> HR.equalsIgnoreCase(col.getHtmlType()));
|
|
|
+ List<GenTableColumn> parentColumns = GenUtils.filterHrAndSort(allColumns);
|
|
|
+// List<GenTableColumn> parentColumns = filter(allColumns, col -> HR.equalsIgnoreCase(col.getHtmlType()));
|
|
|
allColumns = filterData(allColumns, 0, MaskConstant.LIST_VISIBLE::equals);
|
|
|
|
|
|
// 把孩子放入父亲的怀抱
|