提交 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;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -18,26 +19,25 @@ public class Bind {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@JsonIgnore
private Integer id;
/**
* 是否为复数(List)
*/
private Boolean isComplex;
/**
* 绑定的TableInfo的name
*/
@ApiModelProperty(value = "绑定的基础对象的名称", position = 1)
private String name;
@ApiModelProperty(value = "绑定的基础对象的版本号", readOnly = true, position = 2)
private Integer version;
@ApiModelProperty(value = "是否为复数 true/false", position = 3)
private Boolean isComplex;
@JsonIgnore
private Integer tableInfoExId;
@JsonIgnore
private Integer parentId;
@ApiModelProperty(value = "下级基础对象的绑定信息", position = 4)
@Transient
private List<Bind> children;
......
......@@ -25,22 +25,22 @@ public class ColumnInfo {
//-----------------------------//
@ApiModelProperty("是否是主键")
@ApiModelProperty(value = "是否是主键 true/false",position = 1)
private Boolean isPrimary;
@ApiModelProperty("列名")
@ApiModelProperty(value = "列名",position = 1)
private String name;
@ApiModelProperty("列类型")
@ApiModelProperty(value = "列类型",position = 1)
private String type;
@ApiModelProperty("长度")
@ApiModelProperty(value = "长度",position = 1)
private Integer length;
@ApiModelProperty("所属表id")
@ApiModelProperty(value = "所属表id",position = 1)
private Integer tableInfoId;
@ApiModelProperty("描述")
@ApiModelProperty(value = "描述",position = 1)
private String description;
}
......@@ -36,24 +36,22 @@ public class TableInfo {
@JsonIgnore
private Date updatedTime;
//------------------------------//
@ApiModelProperty("表名,不能为空")
@Column(nullable = false)
@ApiModelProperty(value = "基础对象名", position = 1)
private String name;
@ApiModelProperty("描述")
@ApiModelProperty(value = "描述", position = 2)
private String description;
@ApiModelProperty("工作流预留字段")
@ApiModelProperty(value = "工作流预留字段", position = 3)
private String processKey;
@ApiModelProperty("版本号")
@ApiModelProperty(value = "版本号", readOnly = true, position = 4)
private Integer version;
@Transient
@ApiModelProperty("字段信息")
@ApiModelProperty(value = "字段信息", position = 5)
private List<ColumnInfo> columnInfos;
}
......
......@@ -36,14 +36,19 @@ public class TableInfoEx {
@JsonIgnore
private Date updatedTime;
@ApiModelProperty(value = "聚合对象名", position = 1)
private String name;
@ApiModelProperty(value = "描述", position = 2)
private String description;
@ApiModelProperty(value = "工作流用预留字段", position = 3)
private String processKey;
@ApiModelProperty(value = "版本号", readOnly = true, position = 4)
private Integer version;
@ApiModelProperty(value = "绑定信息", position = 5)
@Transient
private List<Bind> binds;
}
......@@ -6,5 +6,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ColumnInfoRepository extends JpaRepository<ColumnInfo, Integer> {
List<ColumnInfo> findByTableInfoId(Integer tableInfoId);
}
......@@ -88,7 +88,6 @@ public class TableInfoService {
//-----------------------------------------------------------------------------//
private TableInfo getColumnInfos(TableInfo tableInfo) {
List<ColumnInfo> columnInfos = columnInfoRepository.findByTableInfoId(tableInfo.getId());
tableInfo.setColumnInfos(columnInfos);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论