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

import java.util.List;

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

import com.ruoyi.bst.mchApply.domain.MchApplyQuery;
import com.ruoyi.bst.mchApply.domain.enums.MchApplyStatus;
import com.ruoyi.bst.mchApply.domain.vo.MchApplyStatVO;
import com.ruoyi.bst.mchApply.mapper.MchApplyMapper;
import com.ruoyi.bst.mchApply.service.MchApplyDashboard;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.dashboard.constants.StatKeys;

@Service
public class MchApplyDashboardImpl implements MchApplyDashboard {
    
    @Autowired
    private MchApplyMapper mchApplyMapper;

    @Override
    public MchApplyStatVO selectStat(MchApplyQuery query, List<String> keys) {
        MchApplyStatVO vo = new MchApplyStatVO();
        if (keys.contains(StatKeys.MCH_APPLY_APPROVING_COUNT)) {
            vo.setApprovingCount(this.selectApprovingCount(query));
        }
        return vo;
    }

    @Override
    public Integer selectApprovingCount(MchApplyQuery query) {
        MchApplyQuery approvingQuery = new MchApplyQuery();
        BeanUtils.copyProperties(query, approvingQuery);
        approvingQuery.setStatus(MchApplyStatus.APPROVING.getStatus());
        return mchApplyMapper.selectCount(approvingQuery);
    }

}
