package com.docus.server.service.impl;

import com.docus.infrastructure.web.request.SearchRequest;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.convert.SchCollectRecordRetryLogConvert;
import com.docus.server.dto.scheduling.management.SchCollectRecordRetryLogDTO;
import com.docus.server.entity.scheduling.management.SchCollectRecordRetryLog;
import com.docus.server.infrastructure.dao.ISchCollectRecordRetryLogDao;
import com.docus.server.service.ISchCollectRecordRetryLogService;
import com.docus.server.vo.scheduling.management.SchCollectRecordRetryLogVO;
import org.springframework.stereotype.Service;

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

/**
 * 采集记录表重试表 服务实现类
 *
 * @author AutoGenerator
 * @since 2023-07-14
 */
@Service
public class SchCollectRecordRetryLogServiceImpl implements ISchCollectRecordRetryLogService {
    @Resource
    private ISchCollectRecordRetryLogDao iSchCollectRecordRetryLogDao;

    /**
     * 按主键查询
     *
     * @param id 主键Id
     * @return 实体
     */
    @Override
    public SchCollectRecordRetryLogVO findById(String id) {
        return SchCollectRecordRetryLogConvert.INSTANCE.convertVO(iSchCollectRecordRetryLogDao.findById(id));
    }

    /**
     * 关键字搜素
     *
     * @param searchRequest 搜索参数
     * @return 分页列表
     */
    @Override
    public PageResult<SchCollectRecordRetryLogVO> search(SearchRequest searchRequest) {
        return SchCollectRecordRetryLogConvert.INSTANCE.convertVO(iSchCollectRecordRetryLogDao.search(searchRequest));
    }

    /**
     * 新增
     *
     * @param schCollectRecordRetryLogDTO 编辑参数
     * @return 成功或失败
     */
    @Override
    public boolean add(SchCollectRecordRetryLogDTO schCollectRecordRetryLogDTO) {
        SchCollectRecordRetryLog schCollectRecordRetryLog = SchCollectRecordRetryLogConvert.INSTANCE.convertDO(schCollectRecordRetryLogDTO);
        return iSchCollectRecordRetryLogDao.add(schCollectRecordRetryLog);
    }

    /**
     * 编辑
     *
     * @param schCollectRecordRetryLogDTO 编辑参数
     * @return 成功或失败
     */
    @Override
    public boolean edit(SchCollectRecordRetryLogDTO schCollectRecordRetryLogDTO) {
        SchCollectRecordRetryLog schCollectRecordRetryLog = SchCollectRecordRetryLogConvert.INSTANCE.convertDO(schCollectRecordRetryLogDTO);
        return iSchCollectRecordRetryLogDao.edit(schCollectRecordRetryLog);
    }

    /**
     * 批量删除
     *
     * @param ids 主键ids
     * @return 成功或失败
     */
    @Override
    public int delete(List<String> ids) {
        return iSchCollectRecordRetryLogDao.delete(ids);
    }
}

