📄 rolebiz.java
字号:
package com.accphr.biz.impl;
import java.io.Serializable;
import java.util.List;
import com.accphr.biz.IRoleBiz;
import com.accphr.dao.ICommonDao;
import com.accphr.entity.Role;
import com.accphr.page.PageResult;
public class RoleBiz implements IRoleBiz {
private ICommonDao commonDao=null;
public void setCommonDao(ICommonDao commonDao) {
this.commonDao = commonDao;
}
//添加
/* (non-Javadoc)
* @see com.accphr.biz.impl.IRoleBiz#add(com.accphr.entity.Role)
*/
public void add(com.accphr.entity.Role role) {
this.commonDao.add(role);
}
//删除用户
/* (non-Javadoc)
* @see com.accphr.biz.impl.IRoleBiz#del(java.io.Serializable)
*/
public void del(Serializable serializable) {
this.commonDao.del(Role.class, serializable);
}
//更新
/* (non-Javadoc)
* @see com.accphr.biz.impl.IRoleBiz#update(com.accphr.entity.Role)
*/
public void update(Role role) {
this.commonDao.update(role);
}
//分页查询
/* (non-Javadoc)
* @see com.accphr.biz.impl.IRoleBiz#setPageResult(com.accphr.entity.Role, com.accphr.page.PageResult)
*/
public void setPageResult(Role role,
PageResult pageResult){
String hql="from Role where 1=1";
if(role!=null){
}
pageResult.setHql(hql);
this.commonDao.pageList(pageResult);
}
//根据ID查询
/* (non-Javadoc)
* @see com.accphr.biz.impl.IRoleBiz#findById(java.io.Serializable)
*/
public Role findById(Integer serializable) {
return (Role)this.commonDao.findById(Role.class, serializable);
}
//根据字段查询
/* (non-Javadoc)
* @see com.accphr.biz.impl.IRoleBiz#findByPro(com.accphr.entity.Role)
*/
public List findByPro(Role role) {
String hql="from Role where 1=1";
if(role!=null){
if(role.getRoleName()!=null&&role.getRoleName().length()>0){
hql+=" and roleName='"+role.getRoleName()+"'";
}
}
List list=this.commonDao.findByHql(hql);
return list;
}
//查询所有权限
/* (non-Javadoc)
* @see com.accphr.biz.impl.IRoleBiz#findById(java.io.Serializable)
*/
public List findRights(Integer serializable) {
String hql="from Role r left join fetch r.rightses where r.roleId=?";
Role role=(Role)this.commonDao.findByHql(hql, new Object[]{serializable}).get(0);
List list=role.getRightses();
return list;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -