⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 roledaoimpl.java

📁 利用STRUTS2+SPRING+HIBERNATE/IBATIS建立的基本开发框架
💻 JAVA
字号:
/**
 * 
 */
package com.sunwah.baseapp.system.dao;

import java.util.List;
import java.util.Set;

import com.sunwah.baseapp.dao.GenericDaoImpl;
import com.sunwah.baseapp.system.model.RoleFunction;
import com.sunwah.baseapp.system.model.Roles;

/**
 * @author MARK
 * 
 */
public class RoleDaoImpl extends GenericDaoImpl<Roles, Long> implements RoleDao {

	public RoleDaoImpl() {
		super(Roles.class);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.sunwah.baseapp.system.dao.RoleDao#findRoleByRoleName(java.lang.String
	 * )
	 */
	@Override
	public Roles findRoleByRoleName(String roleName) {
		List<Roles> roles = super.findByProperty("roleName", roleName);
		return roles.size() > 0 ? roles.get(0) : null;
	}

	@Override
	public Roles get(Long id) {
		Roles role = super.get(id);
		if (role != null) {
			if (role.getRoleFunctions() != null) {
				getHibernateTemplate().initialize(role.getRoleFunctions());
				Set set = role.getRoleFunctions();
				for (Object object : set) {
					RoleFunction roleFunction = (RoleFunction) object;
					getHibernateTemplate().initialize(
							roleFunction.getFunctions());
				}
			}
		}
		return role;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -