package com.nantian.cloud.dbcapp.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nantian.cloud.dbcapp.entity.TEnterpriseQuota;
import com.nantian.cloud.dbcapp.mapper.record.TEnterpriseQuotaMapper;
import com.nantian.cloud.dbcapp.service.TEnterpriseQuotaService;
import org.springframework.stereotype.Service;

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

@Service("TEnterpriseQuotaService")
public class TEnterpriseQuotaImpl extends ServiceImpl<TEnterpriseQuotaMapper, TEnterpriseQuota> implements TEnterpriseQuotaService {
    @Override
    public Map<String, Object> getQuotaList(Page page, String enterpriseCode) {
        Map<String,Object> map = new HashMap<>();
        map.put("size",page.getSize());
        map.put("current",page.getCurrent());
        Page p=new Page();
        p.setCurrent((page.getCurrent()-1)*page.getSize());
        p.setSize(page.getSize());
        List<Map<String, Object>> list = baseMapper.getQuotaList(p,enterpriseCode);
        Integer total = baseMapper.getTotal(enterpriseCode);
        map.put("total",total);
        map.put("data",list);
        return map;
    }
}
