下面列出了怎么用io.swagger.annotations.ApiImplicitParam的API类实例代码及写法,或者点击链接到github查看源代码。
@ApiImplicitParams( {@ApiImplicitParam(dataType = "String", name = "Authorization", paramType = "header")})
@ApiOperation(value = "Update a catalog Product", notes = "Updates a catalog event", tags = {"Catalog"})
@PutMapping(value = "/product", consumes=Versions.V1_0, produces=Versions.V1_0)
public ResponseEntity<Product> updateProduct(@ApiParam(value = "product", required = true) @RequestBody Product product) {
if (product.getCatalogId() == null) {
throw new IllegalArgumentException("A catalog id is required to update a product.");
}
if (DEFAULT_CATALOG.equals(product.getCatalogId())) {
throw new IllegalArgumentException("The default catalog cannot be modified at run time.");
}
ProductModel model = productConverter.convert(product);
model = productService.saveProduct(model);
return new ResponseEntity<>(productModelConverter.convert(model), HttpStatus.OK);
}
/**
* 绑定某个用户和APP
*
* @param userId 用户ID
* @param appId 应用ID
* @return 是否成功
*/
@ApiOperation(
value = "绑定某个用户和APP",
notes = "绑定某个用户和APP"
)
@ApiImplicitParams({
@ApiImplicitParam(paramType = "header", dataType = "string", name = "Authorization", value = "用户凭证", required = true),
@ApiImplicitParam(name = "userId", value = "用户ID", required = true),
@ApiImplicitParam(name = "appId", value = "appId,应用ID(int型)", required = true),
})
@PutMapping("/{userId}/{appId}/bind")
@OperationRecord(type = OperationRecordLog.OperationType.CREATE, resource = OperationRecordLog.OperationResource.USER_APP_REL, description = OperationRecordLog.OperationDescription.CREATE_USER_APP_REL)
public ServiceResult bind(@PathVariable String userId, @PathVariable int appId) {
if (StringUtils.isEmpty(userId) || appId < 1) {
return ServiceResultConstants.NEED_PARAMS;
}
return adminService.bindUserAndApp(userId, appId);
}
/**
* 角色分页查询
*
* @param pageNum pageNum
* @param pageSize pageSize
* @param sort sort
* @param order order
* @param role role
* @return PageInfo
* @author tangyi
* @date 2018/10/24 22:13
*/
@GetMapping("roleList")
@ApiOperation(value = "获取角色列表")
@ApiImplicitParams({
@ApiImplicitParam(name = CommonConstant.PAGE_NUM, value = "分页页码", defaultValue = CommonConstant.PAGE_NUM_DEFAULT, dataType = "String"),
@ApiImplicitParam(name = CommonConstant.PAGE_SIZE, value = "分页大小", defaultValue = CommonConstant.PAGE_SIZE_DEFAULT, dataType = "String"),
@ApiImplicitParam(name = CommonConstant.SORT, value = "排序字段", defaultValue = CommonConstant.PAGE_SORT_DEFAULT, dataType = "String"),
@ApiImplicitParam(name = CommonConstant.ORDER, value = "排序方向", defaultValue = CommonConstant.PAGE_ORDER_DEFAULT, dataType = "String"),
@ApiImplicitParam(name = "role", value = "角色信息", dataType = "RoleVo")
})
public PageInfo<Role> roleList(@RequestParam(value = CommonConstant.PAGE_NUM, required = false, defaultValue = CommonConstant.PAGE_NUM_DEFAULT) String pageNum,
@RequestParam(value = CommonConstant.PAGE_SIZE, required = false, defaultValue = CommonConstant.PAGE_SIZE_DEFAULT) String pageSize,
@RequestParam(value = CommonConstant.SORT, required = false, defaultValue = CommonConstant.PAGE_SORT_DEFAULT) String sort,
@RequestParam(value = CommonConstant.ORDER, required = false, defaultValue = CommonConstant.PAGE_ORDER_DEFAULT) String order,
Role role) {
role.setTenantCode(SysUtil.getTenantCode());
return roleService.findPage(PageUtil.pageInfo(pageNum, pageSize, sort, order), role);
}
/**
* 删除订单
*/
@DeleteMapping("/{orderNumber}")
@ApiOperation(value = "根据订单号删除订单", notes = "根据订单号删除订单")
@ApiImplicitParam(name = "orderNumber", value = "订单号", required = true, dataType = "String")
public ResponseEntity<String> delete(@PathVariable("orderNumber") String orderNumber) {
String userId = SecurityUtils.getUser().getUserId();
Order order = orderService.getOrderByOrderNumber(orderNumber);
if (order == null) {
throw new YamiShopBindException("该订单不存在");
}
if (!Objects.equals(order.getUserId(), userId)) {
throw new YamiShopBindException("你没有权限获取该订单信息");
}
if (!Objects.equals(order.getStatus(), OrderStatus.SUCCESS.value()) || !Objects.equals(order.getStatus(), OrderStatus.CLOSE.value()) ) {
throw new YamiShopBindException("订单未完成或未关闭,无法删除订单");
}
// 删除订单
orderService.deleteOrders(Arrays.asList(order));
return ResponseEntity.ok("删除成功");
}
@ApiOperation(
value = "查询自定义接口",
notes = "根据应用ID、接口KEY、版本、平台获取自定义接口信息"
)
@ApiImplicitParams({
@ApiImplicitParam(name = "tenantAppId", value = "应用appId", dataType = "string", defaultValue = "uc28ec7f8870a6e785", required = true),
@ApiImplicitParam(name = "key", value = "自定义接口的key", required = true),
@ApiImplicitParam(name = "platform", value = "平台,值应为 ios 或 android", required = true),
@ApiImplicitParam(name = "version", value = "版本号", required = true),
})
@GetMapping("/{tenantAppId}/{key}/{version}/{platform}")
public ServiceResult custom(@PathVariable String tenantAppId,
@PathVariable String key,
@PathVariable String platform,
@PathVariable String version) {
logger.info("version: " + version);
if (StringUtilsExt.hasBlank(tenantAppId, key, platform, version)) {
return ServiceResultConstants.NEED_PARAMS;
}
if (!platform.equalsIgnoreCase("ios") && !platform.equalsIgnoreCase("android")) {
return ServiceResultConstants.PLATFORM_ERROR;
}
return customApiService.getCustomContent(tenantAppId, key, platform, version);
}
@ApiOperation("根据Token获取用户的信息与通知消息数量")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "发送给用户的唯一令牌",dataType = "String"),
})
@GetMapping("/message/{token}")
public QuarkResult getUserAndMessageByToken(@PathVariable String token){
QuarkResult result = restProcessor(() -> {
HashMap<String, Object> map = new HashMap<>();
User user = userService.getUserByToken(token);
if (user == null) return QuarkResult.warn("session过期,请重新登录");
long count = notificationService.getNotificationCount(user.getId());
map.put("user",user);
map.put("messagecount",count);
return QuarkResult.ok(map);
});
return result;
}
@GET
@Path("/checks/{" + PARAM_COMPONENT_NAME + "}")
@ApiOperation(value = "Perform the component's health check")
@ApiImplicitParams({
@ApiImplicitParam(
name = PARAM_COMPONENT_NAME,
required = true,
paramType = "path",
dataType = "String",
defaultValue = "None",
example = "/checks/Cassandra%20Backend",
value = "The URL encoded name of the component to check.")
})
public Object performHealthCheckForComponent(Request request, Response response) {
String componentName = request.params(PARAM_COMPONENT_NAME);
HealthCheck healthCheck = healthChecks.stream()
.filter(c -> c.componentName().getName().equals(componentName))
.findFirst()
.orElseThrow(() -> throw404(componentName));
Result result = Mono.from(healthCheck.check()).block();
logFailedCheck(result);
response.status(getCorrespondingStatusCode(result.getStatus()));
return new HealthCheckExecutionResultDto(result);
}
/**
* 列出所有应用(带绑定信息)
*
* @return 应用列表
*/
@ApiOperation(
value = "列出用户与所有应用的绑定关系(带绑定信息)",
notes = "列出所有应用(带绑定信息)"
)
@ApiImplicitParams({
@ApiImplicitParam(paramType = "header", dataType = "string", name = "Authorization", value = "用户凭证", required = true),
@ApiImplicitParam(name = "page", value = "页数", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "每页显示数据条数", defaultValue = "10"),
@ApiImplicitParam(name = "userId", value = "用户ID", required = true),
})
@GetMapping("/app/list/bind")
public ServiceResult listAppWithBindInfo(@RequestParam(required = false, defaultValue = "1") int page,
@RequestParam(required = false, defaultValue = "10") int pageSize,
@RequestParam String userId) {
EntityWrapper<App> wrapper = new EntityWrapper<>();
if (StringUtils.isEmpty(userId)) {
return ServiceResultConstants.NEED_PARAMS;
}
wrapper.and().eq("del_flag", 0);
return adminService.listAppWithBindInfo(page, pageSize, wrapper, userId);
}
/**
* 分配应用权限
*
* @param appId 应用Id
* @param expireTime 授权过期时间
* @param authorityIds 权限ID.多个以,隔开
* @return
*/
@ApiOperation(value = "分配应用权限", notes = "分配应用权限")
@ApiImplicitParams({
@ApiImplicitParam(name = "appId", value = "应用Id", defaultValue = "", required = true, paramType = "form"),
@ApiImplicitParam(name = "expireTime", value = "过期时间.选填", defaultValue = "", required = false, paramType = "form"),
@ApiImplicitParam(name = "authorityIds", value = "权限ID.多个以,隔开.选填", defaultValue = "", required = false, paramType = "form")
})
@PostMapping("/authority/app/grant")
public ResultBody grantAuthorityApp(
@RequestParam(value = "appId") String appId,
@RequestParam(value = "expireTime", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date expireTime,
@RequestParam(value = "authorityIds", required = false) String authorityIds
) {
baseAuthorityService.addAuthorityApp(appId, expireTime, StringUtils.isNotBlank(authorityIds) ? authorityIds.split(",") : new String[]{});
openRestTemplate.refreshGateway();
return ResultBody.ok();
}
@HEAD
@Path("/{username}")
@ApiOperation(value = "Testing an user existence")
@ApiImplicitParams({
@ApiImplicitParam(required = true, dataType = "string", name = "username", paramType = "path")
})
@ApiResponses(value = {
@ApiResponse(code = HttpStatus.OK_200, message = "OK. User exists."),
@ApiResponse(code = HttpStatus.BAD_REQUEST_400, message = "Invalid input user."),
@ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "User does not exist."),
@ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500,
message = "Internal server error - Something went bad on the server side.")
})
public void defineUserExist() {
service.head(USERS + SEPARATOR + USER_NAME, this::userExist);
}
/**
* 上传文件
*
* @param
* @return
* @author zuihou
* @date 2019-05-06 16:28
*/
@ApiOperation(value = "附件上传", notes = "附件上传")
@ApiImplicitParams({
@ApiImplicitParam(name = "appCode", value = "应用编码", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "id", value = "文件id", dataType = "long", paramType = "query"),
@ApiImplicitParam(name = "bizId", value = "业务id", dataType = "long", paramType = "query"),
@ApiImplicitParam(name = "bizType", value = "业务类型", dataType = "long", paramType = "query"),
@ApiImplicitParam(name = "file", value = "附件", dataType = "MultipartFile", allowMultiple = true, required = true),
})
@PostMapping(value = "/upload")
public R<AttachmentDTO> upload(
@RequestParam(value = "file") MultipartFile file,
@RequestParam(value = "isSingle", required = false, defaultValue = "false") Boolean isSingle,
@RequestParam(value = "id", required = false) Long id,
@RequestParam(value = "bizId", required = false) String bizId,
@RequestParam(value = "bizType", required = false) String bizType) throws Exception {
return attachmentApi.upload(file, isSingle, id, bizId, bizType);
}
@ApiOperation(
value = "添加自定义接口",
notes = "添加自定义接口"
)
@ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "用户登录凭证", paramType = "header", dataType = "string", defaultValue = "Bearer ", required = true),
})
@PostMapping("/add")
@OperationRecord(type = OperationRecordLog.OperationType.CREATE, resource = OperationRecordLog.OperationResource.CUSTOM_API, description = OperationRecordLog.OperationDescription.CREATE_CUSTOM_API)
public ServiceResult addCustomApi(@Valid @RequestBody CustomApiRequestDTO customApiRequestDTO) {
if (StringUtils.isBlank(customApiRequestDTO.getCustomKey())) {
return ServiceResultConstants.NEED_PARAMS;
}
//校验版本区间
ServiceResult serviceResult = basicService.checkVersion(customApiRequestDTO);
if (serviceResult.getCode() != 200) {
return serviceResult;
}
CustomApi customApi = new CustomApi();
BeanUtils.copyProperties(customApiRequestDTO, customApi);
customApi.setId(null);
customApi.setDelFlag(null);
return customApiService.createCustomApi(customApi);
}
@ApiOperation("更新用户")
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
@PutMapping("/update")
public AjaxResult update(UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return AjaxResult.error("用户ID不能为空");
}
if (users.isEmpty() || !users.containsKey(user.getUserId()))
{
return AjaxResult.error("用户不存在");
}
users.remove(user.getUserId());
return AjaxResult.success(users.put(user.getUserId(), user));
}
@ApiImplicitParams( {@ApiImplicitParam(dataType = "String", name = "Authorization", paramType = "header")})
@ApiOperation(value = "Update a catalog Event", notes = "Updates a catalog event", tags = {"Catalog"})
@PutMapping(value = "/event", consumes=Versions.V1_0, produces=Versions.V1_0)
public ResponseEntity<Event> updateEvent(@ApiParam(value = "event", required = true) @RequestBody Event event) {
if (event.getCatalogId() == null) {
throw new IllegalArgumentException("A catalog id is required to update an event.");
}
if (DEFAULT_CATALOG.equals(event.getCatalogId())) {
throw new IllegalArgumentException("The default catalog cannot be modified at run time.");
}
EventModel model;
synchronized(this) {
model = eventConverter.convert(event);
model = eventService.saveEvent(model);
}
return new ResponseEntity<>(eventModelConverter.convert(model), HttpStatus.OK);
}
@RequestMapping(path = "/editPrivilegeGroup",method= RequestMethod.POST)
@ApiOperation(value="编辑权限组", notes="test: 返回 200 表示服务受理成功,其他表示失败")
@ApiImplicitParam(paramType="query", name = "privilegeGroupInfo", value = "权限信息", required = true, dataType = "String")
public ResponseEntity<String> editPrivilegeGroup(@RequestBody String privilegeGroupInfo,HttpServletRequest request){
ResponseEntity<String> responseEntity = null;
try {
responseEntity = privilegeSMOImpl.editPrivilegeGroup(privilegeGroupInfo);
}catch (Exception e){
logger.error("请求订单异常",e);
responseEntity = new ResponseEntity<String>("请求中心服务发生异常,"+e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}finally {
logger.debug("订单服务返回报文为: {}",responseEntity);
return responseEntity;
}
}
/**
* deploy locally not through sign
*/
@ApiOperation(value = "contract deploy locally", notes = "contract deploy")
@ApiImplicitParam(name = "reqDeploy", value = "contract info", required = true,
dataType = "ReqDeploy")
@PostMapping("/deploy")
public String deployLocal(@Valid @RequestBody ReqDeploy reqDeploy, BindingResult result)
throws Exception {
log.info("contract deployLocal start. ReqDeploy:[{}]", JsonUtils.toJSONString(reqDeploy));
checkParamResult(result);
if (StringUtils.isBlank(reqDeploy.getUser())) {
log.error("contract deployLocal error: user(address) is empty");
throw new FrontException(ConstantCode.PARAM_FAIL_USER_IS_EMPTY);
}
String contractAddress = contractService.caseDeploy(reqDeploy, true);
log.info("success deployLocal. result:{}", contractAddress);
return contractAddress;
}
/**
* 查询某一个域的详细信息
* 如果http请求的参数domain_id为空,则返回null
*/
@RequestMapping(value = "/details", method = RequestMethod.GET)
@ApiOperation(value = "查询域的详细信息", notes = "查询某一个指定域的详细定义信息,如果请求的参数为空,则返回用户自己所在域的详细信息")
@ApiImplicitParams({
@ApiImplicitParam(required = true, name = "domain_id", value = "域编码")
})
public String getDomainDetails(HttpServletRequest request) {
String domainId = request.getParameter("domain_id");
if (domainId == null || domainId.isEmpty()) {
logger.info("domain id is empty, return null");
return null;
}
// 检查用户对域有没有读权限
Boolean status = authService.domainAuth(request, domainId, "r").getStatus();
if (status) {
return Hret.error(403, "您没有被授权访问域【" + domainId + "】", null);
}
DomainEntity domainEntity = domainService.getDomainDetails(domainId);
return new GsonBuilder().create().toJson(domainEntity);
}
/**
* 角色信息
*/
@ApiOperation(value = "角色信息", notes = "角色信息")
@ApiImplicitParam(paramType = "path", name = "roleId", value = "主键ID", dataType = "Integer", required = true)
@GetMapping("/info/{roleId}")
@RequiresPermissions("sys/role/info")
public CommonResult<SysRole> info(@PathVariable("roleId") Long roleId) {
SysRole role = sysRoleService.getById(roleId);
//查询角色对应的菜单
List<Long> resourceIdList = sysRoleResourceService.selectResourceIdListByRoleId(roleId);
role.setResourceIdList(resourceIdList);
List<SysRoleResource> roleResourceList = sysRoleResourceService.selectResourceNodeListByRoleId(roleId);
List<TreeNode> treeNodeList = Lists.newArrayList();
if (!roleResourceList.isEmpty()) {
roleResourceList.forEach(roleResource -> {
TreeNode treeNode = new TreeNode();
treeNode.setId(roleResource.getResourceId().toString());
treeNode.setLabel(roleResource.getResource().getName());
treeNodeList.add(treeNode);
});
}
role.setResourceNodeList(treeNodeList);
return CommonResult.success(role);
}
@PUT
@Path("/{destinationDomain}/aliases/{sourceDomain}")
@ApiOperation(value = "Add an alias for a specific domain")
@ApiImplicitParams({
@ApiImplicitParam(required = true, dataType = "string", name = "sourceDomain", paramType = "path"),
@ApiImplicitParam(required = true, dataType = "string", name = "destinationDomain", paramType = "path")
})
@ApiResponses(value = {
@ApiResponse(code = HttpStatus.NO_CONTENT_204, message = "OK", response = List.class),
@ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "The domain does not exist."),
@ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500,
message = "Internal server error - Something went bad on the server side.")
})
public void defineAddAlias(Service service) {
service.put(SPECIFIC_ALIAS, this::addDomainAlias, jsonTransformer);
}
@ApiOperation(value = "testingFormApiImplicitParam")
@RequestMapping(
value = "/testingFormApiImplicitParam",
method = RequestMethod.GET,
produces = "application/json")
@ApiImplicitParams(value = {
@ApiImplicitParam(
name = "form-test-name",
value = "form-test-value",
allowMultiple = true,
required = true,
dataType = "string",
paramType = "form",
defaultValue = "form-test-defaultValue")
})
public String testingFormApiImplicitParam() {
return "testing";
}
@ApiOperation(value = "获取用户喜欢书单", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "header", name = "userId", value = "用户ID", required = true, dataType = "int"),
@ApiImplicitParam(paramType = "query", name = "page", value = "页数", required = true, dataType = "int"),
@ApiImplicitParam(paramType = "query", name = "limit", value = "每页数量", required = true, dataType = "int")
})
@GetMapping("/get-books")
public Result getUserLikeBookList(@RequestHeader("userId") Integer userId, Integer page, Integer limit) {
return this.userLikeSeeService.getUserLikeBookList(userId, page, limit);
}
@ApiOperation(value = "Set the editor source for a model", tags = { "Models" }, consumes = "multipart/form-data",
notes = "Response body contains the model’s raw editor source. The response’s content-type is set to application/octet-stream, regardless of the content of the source.")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", dataType = "file", paramType = "form", required = true)
})
@ApiResponses(value = {
@ApiResponse(code = 204, message = "Indicates the model was found and the source has been updated."),
@ApiResponse(code = 404, message = "Indicates the requested model was not found.")
})
@PutMapping(value = "/repository/models/{modelId}/source", consumes = "multipart/form-data")
public void setModelSource(@ApiParam(name = "modelId") @PathVariable String modelId, HttpServletRequest request, HttpServletResponse response) {
Model model = getModelFromRequest(modelId);
if (!(request instanceof MultipartHttpServletRequest)) {
throw new FlowableIllegalArgumentException("Multipart request is required");
}
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
if (multipartRequest.getFileMap().size() == 0) {
throw new FlowableIllegalArgumentException("Multipart request with file content is required");
}
MultipartFile file = multipartRequest.getFileMap().values().iterator().next();
try {
repositoryService.addModelEditorSource(model.getId(), file.getBytes());
response.setStatus(HttpStatus.NO_CONTENT.value());
} catch (Exception e) {
throw new FlowableException("Error adding model editor source extra", e);
}
}
@ApiOperation("删除用户")
@ApiImplicitParam(name = "Tests", value = "单个用户信息", dataType = "Test")
@DeleteMapping("delete")
public AjaxResult delete(Test test)
{
return testList.remove(test) ? success() : error();
}
@ApiOperation(value = "This API returns stack overflow posts related to the version parameters")
@ApiImplicitParams({
@ApiImplicitParam(name = "coordV1", value = "maven cooridnate of lib v1 (groupId:artifactId:version)", required = true, dataType = "string", paramType = "path"),
@ApiImplicitParam(name = "coordV2", value = "maven cooridnate of lib v2 (groupId:artifactId:version)", required = false, dataType = "string", paramType = "path") })
@RequestMapping(value = "/sorec/{coordV1}/{coordV2:.+}", produces = { "application/json",
"application/xml" }, method = RequestMethod.GET)
public @ResponseBody Recommendation getDocumentation(@PathVariable("coordV1") String coordV1,
@PathVariable("coordV2") String coordV2) {
return soRecommender.getVersionsSORecommendations(coordV1, coordV2);
}
@Log(description = "登录")
@ApiOperation(value = "用户登录", notes = "用户登录")
@ApiImplicitParams({
@ApiImplicitParam(name = "username", value = "用户名", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "password", value = "密码", required = true, dataType = "String", paramType = "query"),
})
@PostMapping("/login")
public Result login(@RequestParam("username") String username, @RequestParam("password") String password) {
try {
Subject currentUser = ShiroUtils.getSubject();
UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password);
currentUser.login(usernamePasswordToken);
User user = (User) ShiroUtils.getSessionAttribute(Constants.SESSION_USER);
userService.updateLastLoginInfo();
Map<String, Object> resultMap = new HashMap();
resultMap.put(Constants.SESSION_USER, user);
return Result.success(resultMap);
} catch (Exception e) {
if (e instanceof UnknownAccountException || e instanceof IncorrectCredentialsException) {
return Result.error(MsgConstants.USERNAME_OR_PASSWORD_ERROR);
}
LOGGER.error(e.getCause().getMessage(), e);
return Result.error(e.getCause().getMessage());
}
}
/**
* 根据用户id 查询用户
* @return
*/
@ApiOperation(value="根据id获取用户信息")
@ApiImplicitParam(paramType= "path", name = "id", value = "用户id", required = true, dataType = "Long",example="123")
@GetMapping("/{id}")
@ApiResponses({ @ApiResponse(code = 400, message = "请求无效 (Bad request)") })
public User get(@PathVariable(name = "id") Long id){
User user = new User();
user.setName("lijunkui");
user.setAge(18);
log.info("springboot查询用户成功:"+"id:{}",id);
return user;
}
/**
* 更新
*
* @param course course
* @return ResponseBean
* @author tangyi
* @date 2018/11/10 21:31
*/
@PutMapping
@AdminTenantTeacherAuthorization
@ApiOperation(value = "更新课程信息", notes = "根据课程id更新课程的基本信息")
@ApiImplicitParam(name = "course", value = "课程实体course", required = true, dataType = "Course")
@Log("更新课程")
public ResponseBean<Boolean> updateCourse(@RequestBody @Valid Course course) {
course.setCommonValue(SysUtil.getUser(), SysUtil.getSysCode(), SysUtil.getTenantCode());
return new ResponseBean<>(courseService.update(course) > 0);
}
private Parameter readImplicitParam(Swagger swagger, ApiImplicitParam param) {
PrimitiveType fromType = PrimitiveType.fromName(param.paramType());
final Parameter p = null == fromType ? new FormParameter() : new QueryParameter();
final Type type = ReflectionUtils.typeFromString(param.dataType());
return ParameterProcessor.applyAnnotations(swagger, p, type == null ? String.class : type,
Collections.<Annotation> singletonList(param));
}
/**
* 更新
*
* @param knowledge knowledge
* @return ResponseBean
* @author tangyi
* @date 2019/1/1 15:15
*/
@PutMapping
@ApiOperation(value = "更新知识信息", notes = "根据知识id更新知识的基本信息")
@ApiImplicitParam(name = "knowledge", value = "知识实体knowledge", required = true, dataType = "Knowledge")
@Log("更新知识")
public ResponseBean<Boolean> updateKnowledge(@RequestBody @Valid Knowledge knowledge) {
knowledge.setCommonValue(SysUtil.getUser(), SysUtil.getSysCode(), SysUtil.getTenantCode());
return new ResponseBean<>(knowledgeService.update(knowledge) > 0);
}
/**
* 定时任务信息
*/
@ApiOperation(value = "定时任务日志信息", notes = "定时任务日志信息")
@ApiImplicitParam(paramType = "path", name = "jobId", value = "主键ID", dataType = "Integer", required = true)
@GetMapping("/info/{jobId}")
@RequiresPermissions("sys/schedule/info")
public CommonResult<ScheduleJobEntity> info(@PathVariable("jobId") Long jobId) {
ScheduleJobEntity schedule = scheduleJobService.getById(jobId);
return CommonResult.success(schedule);
}