|
@@ -83,14 +83,16 @@ public class FieldServiceImpl extends ServiceImpl<FieldMapper, FieldEntity> impl
|
|
entity.setCreatorId(baseService.getUserId());
|
|
entity.setCreatorId(baseService.getUserId());
|
|
list.add(entity);
|
|
list.add(entity);
|
|
tableId = dto.getTableId();
|
|
tableId = dto.getTableId();
|
|
|
|
+// this.save(entity);
|
|
}
|
|
}
|
|
TableEntity tableEntity = tableService.getById(tableId);
|
|
TableEntity tableEntity = tableService.getById(tableId);
|
|
BaseRuntimeException.isNull(tableEntity, ErrorEnum.FAILURE_CODE_3001);
|
|
BaseRuntimeException.isNull(tableEntity, ErrorEnum.FAILURE_CODE_3001);
|
|
|
|
|
|
- this.saveBatch(list);
|
|
|
|
|
|
+ this.saveBatch(list, 20);
|
|
|
|
+// this.saveOrUpdateBatch(list, 20);
|
|
|
|
|
|
// 添加字段到表
|
|
// 添加字段到表
|
|
- tableService.addField(list, tableEntity.getName());
|
|
|
|
|
|
+ tableService.addField(list, tableEntity.getNameTable());
|
|
|
|
|
|
// 删除缓存
|
|
// 删除缓存
|
|
String fieldTableKey = FIELD_TABLE_KEY+tableId;
|
|
String fieldTableKey = FIELD_TABLE_KEY+tableId;
|
|
@@ -113,8 +115,8 @@ public class FieldServiceImpl extends ServiceImpl<FieldMapper, FieldEntity> impl
|
|
* @param tableIds
|
|
* @param tableIds
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public void removeBatchByTableId(List<Integer> tableIds) {
|
|
|
|
- for (Integer tableId : tableIds) {
|
|
|
|
|
|
+ public void removeBatchByTableId(List<Long> tableIds) {
|
|
|
|
+ for (Long tableId : tableIds) {
|
|
LambdaUpdateWrapper<FieldEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
|
LambdaUpdateWrapper<FieldEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
|
updateWrapper.eq(FieldEntity::getTableId, tableId);
|
|
updateWrapper.eq(FieldEntity::getTableId, tableId);
|
|
updateWrapper.set(FieldEntity::getIsDelete, 1);
|
|
updateWrapper.set(FieldEntity::getIsDelete, 1);
|
|
@@ -131,18 +133,14 @@ public class FieldServiceImpl extends ServiceImpl<FieldMapper, FieldEntity> impl
|
|
@Override
|
|
@Override
|
|
public Result delField(IdsDto param) {
|
|
public Result delField(IdsDto param) {
|
|
|
|
|
|
-
|
|
|
|
- // todo 校验appId
|
|
|
|
-
|
|
|
|
// 删除表字段
|
|
// 删除表字段
|
|
- List<Integer> ids = param.getIds();
|
|
|
|
|
|
+ List<Long> ids = param.getIds();
|
|
List<String> fieldNames = getFieldName(ids);
|
|
List<String> fieldNames = getFieldName(ids);
|
|
|
|
|
|
-// String tableName = getTableNameByFieldId(ids.get(0));
|
|
|
|
|
|
|
|
TableEntity tableEntity = tableService.getTableByFieldId(ids.get(0));
|
|
TableEntity tableEntity = tableService.getTableByFieldId(ids.get(0));
|
|
BaseRuntimeException.isNull(tableEntity, null, "该表不存在");
|
|
BaseRuntimeException.isNull(tableEntity, null, "该表不存在");
|
|
- String tableName = tableEntity.getName();
|
|
|
|
|
|
+ String tableName = tableEntity.getNameTable();
|
|
Long tableId = tableEntity.getId();
|
|
Long tableId = tableEntity.getId();
|
|
|
|
|
|
for (String name : fieldNames) {
|
|
for (String name : fieldNames) {
|
|
@@ -151,6 +149,7 @@ public class FieldServiceImpl extends ServiceImpl<FieldMapper, FieldEntity> impl
|
|
if (integer > 0){
|
|
if (integer > 0){
|
|
// 真删除字段
|
|
// 真删除字段
|
|
ddlMapper.delField(tableName, name);
|
|
ddlMapper.delField(tableName, name);
|
|
|
|
+ log.info("删除字段: {}", name);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -238,7 +237,7 @@ public class FieldServiceImpl extends ServiceImpl<FieldMapper, FieldEntity> impl
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
- private List<String> getFieldName(List<Integer> ids){
|
|
|
|
|
|
+ private List<String> getFieldName(List<Long> ids){
|
|
List<FieldEntity> entityList = this.listByIds(ids);
|
|
List<FieldEntity> entityList = this.listByIds(ids);
|
|
List<String> filedNames = new ArrayList<>();
|
|
List<String> filedNames = new ArrayList<>();
|
|
for (FieldEntity entity : entityList) {
|
|
for (FieldEntity entity : entityList) {
|
|
@@ -340,7 +339,7 @@ public class FieldServiceImpl extends ServiceImpl<FieldMapper, FieldEntity> impl
|
|
BaseRuntimeException.isNull(tableEntity, ErrorEnum.FAILURE_CODE_3001);
|
|
BaseRuntimeException.isNull(tableEntity, ErrorEnum.FAILURE_CODE_3001);
|
|
|
|
|
|
List<String> searchField = getSearchField(tableId);
|
|
List<String> searchField = getSearchField(tableId);
|
|
- IPage<Map> resPage = getBaseMapper().page(tableEntity.getName(), searchField, param.getSearchKey(), page);
|
|
|
|
|
|
+ IPage<Map> resPage = getBaseMapper().page(tableEntity.getNameTable(), searchField, param.getSearchKey(), page);
|
|
|
|
|
|
Map resultMap = new HashMap();
|
|
Map resultMap = new HashMap();
|
|
resultMap.put("fieldNames", gertFieldListByTableId(tableId));
|
|
resultMap.put("fieldNames", gertFieldListByTableId(tableId));
|
|
@@ -354,7 +353,7 @@ public class FieldServiceImpl extends ServiceImpl<FieldMapper, FieldEntity> impl
|
|
TableEntity tableEntity = tableService.getById(tableId);
|
|
TableEntity tableEntity = tableService.getById(tableId);
|
|
BaseRuntimeException.isNull(tableEntity, ErrorEnum.FAILURE_CODE_3001);
|
|
BaseRuntimeException.isNull(tableEntity, ErrorEnum.FAILURE_CODE_3001);
|
|
|
|
|
|
- Map dataMap = getBaseMapper().detail(tableEntity.getName(), getFileNames(tableId), id);
|
|
|
|
|
|
+ Map dataMap = getBaseMapper().detail(tableEntity.getNameTable(), getFileNames(tableId), id);
|
|
|
|
|
|
return Result.success(dataMap);
|
|
return Result.success(dataMap);
|
|
}
|
|
}
|