package net.northking.cctp.dw.api.atu.service;

import net.northking.cctp.dw.db.entity.DwAtuPlanTask;
import net.northking.cctp.dw.db.service.DwAtuPlanTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
@ConditionalOnMissingBean(name = "DwAtuPlanTaskApiServiceImpl")
public class DwAtuPlanTaskApiServiceImpl implements DwAtuPlanTaskApiService{
    @Autowired
    private DwAtuPlanTaskService dwAtuPlanTaskService;

    @Override
    public Integer deleteBatch(List<Object> ids) {
        return this.dwAtuPlanTaskService.deleteByPrimaryKeys(ids);
    }

    @Override
    public List<String> addBatch(List<DwAtuPlanTask> dwAtuPlanTaskList) {
        List<String> result = new ArrayList<>();
        for (DwAtuPlanTask dto : dwAtuPlanTaskList)
        {
            result.add(this.add(dto));
        }
        return result;
    }

    @Override
    public String add(DwAtuPlanTask dto) {
        String uuid = dto.getId();
        this.dwAtuPlanTaskService.insert(dto);
        return uuid;
    }
}
