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

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

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