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

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

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