|
|
@@ -1,8 +1,21 @@ |
|
|
|
package com.ningdatech.pmapi.organization.manage; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
|
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; |
|
|
|
import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO; |
|
|
|
import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO; |
|
|
|
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author liuxinxin |
|
|
|
* @date 2023/1/13 下午2:55 |
|
|
@@ -11,7 +24,34 @@ import org.springframework.stereotype.Component; |
|
|
|
@RequiredArgsConstructor |
|
|
|
public class OrganizationManage { |
|
|
|
|
|
|
|
// private final |
|
|
|
private final IDingOrganizationService iDingOrganizationService; |
|
|
|
|
|
|
|
public PageVo<ResOrganizationListVO> organizationList(ReqOrganizationListPO reqOrganizationListPO) { |
|
|
|
String orgName = reqOrganizationListPO.getOrgName(); |
|
|
|
|
|
|
|
Page<DingOrganization> page = iDingOrganizationService |
|
|
|
.page(new Page<>(reqOrganizationListPO.getPageNumber(), reqOrganizationListPO.getPageSize()) |
|
|
|
, Wrappers.lambdaQuery(DingOrganization.class) |
|
|
|
.like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName)); |
|
|
|
|
|
|
|
long total = page.getTotal(); |
|
|
|
List<DingOrganization> records = page.getRecords(); |
|
|
|
|
|
|
|
List<ResOrganizationListVO> resVOList = new ArrayList<>(); |
|
|
|
if (CollUtil.isNotEmpty(records)) { |
|
|
|
resVOList = records.stream().map(r -> { |
|
|
|
ResOrganizationListVO resOrganizationListVO = new ResOrganizationListVO(); |
|
|
|
resOrganizationListVO.setOrgCode(r.getOrganizationCode()); |
|
|
|
resOrganizationListVO.setOrgName(r.getOrganizationName()); |
|
|
|
// TODO 补充其他字段 |
|
|
|
return resOrganizationListVO; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
PageVo<ResOrganizationListVO> pageVo = new PageVo<>(); |
|
|
|
pageVo.setTotal(total); |
|
|
|
pageVo.setRecords(resVOList); |
|
|
|
return pageVo; |
|
|
|
} |
|
|
|
|
|
|
|
} |