6bfc0996e1c6c745e80de882a3261cfc12b2111f.svn-base 1.36 KB
package com.thinkgem.jeesite.modules.reg.utils;

import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.utils.SpringContextHolder;
import com.thinkgem.jeesite.modules.sys.entity.User;
import com.thinkgem.jeesite.modules.sys.entity.config.SysUserConfig;
import com.thinkgem.jeesite.modules.sys.service.config.SysUserConfigService;
import com.thinkgem.jeesite.modules.sys.utils.UserUtils;

public class RegConifgUtils {
	
	private static SysUserConfigService sysUserConfigService = SpringContextHolder.getBean(SysUserConfigService.class);

	public static int getCUserPageSize() {
		
		User user = UserUtils.getUser();
		SysUserConfig sysUserConfig = new SysUserConfig();
		//sysUserConfig.setUserid(user.getId());
		//Page<SysUserConfig> page = new Page<SysUserConfig>(1, -1);
		//Page<SysUserConfig> findPage = sysUserConfigService.findPage(page, sysUserConfig);
		//List<SysUserConfig> findList = findPage.getList();
		sysUserConfig = sysUserConfigService.getByUserID(user.getId());
		//int counts = findList.size();
		if(sysUserConfig != null){
			int mypagesize = Integer.valueOf(sysUserConfig.getPagesize());
			if(mypagesize > 0){
				//sysUserConfig = findList.get(0);
				return mypagesize;
			}else{
				return Integer.valueOf(Global.getConfig("page.pageSize"));
			}
		}else{
			return Integer.valueOf(Global.getConfig("page.pageSize"));
		}
		
	}

}