package com.engine.organization.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections.CollectionUtils;
import weaver.general.StringUtil;

import java.util.*;
import java.util.stream.Collectors;

/**
 * @Author dxfeng
 * @description:
 * @Date 2022/5/9
 * @Version V1.0
 **/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DeleteParam {
    private String ids;

    public List<Long> getIds() {
        if (StringUtil.isEmpty(ids)) {
            return new ArrayList<>();
        }
        ArrayList<Long> list = new ArrayList<>();
        Set<Long> collect = Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toSet());
        if (CollectionUtils.isNotEmpty(collect)) {
            list.addAll(collect);
        }
        return list;
    }

}
