|
@@ -1,6 +1,5 @@
|
|
|
package com.gis.db.service.impl;
|
|
|
|
|
|
-import cn.hutool.core.lang.Snowflake;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -25,9 +24,9 @@ import com.gis.db.entity.vo.FieldVo;
|
|
|
import com.gis.db.mapper.DdlMapper;
|
|
|
import com.gis.db.mapper.FieldMapper;
|
|
|
import com.gis.db.service.FieldService;
|
|
|
+import com.gis.db.service.ProjectService;
|
|
|
import com.gis.db.service.TableService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.junit.Test;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -57,6 +56,9 @@ public class FieldServiceImpl extends ServiceImpl<FieldMapper, FieldEntity> impl
|
|
|
@Autowired
|
|
|
IBaseService baseService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ ProjectService projectService;
|
|
|
+
|
|
|
|
|
|
|
|
|
static final String TABLE_KEY = "table:";
|
|
@@ -83,16 +85,15 @@ public class FieldServiceImpl extends ServiceImpl<FieldMapper, FieldEntity> impl
|
|
|
entity.setCreatorId(baseService.getUserId());
|
|
|
list.add(entity);
|
|
|
tableId = dto.getTableId();
|
|
|
-// this.save(entity);
|
|
|
}
|
|
|
- TableEntity tableEntity = tableService.getById(tableId);
|
|
|
- BaseRuntimeException.isNull(tableEntity, ErrorEnum.FAILURE_CODE_3001);
|
|
|
+
|
|
|
+ String tableName = tableService.getTableName(tableId+"");
|
|
|
|
|
|
this.saveBatch(list, 20);
|
|
|
-// this.saveOrUpdateBatch(list, 20);
|
|
|
+
|
|
|
|
|
|
// 添加字段到表
|
|
|
- tableService.addField(list, tableEntity.getNameTable());
|
|
|
+ tableService.addField(list, tableName);
|
|
|
|
|
|
// 删除缓存
|
|
|
String fieldTableKey = FIELD_TABLE_KEY+tableId;
|
|
@@ -140,6 +141,8 @@ public class FieldServiceImpl extends ServiceImpl<FieldMapper, FieldEntity> impl
|
|
|
|
|
|
TableEntity tableEntity = tableService.getTableByFieldId(ids.get(0));
|
|
|
BaseRuntimeException.isNull(tableEntity, null, "该表不存在");
|
|
|
+ // 检查操作权限
|
|
|
+ projectService.checkCreatorId(tableEntity.getCreatorId());
|
|
|
String tableName = tableEntity.getNameTable();
|
|
|
Long tableId = tableEntity.getId();
|
|
|
|
|
@@ -220,7 +223,6 @@ public class FieldServiceImpl extends ServiceImpl<FieldMapper, FieldEntity> impl
|
|
|
@Override
|
|
|
public Result updateRecord(RecordDto param) {
|
|
|
String tableName = tableService.getTableName(param.getTableId());
|
|
|
-
|
|
|
String id = param.getId();
|
|
|
BaseRuntimeException.isBlank(id, null, "数据id不能为空");
|
|
|
|