use of io.swagger.annotations.ApiImplicitParams in project CzechIdMng by bcvsolutions.
the class IdmTreeNodeController method findRoots.
@ResponseBody
@PreAuthorize("hasAuthority('" + CoreGroupPermission.TREENODE_AUTOCOMPLETE + "')")
@RequestMapping(value = "/search/roots", method = RequestMethod.GET)
@ApiOperation(value = "Search root tree nodes", nickname = "searchRootTreeNodes", tags = { IdmTreeNodeController.TAG }, notes = "Tree type parameter can be used. If no tree type ios given, then configured default tree type is used." + " If no default tree type is configured, then all roots are returnde")
@ApiImplicitParams({ @ApiImplicitParam(name = "page", dataType = "string", paramType = "query", value = "Results page you want to retrieve (0..N)"), @ApiImplicitParam(name = "size", dataType = "string", paramType = "query", value = "Number of records per page."), @ApiImplicitParam(name = "sort", allowMultiple = true, dataType = "string", paramType = "query", value = "Sorting criteria in the format: property(,asc|desc). " + "Default sort order is ascending. " + "Multiple sort criteria are supported.") })
public Resources<?> findRoots(@ApiParam(value = "Tree type uuid identifier.", required = false) @RequestParam(value = "treeTypeId", required = false) String treeTypeId, @RequestParam(required = false) MultiValueMap<String, Object> parameters, @PageableDefault Pageable pageable) {
UUID treeTypeIdentifier = null;
if (StringUtils.isNotEmpty(treeTypeId)) {
treeTypeIdentifier = DtoUtils.toUuid(treeTypeId);
} else {
IdmTreeTypeDto defaultType = treeConfiguration.getDefaultType();
if (defaultType != null) {
treeTypeIdentifier = defaultType.getId();
}
}
IdmTreeNodeFilter filter = toFilter(parameters);
filter.setRoots(Boolean.TRUE);
if (treeTypeIdentifier != null) {
filter.setTreeTypeId(treeTypeIdentifier);
}
//
Page<IdmTreeNodeDto> roots = find(filter, pageable, IdmBasePermission.AUTOCOMPLETE);
return toResources(roots, IdmTreeNode.class);
}
use of io.swagger.annotations.ApiImplicitParams in project spring-boot-starter-samples by vindell.
the class DemoController method list.
@ApiOperation(value = "获取xxx列表", notes = "分页查询xxx信息")
@ApiImplicitParams({ @ApiImplicitParam(name = "pageNo", value = "当前页码", required = true, dataType = "Integer"), @ApiImplicitParam(name = "limit", value = "每页记录数", required = true, dataType = "Integer"), @ApiImplicitParam(name = "sortName", value = "排序字段名称", required = true, dataType = "String"), @ApiImplicitParam(name = "sortOrder", value = "排序类型 asc \\ desc", required = true, dataType = "String"), @ApiImplicitParam(name = "demoVo", value = "用户详细实体user", required = true, dataType = "UserVo") })
@ApiResponses({ @ApiResponse(code = HttpStatus.SC_OK, message = "操作成功"), @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = "请求要求身份验证"), @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = "请求资源不存在"), @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = "服务器内部异常"), @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = "权限不足") })
@BusinessLog(module = LogConstant.Module.N01, business = LogConstant.BUSINESS.N010001, opt = BusinessType.SELECT)
@PostMapping(value = "list")
@ResponseBody
public Object list(Integer pageNo, Integer limit, String sortName, String sortOrder, DemoVo demoVo, HttpServletRequest request) throws Exception {
try {
Page<DemoModel> pageResult = getDemoService().getPagedList(null);
List<DemoVo> retList = new ArrayList<DemoVo>();
for (DemoModel model : pageResult.getRecords()) {
retList.add(getBeanMapper().map(model, DemoVo.class));
}
return new Result<DemoVo>(pageResult, retList);
} catch (Exception e) {
logException(this, e);
return error("");
}
}
use of io.swagger.annotations.ApiImplicitParams in project spring-boot-starter-samples by vindell.
the class AuthzLoginController method switchRole.
@ApiOperation(value = "switchRole", notes = "切换角色")
@ApiImplicitParams({ @ApiImplicitParam(name = "roleid", value = "角色ID", dataType = "String") })
// @BusinessLog(module = Constants.Module.LOGIN, business = "切换角色", opt = BusinessType.LOGIN)
@RequestMapping(value = "switchRole", method = { RequestMethod.POST, RequestMethod.GET })
public String switchRole(String roleid) {
try {
AuthzLoginModel principal = SubjectUtils.getPrincipal(AuthzLoginModel.class);
Session session = SubjectUtils.getSession();
if (StringUtils.isNotBlank(roleid) && (!StringUtils.equals(roleid, principal.getRoleid()))) {
/*// 切换当前的角色信息
getUser().setJsdm(jsdm);
// 刷新shiro缓存
AccountRealm shiroRealm = ServiceFactory.getService(DefaultAccountRealm.class);
shiroRealm.clearAuthorizationCache();*/
// 刷新shiro缓存
// 删除用户数据范围标识
session.removeAttribute("");
}
} catch (Exception e) {
logException(this, e);
}
return "redirect:/index";
}
use of io.swagger.annotations.ApiImplicitParams in project spring-boot-starter-samples by vindell.
the class UserController method putUser.
@ApiOperation(value = "更新用户详细信息", notes = "根据url的id来指定更新对象,并根据传过来的user信息来更新用户详细信息")
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "用户ID", required = true, dataType = "Long"), @ApiImplicitParam(name = "user", value = "用户详细实体user", required = true, dataType = "UserDto") })
@RequestMapping(value = "put/{id}", method = RequestMethod.PUT)
public String putUser(@PathVariable Long id, @RequestBody UserDto user) {
UserDto u = users.get(id);
u.setName(user.getName());
u.setAge(user.getAge());
users.put(id, u);
return "success";
}
Aggregations