package com.engine.salary.cmd.TaxRate;

import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.biz.TaxRateBiz;
import com.engine.salary.exception.SalaryRunTimeException;
import org.apache.commons.collections4.CollectionUtils;
import weaver.hrm.User;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

public class TaxRateDeleteCmd extends AbstractCommonCommand<Map<String, Object>> {

    public TaxRateDeleteCmd(Map<String, Object> params, User user) {
        this.user = user;
        this.params = params;
    }

    @Override
    public BizLogContext getLogContext() {
        return null;
    }

    @Override
    public Map<String, Object> execute(CommandContext commandContext) {
        Map<String, Object> apidatas = new HashMap<String, Object>(16);


        Collection<Long> ids = (Collection<Long>)params.get("ids");
        if (CollectionUtils.isEmpty(ids)) {
            throw new SalaryRunTimeException("参数错误");
        }
        TaxRateBiz taxRateBiz = new TaxRateBiz();

        taxRateBiz.deleteByIds(ids);

        return apidatas;
    }



}
