Pre Merge pull request !19 from yangzhengze/test

This commit is contained in:
yangzhengze 2018-07-29 21:51:14 +08:00
commit 15c90a6c69
5 changed files with 40 additions and 14 deletions

View File

@ -20,6 +20,9 @@ public class UserConstants
/** 角色封禁状态 */ /** 角色封禁状态 */
public static final String ROLE_BLOCKED = "1"; public static final String ROLE_BLOCKED = "1";
/** 角色正常状态 */
public static final String ROLE_NORMAL = "0";
/** 部门正常状态 */ /** 部门正常状态 */
public static final String DEPT_NORMAL = "0"; public static final String DEPT_NORMAL = "0";

View File

@ -1,8 +1,9 @@
package com.ruoyi.project.system.role.service; package com.ruoyi.project.system.role.service;
import com.ruoyi.project.system.role.domain.Role;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import com.ruoyi.project.system.role.domain.Role;
/** /**
* 角色业务层 * 角色业务层
@ -43,6 +44,13 @@ public interface IRoleService
*/ */
public List<Role> selectRoleAll(); public List<Role> selectRoleAll();
/**
* 查询所有正常角色
*
* @return 正常角色列表
*/
public List<Role> selectNORMALRoleAll();
/** /**
* 通过角色ID查询角色 * 通过角色ID查询角色
* *

View File

@ -104,6 +104,23 @@ public class RoleServiceImpl implements IRoleService
return roleMapper.selectRolesAll(); return roleMapper.selectRolesAll();
} }
/**
* 查询所有正常角色
*
* @return 正常角色列表
*/
@Override
public List<Role> selectNORMALRoleAll()
{
List<Role> roles=roleMapper.selectRolesAll();
List<Role> nomalRoles=new ArrayList<Role>();
for(Role role:roles){
if(UserConstants.ROLE_NORMAL.equals(role.getStatus())){
nomalRoles.add(role);
}
}
return nomalRoles;
}
/** /**
* 通过角色ID查询角色 * 通过角色ID查询角色
* *

View File

@ -1,16 +1,5 @@
package com.ruoyi.project.system.user.controller; package com.ruoyi.project.system.user.controller;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.annotation.Log;
@ -22,6 +11,14 @@ import com.ruoyi.project.system.post.service.IPostService;
import com.ruoyi.project.system.role.service.IRoleService; import com.ruoyi.project.system.role.service.IRoleService;
import com.ruoyi.project.system.user.domain.User; import com.ruoyi.project.system.user.domain.User;
import com.ruoyi.project.system.user.service.IUserService; import com.ruoyi.project.system.user.service.IUserService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* 用户信息 * 用户信息
@ -83,7 +80,7 @@ public class UserController extends BaseController
@GetMapping("/add") @GetMapping("/add")
public String add(ModelMap mmap) public String add(ModelMap mmap)
{ {
mmap.put("roles", roleService.selectRoleAll()); mmap.put("roles", roleService.selectNORMALRoleAll());
mmap.put("posts", postService.selectPostAll()); mmap.put("posts", postService.selectPostAll());
return prefix + "/add"; return prefix + "/add";
} }

View File

@ -31,7 +31,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from sys_menu m from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id left join sys_user_role ur on rm.role_id = ur.role_id
where ur.user_id = #{userId} and m.menu_type in ('M', 'C') and m.visible = 0 left join sys_role sr on ur.role_id=sr.role_id
where ur.user_id = #{userId} and sr.status=0 and m.menu_type in ('M', 'C') and m.visible = 0
order by m.order_num order by m.order_num
</select> </select>