RoleController.java 2.27 KB
package com.bsth.controller.sys;

import java.util.Iterator;
import java.util.Map;

import com.bsth.entity.sys.SysUser;
import com.bsth.security.util.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bsth.controller.BaseController;
import com.bsth.entity.sys.Role;
import com.bsth.service.sys.RoleService;

@RestController
@RequestMapping("role")
public class RoleController extends BaseController<Role, Integer>{
	
	
	@Autowired
	RoleService roleService;

	/**
	 * @param @param map
	 * @throws
	 * @Title: list
	 * @Description: TODO(查询下级)
	 */
	@RequestMapping(value = "/findSubordinate", method = RequestMethod.GET)
	public Map<String, Object> findSubordinate() {
		return roleService.findSubordinate();
	}

	/**
	 * @param @param map
	 * @Description: TODO(添加角色)
	 * @return
	 */
	@RequestMapping(value = "/add", method = RequestMethod.POST)
	public Map<String, Object> add(Role role){
		return roleService.add(role);
	}
	
	/**
	 * 
	 * @Title: settRoleModules 
	 * @Description: TODO(为角色设置模块,全量覆盖) 
	 * @param @param roleId 角色ID
	 * @param @param mIds  模块ID字符串(1,2,3,4)
	 * @throws
	 */
	@RequestMapping(value = "/settModules", method = RequestMethod.POST)
	public Map<String, Object> settRoleModules(@RequestParam Integer roleId,@RequestParam String mIds){
		return roleService.settRoleModules(roleId, mIds);
	}
	
	/**
	 * 
	 * @Title: roleInfo 
	 * @Description: TODO(角色信息) 
	 * @param @param id 角色ID
	 * @throws
	 */
	@RequestMapping(value = "/roleInfo")
	public Map<String, Object> roleInfo(@RequestParam Integer id){
		return roleService.roleInfo(id);
	}

	/**
	 * 检查操作合法性 操作的是否是下级角色
	 * @param operationRoleId 下级角色Id
	 * @return
	 */
	@RequestMapping(value = "/checkOperationLegality")
	public boolean checkOperationLegality(@RequestParam Integer operationRoleId){
		return roleService.checkOperationLegality(operationRoleId);
	}
}