package com.pdaaphm.biz.service.impl;

import java.util.List;
import java.util.Map;

import com.pdaaphm.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pdaaphm.biz.mapper.AlgorithmMapper;
import com.pdaaphm.biz.domain.Algorithm;
import com.pdaaphm.biz.service.IAlgorithmService;

/**
 * 算法Service业务层处理
 *
 * @author xlk
 * @date 2023-07-26
 */
@Service
public class AlgorithmServiceImpl implements IAlgorithmService
{
    @Autowired
    private AlgorithmMapper algorithmMapper;

    /**
     * 查询算法
     *
     * @param id 算法主键
     * @return 算法
     */
    @Override
    public Algorithm selectAlgorithmById(Long id)
    {
        return algorithmMapper.selectAlgorithmById(id);
    }

    /**
     * 查询算法列表
     *
     * @param algorithm 算法
     * @return 算法
     */
    @Override
    public List<Algorithm> selectAlgorithmList(Algorithm algorithm)
    {
        return algorithmMapper.selectAlgorithmList(algorithm);
    }

    /**
     * 新增算法
     *
     * @param algorithm 算法
     * @return 结果
     */
    @Override
    public int insertAlgorithm(Algorithm algorithm)
    {
        algorithm.setCreateTime(DateUtils.getNowDate());
        return algorithmMapper.insertAlgorithm(algorithm);
    }

    /**
     * 修改算法
     *
     * @param algorithm 算法
     * @return 结果
     */
    @Override
    public int updateAlgorithm(Algorithm algorithm)
    {
        algorithm.setUpdateTime(DateUtils.getNowDate());
        return algorithmMapper.updateAlgorithm(algorithm);
    }

    /**
     * 批量删除算法
     *
     * @param ids 需要删除的算法主键
     * @return 结果
     */
    @Override
    public int deleteAlgorithmByIds(Long[] ids)
    {
        return algorithmMapper.deleteAlgorithmByIds(ids);
    }

    /**
     * 删除算法信息
     *
     * @param id 算法主键
     * @return 结果
     */
    @Override
    public int deleteAlgorithmById(Long id)
    {
        return algorithmMapper.deleteAlgorithmById(id);
    }

    @Override
    public List<Map> getOption() { return algorithmMapper.getOption(); }
}
