You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
3.1 KiB
113 lines
3.1 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\adminapi\controller\campus_person_role;
|
|
|
|
use core\base\BaseAdminController;
|
|
use app\service\admin\campus_person_role\CampusPersonRoleService;
|
|
|
|
|
|
/**
|
|
* 角色关系控制器
|
|
* Class CampusPersonRole
|
|
* @package app\adminapi\controller\campus_person_role
|
|
*/
|
|
class CampusPersonRole extends BaseAdminController
|
|
{
|
|
/**
|
|
* 获取角色关系列表
|
|
* @return \think\Response
|
|
*/
|
|
public function lists(){
|
|
$data = $this->request->params([
|
|
["campus_id",""],
|
|
["person_name",""],
|
|
["role_id",""],
|
|
["dept_id",""]
|
|
]);
|
|
return success((new CampusPersonRoleService())->getPage($data));
|
|
}
|
|
|
|
/**
|
|
* 角色关系详情
|
|
* @param int $id
|
|
* @return \think\Response
|
|
*/
|
|
public function info(int $id){
|
|
return success((new CampusPersonRoleService())->getInfo($id));
|
|
}
|
|
|
|
/**
|
|
* 添加角色关系
|
|
* @return \think\Response
|
|
*/
|
|
public function add(){
|
|
$data = $this->request->params([
|
|
["campus_id",0],
|
|
["person_id",0],
|
|
["role_id",0],
|
|
["dept_id",0],
|
|
|
|
]);
|
|
$this->validate($data, 'app\validate\campus_person_role\CampusPersonRole.add');
|
|
return (new CampusPersonRoleService())->add($data);
|
|
}
|
|
|
|
/**
|
|
* 角色关系编辑
|
|
* @param $id 角色关系id
|
|
* @return \think\Response
|
|
*/
|
|
public function edit(int $id){
|
|
$data = $this->request->params([
|
|
["campus_id",0],
|
|
["person_id",0],
|
|
["role_id",0],
|
|
["dept_id",0],
|
|
["tasks",'']
|
|
|
|
]);
|
|
$this->validate($data, 'app\validate\campus_person_role\CampusPersonRole.edit');
|
|
return (new CampusPersonRoleService())->edit($id, $data);
|
|
}
|
|
|
|
/**
|
|
* 角色关系删除
|
|
* @param $id 角色关系id
|
|
* @return \think\Response
|
|
*/
|
|
public function del(int $id){
|
|
(new CampusPersonRoleService())->del($id);
|
|
return success('DELETE_SUCCESS');
|
|
}
|
|
|
|
|
|
public function getCampusAll(){
|
|
return success(( new CampusPersonRoleService())->getCampusAll());
|
|
}
|
|
|
|
public function getPersonnelAll(){
|
|
return success(( new CampusPersonRoleService())->getPersonnelAll());
|
|
}
|
|
|
|
public function getSysRoleAll(){
|
|
$data = $this->request->params([
|
|
["dept_id",0]
|
|
]);
|
|
|
|
return success(( new CampusPersonRoleService())->getSysRoleAll($data));
|
|
}
|
|
|
|
public function getDepartmentsAll(){
|
|
return success(( new CampusPersonRoleService())->getDepartmentsAll());
|
|
}
|
|
|
|
}
|
|
|