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

[数据模型] 修改了查询列名的逻辑

上级 5cb69223
...@@ -16,6 +16,7 @@ import lombok.NoArgsConstructor; ...@@ -16,6 +16,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@Data @Data
public class SearchColumnInfoVo extends JpaCustomPage { public class SearchColumnInfoVo extends JpaCustomPage {
private Integer id; private Integer id;
private String dbName; private String dbName;
} }
...@@ -4,12 +4,14 @@ import cn.hutool.db.Db; ...@@ -4,12 +4,14 @@ import cn.hutool.db.Db;
import com.github.wenhao.jpa.PredicateBuilder; import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications; import com.github.wenhao.jpa.Specifications;
import com.tykj.workflowcore.model_layer.annotatiion.WorkFlowCoreNoScan; import com.tykj.workflowcore.model_layer.annotations.WorkFlowCoreNoScan;
import com.tykj.workflowcore.model_layer.dao.ColumnInfoDao; import com.tykj.workflowcore.model_layer.dao.ColumnInfoDao;
import com.tykj.workflowcore.model_layer.dao.TableInfoDao; import com.tykj.workflowcore.model_layer.dao.TableInfoDao;
import com.tykj.workflowcore.model_layer.model.*; import com.tykj.workflowcore.model_layer.entity.TableInfo;
import com.tykj.workflowcore.model_layer.entity.vo.*;
import com.tykj.workflowcore.model_layer.entity.*;
import com.tykj.workflowcore.model_layer.service.ModelService; import com.tykj.workflowcore.model_layer.service.ModelService;
import com.tykj.workflowcore.model_layer.utils.CreatTableUtil; import com.tykj.workflowcore.model_layer.utils.CreateTableUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -41,7 +43,8 @@ import java.text.SimpleDateFormat; ...@@ -41,7 +43,8 @@ import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import static com.tykj.workflowcore.model_layer.utils.ClassTypeLength.setLength; import static com.tykj.workflowcore.model_layer.utils.ClassTypeLength.setLength;
import static com.tykj.workflowcore.model_layer.utils.CreatTableUtil.*;
import static com.tykj.workflowcore.model_layer.utils.CreateTableUtil.*;
import static com.tykj.workflowcore.model_layer.utils.HqlUtil.createQuery; import static com.tykj.workflowcore.model_layer.utils.HqlUtil.createQuery;
...@@ -91,15 +94,12 @@ public class ModelImpl implements ModelService { ...@@ -91,15 +94,12 @@ public class ModelImpl implements ModelService {
* @Date 16:15 2021/3/5 * @Date 16:15 2021/3/5
**/ **/
@Override @Override
public List<ColumnInfo> showModelFields(String tableName) { public List<ColumnInfo> showModelFields(SearchColumnInfoVo SearchColumnInfoVo) {
PredicateBuilder<ColumnInfo> and = Specifications.and();
and.eq(SearchColumnInfoVo.getId() != null, "id", SearchColumnInfoVo.getId());
and.eq(SearchColumnInfoVo.getDbName() != null, "dbName", SearchColumnInfoVo.getDbName());
return columnInfoDao.findAll(and.build());
Specification specification = (Specification) (root, criteriaQuery, criteriaBuilder) -> {
Path dbName = root.get("dbName");
Predicate equal = criteriaBuilder.equal(dbName, tableName);
return equal;
};
List<ColumnInfo> all = columnInfoDao.findAll(specification);
return all;
} }
...@@ -112,7 +112,7 @@ public class ModelImpl implements ModelService { ...@@ -112,7 +112,7 @@ public class ModelImpl implements ModelService {
**/ **/
@Override @Override
public TableVO newTable(TableVO tableVO) { public TableVO newTable(TableVO tableVO) {
String xmlMapping = creatTable(tableVO); String xmlMapping = createTable(tableVO);
Integer modelType = tableVO.getModelType(); Integer modelType = tableVO.getModelType();
String parentTable = null; String parentTable = null;
//扫描新建类型 //扫描新建类型
...@@ -123,7 +123,7 @@ public class ModelImpl implements ModelService { ...@@ -123,7 +123,7 @@ public class ModelImpl implements ModelService {
tableVO.setModelType(1); tableVO.setModelType(1);
} }
CreatTableUtil creatTableUtil = new CreatTableUtil(); CreateTableUtil creatTableUtil = new CreateTableUtil();
Session session = creatTableUtil.getSession(entityManagerFactory, xmlMapping); Session session = creatTableUtil.getSession(entityManagerFactory, xmlMapping);
List<ColumnVO> dataList = tableVO.getDataList(); List<ColumnVO> dataList = tableVO.getDataList();
...@@ -199,7 +199,7 @@ public class ModelImpl implements ModelService { ...@@ -199,7 +199,7 @@ public class ModelImpl implements ModelService {
* @Date 16:17 2021/3/5 * @Date 16:17 2021/3/5
**/ **/
public void insertValue(String tableName, String xml, Map map) { public void insertValue(String tableName, String xml, Map map) {
CreatTableUtil creatTableUtil = new CreatTableUtil(); CreateTableUtil creatTableUtil = new CreateTableUtil();
Session newSession = creatTableUtil.getSession(entityManagerFactory, xml); Session newSession = creatTableUtil.getSession(entityManagerFactory, xml);
SessionImpl session = (SessionImpl) newSession; SessionImpl session = (SessionImpl) newSession;
EntityPersister entityPersister = session.getEntityPersister(tableName, map); EntityPersister entityPersister = session.getEntityPersister(tableName, map);
...@@ -300,7 +300,7 @@ public class ModelImpl implements ModelService { ...@@ -300,7 +300,7 @@ public class ModelImpl implements ModelService {
list.add(columnVO); list.add(columnVO);
} }
tableVO.setDataList(list); tableVO.setDataList(list);
String xml = creatTable(tableVO); String xml = createTable(tableVO);
tableInfo.setName(tableVO.getModelName()); tableInfo.setName(tableVO.getModelName());
tableInfo.setCnName(tableVO.getModelTitle()); tableInfo.setCnName(tableVO.getModelTitle());
tableInfo.setXml(xml); tableInfo.setXml(xml);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论