提交 ad9f5fdc authored 作者: ww1xhqc's avatar ww1xhqc

model layer 继承BaseEntity

上级 2bf38c9f
......@@ -53,7 +53,7 @@ public class ModelController {
throwables.printStackTrace();
}
return ResultUtil.success(tableInfos,"");
return ResultUtil.success(tableInfos, "");
}
/**
......@@ -69,7 +69,7 @@ public class ModelController {
if (tableName != null && tableName != "") {
return ResultUtil.failed("表名不存在");
}
return ResultUtil.success(modelService.showModelFields(tableName),"");
return ResultUtil.success(modelService.showModelFields(tableName), "");
}
/**
......@@ -89,7 +89,7 @@ public class ModelController {
}
}
modelService.newTable(tableVO);
return ResultUtil.success("","新建成功");
return ResultUtil.success("", "新建成功");
}
......@@ -105,43 +105,69 @@ public class ModelController {
@PostMapping("/insertValues")
public ResponseEntity insertValues(@RequestBody Map<String, Object> map) {
modelService.putValueByEntityName(map);
return ResultUtil.success("数据插入成功","");
return ResultUtil.success("数据插入成功", "");
}
/**
* @Author WWW
* @Description 根据表名查询所有数据
* @Date 9:30 2021/3/11
* @param tableName
* @return org.springframework.http.ResponseEntity
**/
/**
* @param tableName
* @return org.springframework.http.ResponseEntity
* @Author WWW
* @Description 根据表名查询所有数据
* @Date 9:30 2021/3/11
**/
@ApiOperation("根据表名查询所有数据")
@GetMapping("/getAll")
public ResponseEntity getAll(String tableName) {
try {
return ResultUtil.success( modelService.findAllByName(tableName),"");
return ResultUtil.success(modelService.findAllByName(tableName), "");
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return ResultUtil.success( null,"获取失败");
return ResultUtil.success(null, "获取失败");
}
/**
* @Author WWW
* @Description 复杂查询
* @Date 11:03 2021/3/11
* @param tableName
* @param queryConditions
* @return org.springframework.http.ResponseEntity
**/
/**
* @param tableName
* @return org.springframework.http.ResponseEntity
* @Author WWW
* @Description 判断表名是否重复
* @Date 10:26 2021/3/12
**/
@ApiOperation("判断表名是否重复")
@GetMapping("/checkTable")
public ResponseEntity check(String tableName) {
List<TableInfo> tableInfos = null;
try {
tableInfos = modelService.listAllEntities();
} catch (SQLException throwables) {
throwables.printStackTrace();
}
for (TableInfo tableInfo : tableInfos) {
if (tableName.equals(tableInfo.getName())) {
return ResultUtil.failed("表已经存在!");
}
}
return ResultUtil.success("表不存在新建成功!");
}
/**
* @param tableName
* @param queryConditions
* @return org.springframework.http.ResponseEntity
* @Author WWW
* @Description 复杂查询
* @Date 11:03 2021/3/11
**/
@ApiOperation("复杂查询")
@GetMapping("/complexQuery")
public ResponseEntity complexQuery(String tableName, List<QueryCondition> queryConditions) {
List list = modelService.complexQuery(tableName, queryConditions);
if (list!=null){
return ResultUtil.success(list,"查询成功");
if (list != null) {
return ResultUtil.success(list, "查询成功");
}
return ResultUtil.success(null,"没有数据");
return ResultUtil.success(null, "没有数据");
}
}
package com.tykj.workflowcore.model_layer.model;
import com.tykj.workflowcore.base.entity.BaseEntity;
import com.tykj.workflowcore.model_layer.annotatiion.WorkFlowCoreNoScan;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
......@@ -18,30 +20,30 @@ import javax.persistence.*;
@Entity
@Table(name = "column_info")
@Data
public class ColumnInfo {
public class ColumnInfo extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private long id;
@ApiModelProperty("是否主键")
/**
* 0是,1否
* 是否primary key, 0是,1否
*/
@Column(name = "primary_key")
private Integer primarykey;
@Column(name = "name")
private Integer primaryKey;
@ApiModelProperty("列名")
private String name;
@Column(name = "cn_name")
@ApiModelProperty("列名中文描述")
private String cnName;
@Column(name = "type")
@ApiModelProperty("列类型")
private String type;
@Column(name = "length")
@ApiModelProperty("长度")
private int length;
@Column(name = "db_name")
@ApiModelProperty("所属表名")
private String dbName;
@Column(name = "db_id")
@ApiModelProperty("所属表id")
private Long dbId;
......
package com.tykj.workflowcore.model_layer.model;
import com.tykj.workflowcore.base.entity.BaseEntity;
import com.tykj.workflowcore.model_layer.annotatiion.WorkFlowCoreNoScan;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.DynamicUpdate;
......@@ -27,40 +29,35 @@ import java.util.Date;
@EntityListeners(AuditingEntityListener.class)
@Table(name = "table_info")
@Data
public class TableInfo implements Serializable {
public class TableInfo extends BaseEntity implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private long id;
@Column(nullable = false,name = "name")
@ApiModelProperty("表名,不能为空")
@Column(nullable = false)
private String name;
@Column(nullable = false,name = "cn_name")
@ApiModelProperty("表中文名,不能为空")
@Column(nullable = false)
private String cnName;
@Column(name = "description")
private String desc;
@ApiModelProperty("详细描述")
private String description;
/**
*0是扫描,1是自建
*/
@Column(name = "type")
@ApiModelProperty("建表类型")
private Integer type;
@Column(name = "reviser")
@ApiModelProperty("执行人保留字段")
private String reviser;
@Lob
@Column(name = "xml")
@ApiModelProperty("表对应hbm.xml")
private String xml;
@Column(name = "update_time")
private Date updateTime;
@Column(name = "create_time")
private Date createTime;
}
package com.tykj.workflowcore.model_layer.model;
import com.tykj.workflowcore.model_layer.annotatiion.WorkFlowCoreNoScan;
import lombok.Data;
import java.util.List;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论