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

import com.github.pagehelper.PageHelper;
import com.ruoyi.bst.store.domain.StoreQuery;
import com.ruoyi.bst.store.domain.vo.StoreStatVO;
import com.ruoyi.bst.store.mapper.StoreMapper;
import com.ruoyi.bst.store.service.StoreDashboard;
import com.ruoyi.common.domain.vo.LongIntegerVO;
import com.ruoyi.common.utils.MathUtils;
import com.ruoyi.dashboard.constants.StatKeys;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StoreDashboardImpl implements StoreDashboard {

    @Autowired
    private StoreMapper storeMapper;

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

    @Override
    public Integer selectCount(StoreQuery query) {
        return MathUtils.dv(storeMapper.selectCount(query));
    }
    
}
