package com.ruoyi.bst.model.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.bst.model.domain.ModelQuery;
import com.ruoyi.bst.model.domain.vo.ModelStatVO;
import com.ruoyi.bst.model.mapper.ModelMapper;
import com.ruoyi.bst.model.service.ModelDashboard;
import com.ruoyi.common.utils.MathUtils;
import com.ruoyi.dashboard.constants.StatKeys;

@Service
public class ModelDashboardImpl implements ModelDashboard {

    @Autowired
    private ModelMapper modelMapper;

    @Override
    public ModelStatVO selectStat(ModelQuery query, List<String> keys) {
        ModelStatVO vo = new ModelStatVO();
        if (keys.contains(StatKeys.MODEL_COUNT)) {
            vo.setCount(this.selectCount(query));
        }
        return vo;
    }

    @Override
    public Integer selectCount(ModelQuery query) {
        return MathUtils.dv(modelMapper.selectCount(query));
    }
    
}
