
package org.tio.sitexxx.service.service;

import org.tio.sitexxx.service.cache.CacheConfig;
import org.tio.sitexxx.service.cache.Caches;
import org.tio.sitexxx.service.model.main.UserBase;
import org.tio.utils.cache.CacheUtils;
import org.tio.utils.cache.ICache;

/**
 * 用户基础信息业务类
 * 
 *
 */
public class UserBaseService {
	public static final UserBaseService me = new UserBaseService();

	final UserBase userBaseDao = new UserBase().dao();

	/**
	 * 用户基础信息-缓存
	 * 包含但不仅限于：
	 * 1、用户进本信息
	 * 2、用实名信息
	 * 3、用户nick和头像
	 * @param uid
	 * @return
	 */
	public UserBase getUserBaseByUid(Integer uid) {
		ICache userbaseCache = Caches.getCache(CacheConfig.USERID_BASE);
		String key = uid + "";
		return CacheUtils.get(userbaseCache, key, () -> userBaseDao.findFirst("select * from user_base where uid = ?", uid));
	}
}
