package com.goafanti.app.service;

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

import com.goafanti.app.enums.MyAppCountCategory;
import com.goafanti.common.dao.MyAppMapper;
import com.goafanti.core.shiro.token.TokenManager;

@Service
public class MyAppService {
	@Autowired
	MyAppMapper myAppMapper;

	public ModelMap countByCate(String cate) {
		ModelMap res = null;
		switch (MyAppCountCategory.getStatus(cate)) {
		case COLLECTIONS:
			res = myAppMapper.countCollections(TokenManager.getUserId());
			break;
		case MYDEMAND:
			res = myAppMapper.countMyDemand(TokenManager.getUserId());
			break;
//		case MYEXPERT:
//			res = myAppMapper.countMyExpert(TokenManager.getUserId());
//			break;
		case MYTECH:
			res = myAppMapper.countMyTech(TokenManager.getUserId());
			break;
		case ORDERS:
			res = myAppMapper.countOrders(TokenManager.getUserId());
			break;
		default:
			res = new ModelMap();
			break;
		}
		return res;
	}
}
