package io.renren.modules.minio.service.impl;

import io.renren.datasource.annotation.DataSource;
import io.renren.modules.minio.mapper.MinioAlgorithmMapper;
import io.renren.modules.minio.pojo.MinioAlgorithm;
import io.renren.modules.minio.service.MinioAlgorithmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description
 * @Author chenrj.xdu@gmail.com
 * @Version V1.0.0
 * @Since 1.0
 * @Date 2021/10/16
 */
@Service
@DataSource("slave2")
public class MinioAlgorithmServiceImpl implements MinioAlgorithmService {

    @Autowired
    MinioAlgorithmMapper minioAlgorithmMapper;

    @Override
    // int offset, int size
    public List<MinioAlgorithm> getMinioAlgorithmList() {
        //  int start = (offset - 1) * size;
        // start, size
        return minioAlgorithmMapper.getMinioAlgorithmList();
    }

    @Override
    public List<MinioAlgorithm> selectByName(String algName) {
        return minioAlgorithmMapper.selectByName(algName);
    }

    @Override
    public int getAlgorithmNum() {
        return minioAlgorithmMapper.getAlgorithmNum();
    }

    @Override
    public String findModelByName(String algorithmName) {
        int id = minioAlgorithmMapper.findModelByName(algorithmName);
        return "model" + id;
    }

    @Override
    public String findAppFileByName(String algorithmName) {
        return minioAlgorithmMapper.findAppFileByName(algorithmName);
    }

    @Override
    public String findImageFileByName(String algorithmName) {
        return minioAlgorithmMapper.findImageFileByName(algorithmName);
    }


    @Override
    public Long findBelongAlgId(String algorithmName) {
        return minioAlgorithmMapper.findBelongAlgId(algorithmName);
    }


}
