| | |
| | | } |
| | | String hql = "delete RoleRight where roleId = ? and rightType=?"; |
| | | |
| | | impl.createQuery(hql, new Object[] { roleId.trim(), rightType }); |
| | | impl.createQuery(hql, new Object[] { roleId.trim(), (short)rightType }); |
| | | return true; |
| | | } |
| | | }); |
| | |
| | | // 注释根据rightType删除角色权限,避免管理员角色和普通用户角色相互影响 |
| | | String hql = "delete RoleRight where rightType = ? and roleId = ? "; |
| | | Object[] values = new Object[2]; |
| | | values[0] = rightType; |
| | | values[0] = (short)rightType; |
| | | values[1] = roleId; |
| | | impl.createQuery(hql, values); |
| | | |
| | |
| | | private void prepareCreateBOPsmt(PreparedStatement pst, RoleRight roleRight) throws SQLException { |
| | | pst.setString(1, roleRight.getRoleId()); |
| | | pst.setString(2, roleRight.getFuncId()); |
| | | pst.setLong(3, roleRight.getRightType()); |
| | | pst.setShort(3, roleRight.getRightType()); |
| | | pst.setLong(4, roleRight.getRightValue()); |
| | | pst.setString(5, roleRight.getCreateUser()); |
| | | pst.setTimestamp(6, new Timestamp(roleRight.getCreateTime().getTime())); |
| | |
| | | /** 获取所选角色已有的模块授权 **/ |
| | | String hql = "from RoleRight where rightType = ? and roleId = ? "; |
| | | Object[] values = new Object[2]; |
| | | values[0] = rightType; |
| | | values[0] = (short)rightType; |
| | | values[1] = roleId; |
| | | List<RoleRight> myRoleRights = impl.findEntites(hql, values); |
| | | List<String> funcIds = new ArrayList<String>(); |
| | |
| | | return (List<RoleRight>) new HibernateTemplate().run(new HibernateCallback() { |
| | | public Object execute() throws HibernateException { |
| | | RoleRightDaoImpl impl = new RoleRightDaoImpl(); |
| | | String hql = "from RoleRight where rightType = ? and roleId = ? "; |
| | | String hql = ""; |
| | | if (rightType == 0) { |
| | | hql = "from RoleRight where roleId = ? "; |
| | | Object[] values = new Object[1]; |
| | | values[0] = roleId; |
| | | return impl.findEntites(hql, values); |
| | | } else { |
| | | hql = "from RoleRight where rightType = ? and roleId = ? "; |
| | | Object[] values = new Object[2]; |
| | | values[0] = rightType; |
| | | values[0] = (short)rightType; |
| | | values[1] = roleId; |
| | | return impl.findEntites(hql, values); |
| | | } |