提交 2c33101a authored 作者: zhoushaopan's avatar zhoushaopan

[工作流模块]修改了根页面id查询数据模型

上级 adbea71d
...@@ -29,18 +29,17 @@ public interface ModelService { ...@@ -29,18 +29,17 @@ public interface ModelService {
* 分页查询 * 分页查询
* @param searchTableInfoVo * @param searchTableInfoVo
* @return * @return
* @throws SQLException
*/ */
// @Cacheable(cacheNames = "tableInfos",sync = true) // @Cacheable(cacheNames = "tableInfos",sync = true)
Page<TableInfo> pageAllEntities(SearchTableInfoVo searchTableInfoVo) throws SQLException; Page<TableInfo> pageAllEntities(SearchTableInfoVo searchTableInfoVo);
/** /**
* 方法重载不分页查询 * 方法重载不分页查询
* @return * @return
* @throws SQLException
*/ */
List<TableInfo> listAllEntities(SearchTableInfoVo searchTableInfoVo) throws SQLException; List<TableInfo> listAllEntities(SearchTableInfoVo searchTableInfoVo) ;
......
...@@ -98,7 +98,7 @@ public class ModelImpl implements ModelService { ...@@ -98,7 +98,7 @@ public class ModelImpl implements ModelService {
} }
@Override @Override
public List<TableInfo> listAllEntities(SearchTableInfoVo searchTableInfoVo) throws SQLException { public List<TableInfo> listAllEntities(SearchTableInfoVo searchTableInfoVo) {
PredicateBuilder<TableInfo> and = createPredicateBySearchTableInfoVo(searchTableInfoVo); PredicateBuilder<TableInfo> and = createPredicateBySearchTableInfoVo(searchTableInfoVo);
return tableInfoDao.findAll(and.build()); return tableInfoDao.findAll(and.build());
} }
......
...@@ -15,7 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -15,7 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* ClassName: FormPageController * ClassName: FormPageController
...@@ -68,9 +71,11 @@ public class FormPageController { ...@@ -68,9 +71,11 @@ public class FormPageController {
} }
@ApiOperation("通过页面id查询所对应的数据模型") @ApiOperation("通过页面id查询所对应的数据模型")
@PostMapping("/findByPages") @PostMapping("/findByPageIds")
public TableAndColumnInfoVO findByPages(@RequestBody List<Integer> pageIds){ public List<TableInfo> findByPageIds(@RequestBody List<Integer> pageIds){
return formPageService.findByPageIds(pageIds); return formPageService.findByPageIds(pageIds);
} }
} }
...@@ -15,6 +15,7 @@ import org.springframework.beans.BeanUtils; ...@@ -15,6 +15,7 @@ import org.springframework.beans.BeanUtils;
import javax.persistence.*; import javax.persistence.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* ClassName: FormPage * ClassName: FormPage
...@@ -67,7 +68,9 @@ public class FormPage extends BaseEntity { ...@@ -67,7 +68,9 @@ public class FormPage extends BaseEntity {
String entityId = this.getEntityId(); String entityId = this.getEntityId();
String str[] = entityId.split(","); String str[] = entityId.split(",");
List<String> entityIds = Arrays.asList(str); List<String> entityIds = Arrays.asList(str);
inFormPageVo.setEntityIds(entityIds); //去重
List<String> collectIds = entityIds.stream().distinct().collect(Collectors.toList());
inFormPageVo.setEntityIds(collectIds);
return inFormPageVo; return inFormPageVo;
} }
} }
...@@ -61,12 +61,16 @@ public class FormPageVo { ...@@ -61,12 +61,16 @@ public class FormPageVo {
public FormPage toEntity(){ public FormPage toEntity(){
FormPage formPage = new FormPage(); FormPage formPage = new FormPage();
StringBuffer IdStr = new StringBuffer(); StringBuffer idStr = new StringBuffer();
for (String entityId : entityIds) {
IdStr.append(entityId); for (int i = 0; i < entityIds.size(); i++) {
IdStr.append(","); idStr.append(entityIds.get(i));
idStr.append(",");
if (i == entityIds.size()-1){
idStr.deleteCharAt(idStr.length()-1);
}
} }
formPage.setEntityId(IdStr.toString()); formPage.setEntityId(idStr.toString());
BeanUtils.copyProperties(this,formPage); BeanUtils.copyProperties(this,formPage);
return formPage; return formPage;
} }
......
...@@ -8,6 +8,7 @@ import com.tykj.workflowcore.workflow_editer.entity.vo.PageFormPageVo; ...@@ -8,6 +8,7 @@ import com.tykj.workflowcore.workflow_editer.entity.vo.PageFormPageVo;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import java.sql.SQLException;
import java.util.List; import java.util.List;
/** /**
...@@ -58,5 +59,6 @@ public interface FormPageService { ...@@ -58,5 +59,6 @@ public interface FormPageService {
* @param pageIds 页面id * @param pageIds 页面id
* @return * @return
*/ */
TableAndColumnInfoVO findByPageIds(List<Integer> pageIds); List<TableInfo> findByPageIds(List<Integer> pageIds);
} }
...@@ -5,6 +5,7 @@ import com.github.wenhao.jpa.PredicateBuilder; ...@@ -5,6 +5,7 @@ import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications; import com.github.wenhao.jpa.Specifications;
import com.tykj.workflowcore.model_layer.dao.TableInfoDao; import com.tykj.workflowcore.model_layer.dao.TableInfoDao;
import com.tykj.workflowcore.model_layer.entity.TableInfo; import com.tykj.workflowcore.model_layer.entity.TableInfo;
import com.tykj.workflowcore.model_layer.entity.vo.SearchTableInfoVo;
import com.tykj.workflowcore.model_layer.entity.vo.TableAndColumnInfoVO; import com.tykj.workflowcore.model_layer.entity.vo.TableAndColumnInfoVO;
import com.tykj.workflowcore.model_layer.service.ModelService; import com.tykj.workflowcore.model_layer.service.ModelService;
import com.tykj.workflowcore.workflow_editer.entity.FormPage; import com.tykj.workflowcore.workflow_editer.entity.FormPage;
...@@ -18,6 +19,7 @@ import org.springframework.data.domain.Sort; ...@@ -18,6 +19,7 @@ import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
...@@ -80,24 +82,29 @@ public class FormPageServiceImpl implements FormPageService { ...@@ -80,24 +82,29 @@ public class FormPageServiceImpl implements FormPageService {
} }
@Override @Override
public TableAndColumnInfoVO findByPageIds(List<Integer> pageIds) { public List<TableInfo> findByPageIds(List<Integer> pageIds) {
ArrayList<TableInfo> list = new ArrayList<>();
PredicateBuilder<FormPage> builder = Specifications.and(); PredicateBuilder<FormPage> builder = Specifications.and();
builder.in("id", pageIds); builder.in("id", pageIds);
List<FormPage> tableInfoList = formPageMapper.findAll(builder.build()); List<FormPage> tableInfoList = formPageMapper.findAll(builder.build());
StringBuffer entityIds = new StringBuffer(); StringBuffer entityIds = new StringBuffer();
for (FormPage formPage : tableInfoList) { for (int i = 0; i < tableInfoList.size(); i++) {
String entityId = formPage.getEntityId(); String entityId = tableInfoList.get(i).getEntityId();
entityIds.append(entityId); entityIds.append(entityId);
entityIds.append(","); entityIds.append(",");
if ( i == tableInfoList.size()-1 ){
entityIds.deleteCharAt(entityIds.length()-1);
}
} }
String[] split = entityIds.toString().split(","); String[] split = entityIds.toString().split(",");
List<String> lastEntityIds = Arrays.asList(split).stream().distinct().collect(Collectors.toList()); List<String> lastEntityIds = Arrays.asList(split).stream().distinct().collect(Collectors.toList());
//todo //todo
Integer[] ids = (Integer[]) lastEntityIds.toArray(); Integer[] ids = (Integer[]) lastEntityIds.toArray();
SearchTableInfoVo searchTableInfoVo = new SearchTableInfoVo();
searchTableInfoVo.setIds(ids);
return modelService.getTableInfoAndColumnInfoByBatch(ids); return modelService.listAllEntities(searchTableInfoVo);
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论