|
|
@ -87,6 +87,9 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> { |
|
|
|
@PostMapping(value = "/add") |
|
|
|
@PostMapping(value = "/add") |
|
|
|
public Result<?> add(@RequestBody Fieldx fieldx) { |
|
|
|
public Result<?> add(@RequestBody Fieldx fieldx) { |
|
|
|
fieldx.setVerison(1); |
|
|
|
fieldx.setVerison(1); |
|
|
|
|
|
|
|
if (fieldx.getAssociateTable() != null && fieldx.getAssociateTable().equals(fieldx.getTableId())){ |
|
|
|
|
|
|
|
return Result.error("实体不能关联自身,添加失败"); |
|
|
|
|
|
|
|
} |
|
|
|
if (fieldx.getTableId() != null){ |
|
|
|
if (fieldx.getTableId() != null){ |
|
|
|
List<Fieldx> fieldxList = fieldxService.list(new QueryWrapper<Fieldx>().eq("table_id", fieldx.getTableId())); |
|
|
|
List<Fieldx> fieldxList = fieldxService.list(new QueryWrapper<Fieldx>().eq("table_id", fieldx.getTableId())); |
|
|
|
for (Fieldx fieldx1 : fieldxList){ |
|
|
|
for (Fieldx fieldx1 : fieldxList){ |
|
|
@ -116,6 +119,23 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> { |
|
|
|
@ApiOperation(value="字段管理-编辑", notes="字段管理-编辑") |
|
|
|
@ApiOperation(value="字段管理-编辑", notes="字段管理-编辑") |
|
|
|
@PutMapping(value = "/edit") |
|
|
|
@PutMapping(value = "/edit") |
|
|
|
public Result<?> edit(@RequestBody Fieldx fieldx) { |
|
|
|
public Result<?> edit(@RequestBody Fieldx fieldx) { |
|
|
|
|
|
|
|
if (fieldx.getAssociateTable() != null && fieldx.getAssociateTable().equals(fieldx.getTableId())){ |
|
|
|
|
|
|
|
return Result.error("实体不能关联自身,编辑失败"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fieldx.getTableId() != null){ |
|
|
|
|
|
|
|
List<Fieldx> fieldxList = fieldxService.list(new QueryWrapper<Fieldx>().eq("table_id", fieldx.getTableId())); |
|
|
|
|
|
|
|
for (Fieldx fieldx1 : fieldxList){ |
|
|
|
|
|
|
|
if (fieldx1.getFieldName().equals(fieldx.getFieldName())){ |
|
|
|
|
|
|
|
return Result.error("编辑失败,所属实体已有该中文名称"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fieldx1.getFieldEnName().equals(fieldx.getFieldEnName())){ |
|
|
|
|
|
|
|
return Result.error("编辑失败,所属实体已有该英文名称"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fieldx.getIsPk() == 1 && fieldx1.getIsPk() == 1){ |
|
|
|
|
|
|
|
return Result.error("该实体已经有主键,编辑失败"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
fieldxService.updateById(fieldx); |
|
|
|
fieldxService.updateById(fieldx); |
|
|
|
tablexService.updateSql(fieldx.getTableId(),createSql(fieldx.getTableId())); |
|
|
|
tablexService.updateSql(fieldx.getTableId(),createSql(fieldx.getTableId())); |
|
|
|
return Result.OK("编辑成功!"); |
|
|
|
return Result.OK("编辑成功!"); |
|
|
|