提交 b67a2fe1 authored 作者: 黄承天's avatar 黄承天

[模型模块]controller层补充

上级 400de769
package com.tykj.workflowcore.model.controller;
import com.tykj.workflowcore.base.result.ResultObj;
import com.tykj.workflowcore.base.result.ResultUtil;
import com.tykj.workflowcore.model.entity.TableInfo;
import com.tykj.workflowcore.model.service.TableInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Api(tags = "基础模型接口")
@CrossOrigin
@RequestMapping("/tableinfo")
@RestController
public class TableInfoController {
@Autowired
private TableInfoService tableInfoService;
@ApiOperation(value = "新增基础模型")
@PostMapping
public ResponseEntity save(@RequestBody TableInfo tableInfo){
tableInfoService.save(tableInfo);
return ResponseEntity.ok("新增成功");
}
@ApiOperation(value = "修改基础模型")
@PutMapping
public ResponseEntity update(@RequestBody TableInfo tableInfo){
tableInfoService.update(tableInfo);
return ResponseEntity.ok("修改成功");
}
@ApiOperation(value = "查询所有基础模型")
@GetMapping
public ResponseEntity<List<TableInfo>> findAll(){
List<TableInfo> tableInfos = tableInfoService.findAll();
return ResponseEntity.ok(tableInfos);
}
}
package com.tykj.workflowcore.model.controller;
import com.tykj.workflowcore.model.entity.TableInfoEx;
import com.tykj.workflowcore.model.service.TableInfoExService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Api(tags = "聚合模型接口")
@CrossOrigin
@RequestMapping("/tableinfoex")
@RestController
public class TableInfoExController {
@Autowired
private TableInfoExService tableInfoExService;
@ApiOperation(value = "新增聚合模型")
@PostMapping
public ResponseEntity save(@RequestBody TableInfoEx tableInfoEx){
tableInfoExService.save(tableInfoEx);
return ResponseEntity.ok("新增成功");
}
@ApiOperation(value = "修改聚合模型")
@PutMapping
public ResponseEntity update(@RequestBody TableInfoEx tableInfoEx){
tableInfoExService.update(tableInfoEx);
return ResponseEntity.ok("修改成功");
}
@ApiOperation(value = "查询所有聚合模型")
@GetMapping
public ResponseEntity<List<TableInfoEx>> findAll(){
List<TableInfoEx> tableInfos = tableInfoExService.findAll();
return ResponseEntity.ok(tableInfos);
}
}
package com.tykj.workflowcore.model.entity; package com.tykj.workflowcore.model.entity;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -18,26 +19,25 @@ public class Bind { ...@@ -18,26 +19,25 @@ public class Bind {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@JsonIgnore
private Integer id; private Integer id;
/** @ApiModelProperty(value = "绑定的基础对象的名称", position = 1)
* 是否为复数(List)
*/
private Boolean isComplex;
/**
* 绑定的TableInfo的name
*/
private String name; private String name;
@ApiModelProperty(value = "绑定的基础对象的版本号", readOnly = true, position = 2)
private Integer version; private Integer version;
@ApiModelProperty(value = "是否为复数 true/false", position = 3)
private Boolean isComplex;
@JsonIgnore @JsonIgnore
private Integer tableInfoExId; private Integer tableInfoExId;
@JsonIgnore @JsonIgnore
private Integer parentId; private Integer parentId;
@ApiModelProperty(value = "下级基础对象的绑定信息", position = 4)
@Transient @Transient
private List<Bind> children; private List<Bind> children;
......
...@@ -25,22 +25,22 @@ public class ColumnInfo { ...@@ -25,22 +25,22 @@ public class ColumnInfo {
//-----------------------------// //-----------------------------//
@ApiModelProperty("是否是主键") @ApiModelProperty(value = "是否是主键 true/false",position = 1)
private Boolean isPrimary; private Boolean isPrimary;
@ApiModelProperty("列名") @ApiModelProperty(value = "列名",position = 1)
private String name; private String name;
@ApiModelProperty("列类型") @ApiModelProperty(value = "列类型",position = 1)
private String type; private String type;
@ApiModelProperty("长度") @ApiModelProperty(value = "长度",position = 1)
private Integer length; private Integer length;
@ApiModelProperty("所属表id") @ApiModelProperty(value = "所属表id",position = 1)
private Integer tableInfoId; private Integer tableInfoId;
@ApiModelProperty("描述") @ApiModelProperty(value = "描述",position = 1)
private String description; private String description;
} }
...@@ -36,24 +36,22 @@ public class TableInfo { ...@@ -36,24 +36,22 @@ public class TableInfo {
@JsonIgnore @JsonIgnore
private Date updatedTime; private Date updatedTime;
//------------------------------// //------------------------------//
@ApiModelProperty("表名,不能为空") @ApiModelProperty(value = "基础对象名", position = 1)
@Column(nullable = false)
private String name; private String name;
@ApiModelProperty("描述") @ApiModelProperty(value = "描述", position = 2)
private String description; private String description;
@ApiModelProperty("工作流预留字段") @ApiModelProperty(value = "工作流预留字段", position = 3)
private String processKey; private String processKey;
@ApiModelProperty("版本号") @ApiModelProperty(value = "版本号", readOnly = true, position = 4)
private Integer version; private Integer version;
@Transient @Transient
@ApiModelProperty("字段信息") @ApiModelProperty(value = "字段信息", position = 5)
private List<ColumnInfo> columnInfos; private List<ColumnInfo> columnInfos;
} }
......
...@@ -36,14 +36,19 @@ public class TableInfoEx { ...@@ -36,14 +36,19 @@ public class TableInfoEx {
@JsonIgnore @JsonIgnore
private Date updatedTime; private Date updatedTime;
@ApiModelProperty(value = "聚合对象名", position = 1)
private String name; private String name;
@ApiModelProperty(value = "描述", position = 2)
private String description; private String description;
@ApiModelProperty(value = "工作流用预留字段", position = 3)
private String processKey; private String processKey;
@ApiModelProperty(value = "版本号", readOnly = true, position = 4)
private Integer version; private Integer version;
@ApiModelProperty(value = "绑定信息", position = 5)
@Transient @Transient
private List<Bind> binds; private List<Bind> binds;
} }
...@@ -6,5 +6,7 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -6,5 +6,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List; import java.util.List;
public interface ColumnInfoRepository extends JpaRepository<ColumnInfo, Integer> { public interface ColumnInfoRepository extends JpaRepository<ColumnInfo, Integer> {
List<ColumnInfo> findByTableInfoId(Integer tableInfoId); List<ColumnInfo> findByTableInfoId(Integer tableInfoId);
} }
...@@ -88,7 +88,6 @@ public class TableInfoService { ...@@ -88,7 +88,6 @@ public class TableInfoService {
//-----------------------------------------------------------------------------// //-----------------------------------------------------------------------------//
private TableInfo getColumnInfos(TableInfo tableInfo) { private TableInfo getColumnInfos(TableInfo tableInfo) {
List<ColumnInfo> columnInfos = columnInfoRepository.findByTableInfoId(tableInfo.getId()); List<ColumnInfo> columnInfos = columnInfoRepository.findByTableInfoId(tableInfo.getId());
tableInfo.setColumnInfos(columnInfos); tableInfo.setColumnInfos(columnInfos);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论