提交 adbea71d authored 作者: 黄夏豪's avatar 黄夏豪

[数据模型] 修改了查询数据模型的不带分页的方法 增加了多条件查询

上级 01d937b5
......@@ -31,7 +31,7 @@ public class WebMvcConfig {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/xml/**")
registry.addResourceHandler("/workflow/xml/**")
.addResourceLocations("file:" + System.getProperty("user.dir") + "\\xml\\");
}
};
......
......@@ -52,7 +52,7 @@ public class ModelController {
public ResponseEntity getAllEntity(@RequestBody SearchTableInfoVo searchTableInfoVo) {
Page<TableInfo> tableInfos;
try {
tableInfos = modelService.listAllEntities(searchTableInfoVo);
tableInfos = modelService.pageAllEntities(searchTableInfoVo);
} catch (SQLException throwables) {
return ResultUtil.failed("数据查询失败!");
......@@ -83,7 +83,7 @@ public class ModelController {
@ApiOperation("新增数据模型")
@PostMapping(value = "/addModel")
public ResponseEntity addModel(@RequestBody TableVO tableVO) throws Exception {
List<TableInfo> tableInfos = modelService.listAllEntities();
List<TableInfo> tableInfos = modelService.listAllEntities(null);
for (TableInfo tableInfo : tableInfos) {
if (tableVO.getModelName().equals(tableInfo.getModelName())) {
return ResultUtil.failed("表已经存在!");
......
......@@ -26,4 +26,6 @@ public class SearchTableInfoVo extends JpaCustomPage {
private String modelTitle;
private Integer[] modelType;
private Integer[] ids;
}
......@@ -32,7 +32,7 @@ public interface ModelService {
* @throws SQLException
*/
// @Cacheable(cacheNames = "tableInfos",sync = true)
Page<TableInfo> listAllEntities(SearchTableInfoVo searchTableInfoVo) throws SQLException;
Page<TableInfo> pageAllEntities(SearchTableInfoVo searchTableInfoVo) throws SQLException;
/**
......@@ -40,7 +40,7 @@ public interface ModelService {
* @return
* @throws SQLException
*/
List<TableInfo> listAllEntities() throws SQLException;
List<TableInfo> listAllEntities(SearchTableInfoVo searchTableInfoVo) throws SQLException;
......
......@@ -91,15 +91,29 @@ public class ModelImpl implements ModelService {
* @Date 16:14 2021/3/5
**/
@Override
public Page<TableInfo> listAllEntities(SearchTableInfoVo searchTableInfoVo) {
PredicateBuilder<TableInfo> and = Specifications.and();
and.like(searchTableInfoVo.getModelName() != null && StringUtils.isNotEmpty(searchTableInfoVo.getModelName()), "modelName", "%" + searchTableInfoVo.getModelName() + "%");
and.like(searchTableInfoVo.getModelTitle() != null && StringUtils.isNotEmpty(searchTableInfoVo.getModelTitle()), "modelTitle", "%" + searchTableInfoVo.getModelTitle() + "%");
and.in(searchTableInfoVo.getModelType() != null&&searchTableInfoVo.getModelType().length>0, "modelType", searchTableInfoVo.getModelType());
public Page<TableInfo> pageAllEntities(SearchTableInfoVo searchTableInfoVo) {
PredicateBuilder<TableInfo> and = createPredicateBySearchTableInfoVo(searchTableInfoVo);
return tableInfoDao.findAll(and.build(), searchTableInfoVo.getPageable());
}
@Override
public List<TableInfo> listAllEntities(SearchTableInfoVo searchTableInfoVo) throws SQLException {
PredicateBuilder<TableInfo> and = createPredicateBySearchTableInfoVo(searchTableInfoVo);
return tableInfoDao.findAll(and.build());
}
private PredicateBuilder<TableInfo> createPredicateBySearchTableInfoVo(SearchTableInfoVo searchTableInfoVo){
PredicateBuilder<TableInfo> and = Specifications.and();
if (searchTableInfoVo!=null){
and.like(searchTableInfoVo.getModelName() != null && StringUtils.isNotEmpty(searchTableInfoVo.getModelName()), "modelName", "%" + searchTableInfoVo.getModelName() + "%");
and.like(searchTableInfoVo.getModelTitle() != null && StringUtils.isNotEmpty(searchTableInfoVo.getModelTitle()), "modelTitle", "%" + searchTableInfoVo.getModelTitle() + "%");
and.in(searchTableInfoVo.getModelType() != null&&searchTableInfoVo.getModelType().length>0, "modelType", searchTableInfoVo.getModelType());
and.in(searchTableInfoVo.getIds() != null&&searchTableInfoVo.getIds().length>0, "id", searchTableInfoVo.getIds());
}
return and;
}
/**
* @param searchColumnInfoVo
* @return java.util.List<com.tykj.workflowcore.model_layer.model.ColumnInfo>
......@@ -419,12 +433,6 @@ public class ModelImpl implements ModelService {
return null;
}
@Override
public List<TableInfo> listAllEntities() {
return tableInfoDao.findAll();
}
@Override
public int updateTable(UpdateTableInfoVO updateTableInfoVO) {
//tableInfo和columnInfo变化
......
......@@ -568,5 +568,9 @@ public class WorkFlowServiceImpl implements WorkFlowService {
return map;
}
public static void main(String[] args) {
System.out.println("1");
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论