|
@@ -79,6 +79,65 @@ public class OrgController extends ControllerSupport {
|
|
|
@Autowired
|
|
|
OrgPropertyRepo orgPropertyRepo;
|
|
|
|
|
|
+ @ApiOperation(value = "分页查询所有机构")
|
|
|
+ @GetMapping("fullOrgPage/{curPage}/{pageSize}")
|
|
|
+ public PageInfo<OrgDomain> getFullOrgPage(@PathVariable Integer curPage,
|
|
|
+ @PathVariable Integer pageSize, @RequestParam(required = false) String code,
|
|
|
+ @RequestParam(required = false) String name,
|
|
|
+ @RequestParam(required = false) String propertyKeys) {
|
|
|
+
|
|
|
+ Pageable pageable = new PageRequest(curPage, pageSize, Sort.Direction.DESC, "updateTime");
|
|
|
+
|
|
|
+ Specification<OrgEntity> specification = (root, query, cb) -> {
|
|
|
+ List<Predicate> predicates = new ArrayList<>();
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(name)) {
|
|
|
+ predicates.add(cb.like(root.get("name"), toSqlSearchPattern(name)));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(code)) {
|
|
|
+ predicates.add(cb.like(root.get("code"), toSqlSearchPattern(code)));
|
|
|
+ }
|
|
|
+ return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
+ };
|
|
|
+
|
|
|
+ Page<OrgEntity> page = orgRepo.findAll(specification, pageable);
|
|
|
+ List<OrgDomain> list = Lists.newArrayList();
|
|
|
+ Iterator<OrgEntity> iterator = page.iterator();
|
|
|
+
|
|
|
+ List<String> propertyKeyList = null;
|
|
|
+ if (StringUtils.isNotBlank(propertyKeys)) {
|
|
|
+ propertyKeyList = RegExpUtil.findAll(propertyKeys, "\\w+");
|
|
|
+ }
|
|
|
+
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ OrgEntity next = iterator.next();
|
|
|
+ OrgDomain d = new OrgDomain();
|
|
|
+ list.add(d);
|
|
|
+
|
|
|
+ d.setCode(next.getCode());
|
|
|
+ d.setContacts(next.getContacts());
|
|
|
+ d.setEnable(next.getEnable());
|
|
|
+ d.setId(next.getId());
|
|
|
+ d.setName(next.getName());
|
|
|
+ d.setParentId(next.getParentId());
|
|
|
+ d.setRemark(next.getRemark());
|
|
|
+ d.setRootId(next.getRootId());
|
|
|
+ d.setTelephone(next.getTelephone());
|
|
|
+ d.setCreationTime(next.getCreationTime());
|
|
|
+ d.setUpdateTime(next.getUpdateTime());
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(propertyKeyList)) {
|
|
|
+ Map<String, String> properties = getProperties(d.getId(), propertyKeyList);
|
|
|
+ d.setProperties(properties);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ PageInfo<OrgDomain> ret = new PageInfo<OrgDomain>();
|
|
|
+ ret.setList(list);
|
|
|
+ ret.setTotal(page.getTotalElements());
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 方法注释
|
|
|
*
|