|
@ -0,0 +1,97 @@
|
|
|
|
package com.yihu.jw.base.endpoint.role;
|
|
|
|
|
|
|
|
import com.yihu.jw.base.service.role.WlyyUserRoleService;
|
|
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
|
|
import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
|
import com.yihu.jw.rm.base.BaseRequestMapping;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by Bing on 2022/4/12.
|
|
|
|
* hz医养管理员角色管理
|
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
@RequestMapping(value = BaseRequestMapping.Role.wlyyUserRole)
|
|
|
|
@Api(value = "hz医养角色管理", description = "hz医养角色管理", tags = {"wlyy基础服务 - hz医养角色管理"})
|
|
|
|
public class WlyyUserRoleEndpoint extends EnvelopRestEndpoint {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private WlyyUserRoleService wlyyUserRoleService;
|
|
|
|
|
|
|
|
@GetMapping("getAdminList")
|
|
|
|
@ApiOperation("获取管理员列表")
|
|
|
|
public PageEnvelop getAdminList(@ApiParam(name = "name",value = "姓名")
|
|
|
|
@RequestParam(value = "name",required = false)String name,
|
|
|
|
@ApiParam(name = "idcard",value = "身份证")
|
|
|
|
@RequestParam(value = "idcard",required = false)String idcard,
|
|
|
|
@ApiParam(name = "mobile",value = "手机号")
|
|
|
|
@RequestParam(value = "mobile",required = false)String mobile,
|
|
|
|
@ApiParam(name = "page",value = "page")
|
|
|
|
@RequestParam(value = "page",required = false,defaultValue = "1")Integer page,
|
|
|
|
@ApiParam(name = "size",value = "手机号")
|
|
|
|
@RequestParam(value = "size",required = false,defaultValue = "15")Integer size){
|
|
|
|
try {
|
|
|
|
return wlyyUserRoleService.getAdminList(name,idcard,mobile,page,size);
|
|
|
|
}catch (Exception e){
|
|
|
|
return failedPageEnvelopException2(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("getRoleList")
|
|
|
|
@ApiOperation("获取权限列表")
|
|
|
|
public ObjEnvelop getAdminList(
|
|
|
|
@ApiParam(name = "level",value = "管理权限等级 1省2市(街道) 3区县4机构5团队(社区)6医生")
|
|
|
|
@RequestParam(value = "level",required = false,defaultValue = "2")String level){
|
|
|
|
try {
|
|
|
|
return ObjEnvelop.getSuccess("success",wlyyUserRoleService.getRoleList(level)) ;
|
|
|
|
}catch (Exception e){
|
|
|
|
return failedObjEnvelopException2(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("delUserRole")
|
|
|
|
@ApiOperation("删除角色权限")
|
|
|
|
public Envelop delUserRole(@ApiParam(name="id")@RequestParam(value = "id")String id){
|
|
|
|
try {
|
|
|
|
wlyyUserRoleService.delete(Long.valueOf(id));
|
|
|
|
return success();
|
|
|
|
}catch (Exception e){
|
|
|
|
return failedException2(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("modifyUserRole")
|
|
|
|
@ApiOperation("修改角色权限信息")
|
|
|
|
public Envelop modifyUserRole(@ApiParam(name="id")@RequestParam(value = "id")String id,
|
|
|
|
@ApiParam(name="role")@RequestParam(value = "role")String role){
|
|
|
|
try {
|
|
|
|
Integer result = wlyyUserRoleService.modifyUserRole(id,role);
|
|
|
|
if (-1==result){
|
|
|
|
return Envelop.getError("不存在该管理权限");
|
|
|
|
}if (-2==result){
|
|
|
|
return Envelop.getError("未查询此条管理权限,无法修改");
|
|
|
|
}
|
|
|
|
return success();
|
|
|
|
}catch (Exception e){
|
|
|
|
return failedException2(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("saveUserRole")
|
|
|
|
@ApiOperation("新增用户权限")
|
|
|
|
public Envelop saveUserRole(@ApiParam(name="json")@RequestParam(value = "json")String json){
|
|
|
|
try {
|
|
|
|
Integer result = wlyyUserRoleService.saveUserRole(json);
|
|
|
|
return success();
|
|
|
|
}catch (Exception e){
|
|
|
|
return failedException2(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|