You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
weaver-hrm-organization/src/com/engine/organization/service/impl/CompServiceImpl.java

66 lines
2.5 KiB
Java

package com.engine.organization.service.impl;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.core.impl.Service;
import com.engine.organization.common.BaseQueryParam;
import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.comp.bo.CompBO;
import com.engine.organization.entity.comp.dto.CompListDTO;
import com.engine.organization.entity.comp.po.CompPO;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.service.CompService;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.page.Column;
import com.engine.organization.util.page.PageInfo;
import com.engine.organization.util.page.PageUtil;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/16
* @version: 1.0
*/
public class CompServiceImpl extends Service implements CompService {
private CompMapper getCompMapper() {
return MapperProxyFactory.getProxy(CompMapper.class);
}
@Override
public Map<String, Object> listPage(BaseQueryParam queryParam) {
Map<String,Object> datas = new HashMap<>();
PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<CompPO> list = getCompMapper().list(queryParam);
PageInfo<CompPO> pageInfo = new PageInfo<>(list, CompPO.class);
Collection<CompPO> compPOS = pageInfo.getList();
List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(compPOS);
PageInfo<CompListDTO> pageInfos = new PageInfo<>(compListDTOS, CompListDTO.class);
pageInfos.setTotal(pageInfo.getTotal());
pageInfos.setPageNum(queryParam.getCurrent());
pageInfos.setPageSize(queryParam.getPageSize());
OrganizationWeaTable<CompListDTO> table = new OrganizationWeaTable<>(user, CompListDTO.class);
List<Column> columns = pageInfos.getColumns();
List<WeaTableColumn> weaTableColumn = columns.stream().map(v -> new WeaTableColumn("100", v.getTitle(), v.getKey())).collect(Collectors.toList());
table.setColumns(weaTableColumn);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
datas.put("pageInfo", pageInfos);
datas.put("dataKey",result.getResultMap());
return datas;
}
}