package com.usoftchina.bi.server.service.user;

import com.usoftchina.bi.core.utils.GetTokenDataUtil;
import com.usoftchina.bi.server.dao.user.RecordMapper;
import com.usoftchina.bi.core.base.RepCode;
import com.usoftchina.bi.core.base.RepEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class RecodeService {
    @Autowired
    RecordMapper recordMapper;

    public RepEntity getChartRecord(String token){
        Map<String, String> resultMap = GetTokenDataUtil.getTokenData(token);
        int userId = Integer.parseInt(resultMap.get("id"));
        return new RepEntity(RepCode.success, recordMapper.chartsRecode(userId));
    }

    public RepEntity getDashRecord(String token){
        Map<String, String> resultMap = GetTokenDataUtil.getTokenData(token);
        int userId = Integer.parseInt(resultMap.get("id"));
        return new RepEntity(RepCode.success, recordMapper.DashRecode(userId));
    }
}
