package com.engine.salary.entity.salaryBill.bo;

import com.engine.salary.entity.salaryBill.dto.SalaryBillItemNameDTO;
import com.engine.salary.entity.salaryBill.po.SalaryBillItemNamePO;
import org.apache.commons.collections4.CollectionUtils;

import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author Harryxzy
 * @ClassName SalaryBillItemNameBO
 * @date 2023/07/19 9:19
 * @description 工资单薪资项目展示名称
 */
public class SalaryBillItemNameBO {

    public static List<SalaryBillItemNameDTO> convert2ListDTO(List<SalaryBillItemNamePO> SalaryBillItemNamePOList){
        if (CollectionUtils.isEmpty(SalaryBillItemNamePOList)) {
            return Collections.emptyList();
        }
        return SalaryBillItemNamePOList.stream()
                .map(po -> SalaryBillItemNameDTO.builder()
                        .salaryItemId(po.getSalaryItemId())
                        .salaryItemShowName(po.getSalaryItemShowName())
                        .build())
                .collect(Collectors.toList());
    }
}
