
package cn.orionsec.ops.service.impl;

import cn.orionsec.ops.dao.ApplicationPipelineTaskLogDAO;
import cn.orionsec.ops.entity.domain.ApplicationPipelineTaskLogDO;
import cn.orionsec.ops.entity.vo.app.ApplicationPipelineTaskLogVO;
import cn.orionsec.ops.service.api.ApplicationPipelineTaskLogService;
import cn.orionsec.ops.utils.DataQuery;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("applicationPipelineTaskLogService")
public class ApplicationPipelineTaskLogServiceImpl implements ApplicationPipelineTaskLogService {

    @Resource
    private ApplicationPipelineTaskLogDAO applicationPipelineTaskLogDAO;

    @Override
    public List<ApplicationPipelineTaskLogVO> getLogList(Long taskId) {
        LambdaQueryWrapper<ApplicationPipelineTaskLogDO> wrapper = new LambdaQueryWrapper<ApplicationPipelineTaskLogDO>()
                .eq(ApplicationPipelineTaskLogDO::getTaskId, taskId);
        return DataQuery.of(applicationPipelineTaskLogDAO)
                .wrapper(wrapper)
                .list(ApplicationPipelineTaskLogVO.class);
    }

    @Override
    public Integer deleteByTaskIdList(List<Long> taskIdList) {
        Wrapper<ApplicationPipelineTaskLogDO> wrapper = new LambdaQueryWrapper<ApplicationPipelineTaskLogDO>()
                .in(ApplicationPipelineTaskLogDO::getTaskId, taskIdList);
        return applicationPipelineTaskLogDAO.delete(wrapper);
    }

}
