类io.swagger.annotations.ApiOperation源码实例Demo

下面列出了怎么用io.swagger.annotations.ApiOperation的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: product-ei   文件: StockQuoteService.java
/**
 * Retrieve a stock for a given symbol.
 * http://localhost:9090/stockquote/IBM
 *
 * @param symbol Stock symbol will be taken from the path parameter.
 * @return Response
 */
@GET
@Path("/{symbol}")
@Produces({"application/json", "text/xml"})
@ApiOperation(
        value = "Return stock quote corresponding to the symbol",
        notes = "Returns HTTP 404 if the symbol is not found")
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "Valid stock item found"),
        @ApiResponse(code = 404, message = "Stock item not found")})
public Response getQuote(@ApiParam(value = "Symbol", required = true)
                         @PathParam("symbol") String symbol) throws SymbolNotFoundException {
    Stock stock = stockQuotes.get(symbol);
    if (stock == null) {
        throw new SymbolNotFoundException("Symbol " + symbol + " not found");
    }
    return Response.ok().entity(stock).cookie(new NewCookie("symbol", symbol)).build();
}
 
源代码2 项目: flowable-engine   文件: DeploymentResource.java
@ApiOperation(value = "Delete a deployment", tags = { "Deployment" })
@ApiResponses(value = {
        @ApiResponse(code = 204, message = "Indicates the deployment was found and has been deleted. Response-body is intentionally empty."),
        @ApiResponse(code = 404, message = "Indicates the requested deployment was not found.")
})
@DeleteMapping(value = "/repository/deployments/{deploymentId}", produces = "application/json")
public void deleteDeployment(@ApiParam(name = "deploymentId") @PathVariable String deploymentId, @RequestParam(value = "cascade", required = false, defaultValue = "false") Boolean cascade,
        HttpServletResponse response) {
    
    Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();

    if (deployment == null) {
        throw new FlowableObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", Deployment.class);
    }
    
    if (restApiInterceptor != null) {
        restApiInterceptor.deleteDeployment(deployment);
    }

    if (cascade) {
        repositoryService.deleteDeployment(deploymentId, true);
    } else {
        repositoryService.deleteDeployment(deploymentId);
    }
    response.setStatus(HttpStatus.NO_CONTENT.value());
}
 
源代码3 项目: paascloud-master   文件: OpcFileController.java
/**
 * 上传文件.
 *
 * @param request             the request
 * @param optUploadFileReqDto the opt upload file req dto
 *
 * @return the wrapper
 */
@PostMapping(consumes = "multipart/form-data", value = "/uploadFile")
@ApiOperation(httpMethod = "POST", value = "上传文件")
public Wrapper<String> uploadFile(HttpServletRequest request, OptUploadFileReqDto optUploadFileReqDto) {
	StringBuilder temp = new StringBuilder();
	logger.info("uploadFile - 上传文件. optUploadFileReqDto={}", optUploadFileReqDto);
	Preconditions.checkArgument(StringUtils.isNotEmpty(optUploadFileReqDto.getFileType()), "文件类型为空");
	Preconditions.checkArgument(StringUtils.isNotEmpty(optUploadFileReqDto.getBucketName()), "存储地址为空");

	MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
	List<OptUploadFileRespDto> optUploadFileRespDtos = optAttachmentService.uploadFile(multipartRequest, optUploadFileReqDto, getLoginAuthDto(), true);
	for (final OptUploadFileRespDto fileRespDto : optUploadFileRespDtos) {
		temp.append(fileRespDto.getAttachmentId()).append(",");
	}
	String attachmentIds = temp.toString();
	if (StringUtils.isNotEmpty(attachmentIds)) {
		attachmentIds = StringUtils.substringBeforeLast(attachmentIds, GlobalConstant.Symbol.COMMA);
	}
	return WrapMapper.ok(attachmentIds);
}
 
源代码4 项目: opencps-v2   文件: DossierFileManagement.java
@PUT
@Path("/{id}/files/{referenceUid}/formdata")
@Consumes({
	MediaType.APPLICATION_FORM_URLENCODED
})
@Produces({
	MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON
})
@ApiOperation(value = "update DossierFile")
@ApiResponses(value = {
	@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns"),
	@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
	@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
	@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class)
})
public Response updateDossierFileFormData(
	@Context HttpServletRequest request, @Context HttpHeaders header,
	@Context Company company, @Context Locale locale, @Context User user,
	@Context ServiceContext serviceContext,
	@ApiParam(value = "id of dossier", required = true) @PathParam("id") long id,
	@ApiParam(value = "referenceUid of dossierfile", required = true) @PathParam("referenceUid") String referenceUid,
	@ApiParam(value = "formdata of dossierfile", required = true) @FormParam("formdata") String formdata);
 
源代码5 项目: Web-API   文件: VShopServlet.java
@GET
@Path("/shop/{id}/item")
@Permission({"vshop", "item", "list"})
@ApiOperation(
        value = "List Shop Items",
        notes = "Return a list of all shops items")
public Collection<CachedStockItem> listShopItems(@PathParam("id") UUID id) {
    return WebAPI.runOnMain(() -> {
        Optional<NPCguard> npc = VillagerShops.getNPCfromShopUUID(id);
        if (!npc.isPresent()) {
            throw new NotFoundException("Shop with id " + id + " not found");
        }
        InvPrep inv = npc.get().getPreparator();
        int s = inv.size();

        List<CachedStockItem> csi = new ArrayList<>(s);
        for (int i = 0; i < s; i++)
            csi.add(new CachedStockItem(inv.getItem(i), i, npc.get().getIdentifier()));

        return csi;
    });
}
 
/**
 * 检测权限编码是否已存在
 *
 * @param uacActionCheckCodeDto the uac action check code dto
 *
 * @return the wrapper
 */
@PostMapping(value = "/checkActionCode")
@ApiOperation(httpMethod = "POST", value = "检测权限编码是否已存在")
public Wrapper<Boolean> checkActionCode(@ApiParam(name = "uacActionCheckCodeDto", value = "id与url") @RequestBody UacActionCheckCodeDto uacActionCheckCodeDto) {
	logger.info("校验权限编码唯一性 uacActionCheckCodeDto={}", uacActionCheckCodeDto);

	Long id = uacActionCheckCodeDto.getActionId();
	String actionCode = uacActionCheckCodeDto.getActionCode();

	Example example = new Example(UacAction.class);
	Example.Criteria criteria = example.createCriteria();

	if (id != null) {
		criteria.andNotEqualTo("id", id);
	}
	criteria.andEqualTo("actionCode", actionCode);

	int result = uacActionService.selectCountByExample(example);
	return WrapMapper.ok(result < 1);
}
 
源代码7 项目: hmdm-server   文件: FilesResource.java
@ApiOperation(
        value = "Get applications",
        notes = "Gets the list of applications using the file",
        response = Application.class,
        responseContainer = "List"
)
@GET
@Path("/apps/{url}")
@Produces(MediaType.APPLICATION_JSON)
public Response getApplicationsForFile(@PathParam("url") @ApiParam("An URL referencing the file") String url) {
    try {
        String decodedUrl = URLDecoder.decode(url, "UTF-8");
        return Response.OK(this.applicationDAO.getAllApplicationsByUrl(decodedUrl));
    } catch (Exception e) {
        logger.error("Unexpected error when getting the list of applications by URL", e);
        return Response.INTERNAL_ERROR();
    }
}
 
@ApiOperation(
        value = "Create or update plugin settings rule",
        notes = "Creates a new plugin settings rule record (if id is not provided) or updates existing one otherwise",
        authorizations = {@Authorization("Bearer Token")}
)
@PUT
@Path("/private/rule")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response saveSettingsRule(String ruleJSON) {
    try {
        ObjectMapper mapper = new ObjectMapper();
        DeviceLogRule rule = mapper.readValue(ruleJSON, this.settingsDAO.getSettingsRuleClass());

        this.settingsDAO.savePluginSettingsRule(rule);
        notifyRuleDevices(rule);

        return Response.OK();
    } catch (Exception e) {
        log.error("Failed to create or update device log plugin settings rule", e);
        return Response.INTERNAL_ERROR();
    }
}
 
源代码9 项目: icure-backend   文件: ClassificationFacade.java
@ApiOperation(
		value = "Create a classification with the current user",
		response = ClassificationDto.class,
		httpMethod = "POST",
		notes = "Returns an instance of created classification Template."
)
@POST
public Response createClassification(ClassificationDto c) {
	if (c == null) {
		return Response.status(400).type("text/plain").entity("A required query parameter was not specified for this request.").build();
	}

	Classification element = classificationLogic.createClassification(mapper.map(c, Classification.class));

	boolean succeed = (element != null);
	if (succeed) {
		return Response.ok().entity(mapper.map(element, ClassificationDto.class)).build();
	} else {
		return Response.status(500).type("text/plain").entity("Classification creation failed.").build();
	}
}
 
源代码10 项目: dependency-track   文件: UserResource.java
/**
 * @since 3.9.0
 */
@GET
@Path("oidc")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Returns a list of all OIDC users",
        response = OidcUser.class,
        responseContainer = "List",
        responseHeaders = @ResponseHeader(name = TOTAL_COUNT_HEADER, response = Long.class, description = "The total number of OIDC users")
)
@ApiResponses(value = {
        @ApiResponse(code = 401, message = "Unauthorized")
})
@PermissionRequired(Permissions.Constants.ACCESS_MANAGEMENT)
public Response getOidcUsers() {
    try (QueryManager qm = new QueryManager(getAlpineRequest())) {
        final long totalCount = qm.getCount(OidcUser.class);
        final List<OidcUser> users = qm.getOidcUsers();
        return Response.ok(users).header(TOTAL_COUNT_HEADER, totalCount).build();
    }
}
 
源代码11 项目: springboot-seed   文件: MyInfoAPI.java
@ApiOperation(value = "修改密码")
@PutMapping("/change_password")
public ResponseEntity<?> changePassword(
        @ApiParam("旧密码") @RequestParam("oldPassword") String oldPassword,
        @ApiParam("新密码") @RequestParam("newPassword") String newPassword
) {
    OAuth2Authentication auth = (OAuth2Authentication) SecurityContextHolder.getContext().getAuthentication();
    Optional<User> user = userService.selectByID(((SecurityUser) auth.getPrincipal()).getId());
    BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
    if (user.isPresent() && encoder.matches(oldPassword, user.get().getPassword())) {
        User instance = user.get();
        instance.setPassword(newPassword);
        userService.modifyById(instance);
        return ResponseEntity.status(HttpStatus.OK).build();
    } else {
        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
    }
}
 
源代码12 项目: smarthome   文件: ThingResource.java
@PUT
@RolesAllowed({ Role.USER, Role.ADMIN })
@Path("/{thingUID}/enable")
@ApiOperation(value = "Sets the thing enabled status.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = String.class),
        @ApiResponse(code = 404, message = "Thing not found.") })
public Response setEnabled(@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) String language,
        @PathParam("thingUID") @ApiParam(value = "thing") String thingUID,
        @ApiParam(value = "enabled") String enabled) throws IOException {
    final Locale locale = localeService.getLocale(language);

    ThingUID thingUIDObject = new ThingUID(thingUID);

    // Check if the Thing exists, 404 if not
    Thing thing = thingRegistry.get(thingUIDObject);
    if (null == thing) {
        logger.info("Received HTTP PUT request for set enabled at '{}' for the unknown thing '{}'.",
                uriInfo.getPath(), thingUID);
        return getThingNotFoundResponse(thingUID);
    }

    thingManager.setEnabled(thingUIDObject, Boolean.valueOf(enabled));

    // everything went well
    return getThingResponse(Status.OK, thing, locale, null);
}
 
@DELETE
@ApiOperation(value = "Delete a scope",
        notes = "User must have the DOMAIN_SCOPE[DELETE] permission on the specified domain " +
                "or DOMAIN_SCOPE[DELETE] permission on the specified environment " +
                "or DOMAIN_SCOPE[DELETE] permission on the specified organization")
@ApiResponses({
        @ApiResponse(code = 204, message = "Scope successfully deleted"),
        @ApiResponse(code = 500, message = "Internal server error")})
public void delete(
        @PathParam("organizationId") String organizationId,
        @PathParam("environmentId") String environmentId,
        @PathParam("domain") String domain,
        @PathParam("scope") String scope,
        @Suspended final AsyncResponse response) {
    final User authenticatedUser = getAuthenticatedUser();

    checkAnyPermission(organizationId, environmentId, domain, Permission.DOMAIN_SCOPE, Acl.DELETE)
            .andThen(scopeService.delete(scope, false, authenticatedUser))
            .subscribe(() -> response.resume(Response.noContent().build()), response::resume);
}
 
源代码14 项目: hmdm-server   文件: ConfigurationResource.java
@ApiOperation(
        value = "Copy configuration",
        notes = "Creates a new copy of configuration referenced by the id and names it with provided name."
)
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("/copy")
public Response copyConfiguration(Configuration configuration) {
    Configuration dbConfiguration = this.configurationDAO.getConfigurationByName(configuration.getName());
    if (dbConfiguration != null) {
        return Response.DUPLICATE_ENTITY("error.duplicate.configuration");
    } else {
        dbConfiguration = this.getConfiguration(configuration.getId());
        List<Application> configurationApplications = this.configurationDAO.getPlainConfigurationApplications(configuration.getId());
        Configuration copy = dbConfiguration.newCopy();
        copy.setName(configuration.getName());
        copy.setApplications(configurationApplications);
        copy.setBaseUrl(this.configurationDAO.getBaseUrl());
        this.configurationDAO.insertConfiguration(copy);
        return Response.OK();
    }
}
 
源代码15 项目: pulsar   文件: Namespaces.java
@POST
@Path("/{property}/{cluster}/{namespace}/clearBacklog")
@ApiOperation(hidden = true, value = "Clear backlog for all topics on a namespace.")
@ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission"),
        @ApiResponse(code = 404, message = "Namespace does not exist") })
public void clearNamespaceBacklog(@Suspended final AsyncResponse asyncResponse,
        @PathParam("property") String property, @PathParam("cluster") String cluster,
        @PathParam("namespace") String namespace,
        @QueryParam("authoritative") @DefaultValue("false") boolean authoritative) {
    try {
        validateNamespaceName(property, cluster, namespace);
        internalClearNamespaceBacklog(asyncResponse, authoritative);
    } catch (WebApplicationException wae) {
        asyncResponse.resume(wae);
    } catch (Exception e) {
        asyncResponse.resume(new RestException(e));
    }
}
 
@PUT
@ApiOperation("Update attributes of a task")
@Path("/tasks/{taskId}/attributes")
public Response updateTaskAttributes(@PathParam("taskId") String taskId,
                                     TaskAttributesUpdate request) {
    TaskAttributesUpdate sanitizedRequest;
    if (request.getTaskId().isEmpty()) {
        sanitizedRequest = request.toBuilder().setTaskId(taskId).build();
    } else {
        if (!taskId.equals(request.getTaskId())) {
            return Response.status(Response.Status.BAD_REQUEST).build();
        }
        sanitizedRequest = request;
    }
    return Responses.fromCompletable(jobServiceGateway.updateTaskAttributes(sanitizedRequest, resolveCallMetadata()));
}
 
@POST
@Path("/{name}")
@Timed
@RequiresAuthentication
@RequiresPermissions(ReportScheduleRestPermissions.AGGREGATE_REPORT_SCHEDULES_UPDATE)
@AuditEvent(type = AuditEventTypes.AGGREGATES_REPORT_SCHEDULE_UPDATE)
@ApiOperation(value = "Update a report schedule")
@ApiResponses(value = {
        @ApiResponse(code = 400, message = "The supplied request is not valid.")
})
public Response update(@ApiParam(name = "name", required = true)
					   @PathParam("name") String name,
                         @ApiParam(name = "JSON body", required = true) @Valid @NotNull UpdateReportScheduleRequest request
                         ) throws UnsupportedEncodingException {
    final ReportSchedule reportSchedule = reportScheduleService.fromRequest(request);

    reportScheduleService.update(java.net.URLDecoder.decode(name, "UTF-8"), reportSchedule);

    return Response.accepted().build();
}
 
源代码18 项目: konker-platform   文件: DeviceRestController.java
@PutMapping(path = "/{deviceGuid}/application")
@ApiOperation(value = "Move device to another application")
@PreAuthorize("hasAuthority('EDIT_DEVICE')")
public DeviceVO move(
        @PathVariable("application") String applicationId,
        @PathVariable("deviceGuid") String deviceGuid,
        @ApiParam(name = "body", required = true)
        @RequestBody ApplicationDestinationVO applicationDestinationVO)
        throws BadServiceResponseException, NotFoundResponseException {

    Tenant tenant = user.getTenant();
    Application application = getApplication(applicationId);
    Application destApplication = getApplication(applicationDestinationVO.getDestinationApplicationName());

    ServiceResponse<Device> deviceResponse = deviceRegisterService.move(tenant, application, deviceGuid, destApplication);

    if (!deviceResponse.isOk()) {
        throw new BadServiceResponseException( deviceResponse, validationsCode);
    }

    return new DeviceVO().apply(deviceResponse.getResult());

}
 
源代码19 项目: datacollector   文件: PipelineStoreResource.java
@Path("/pipeline/{pipelineId}/metadata")
@POST
@ApiOperation(value ="", hidden = true)
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@RolesAllowed({
    AuthzRole.CREATOR, AuthzRole.ADMIN, AuthzRole.CREATOR_REMOTE, AuthzRole.ADMIN_REMOTE
})
@SuppressWarnings("unchecked")
public Response saveMetadata(
    @PathParam("pipelineId") String name,
    @QueryParam("rev") @DefaultValue("0") String rev,
    Map<String, Object> metadata
) throws PipelineException {
  PipelineInfo pipelineInfo = store.getInfo(name);
  RestAPIUtils.injectPipelineInMDC(pipelineInfo.getTitle(), pipelineInfo.getPipelineId());
  store.saveMetadata(user, name, rev, metadata);
  return Response.ok().build();
}
 
源代码20 项目: hdw-dubbo   文件: ScheduleJobController.java
/**
 * 恢复定时任务信息
 */
@ApiOperation(value = "恢复定时任务信息", notes = "恢复定时任务信息")
@ApiImplicitParam(paramType = "query", name = "jobIds", value = "主键ID数组", dataType = "Integer", required = true, allowMultiple = true)
@PostMapping("/resume")
@RequiresPermissions("sys/schedule/resume")
public CommonResult resume(@RequestBody Long[] jobIds) {
    scheduleJobService.resume(jobIds);

    return CommonResult.success("");
}
 
源代码21 项目: HIS   文件: SmsEchartsController.java
@ApiOperation(value = "统计各科室每日接待患者人数(近7日)")
@RequestMapping(value = "/deptPatients", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsPatientsStatisticsResult> deptPatients(Long deptId) {
    SmsPatientsStatisticsResult smsPatientsStatisticsResult = smsEchartsService.deptPatients(deptId);
    return CommonResult.success(smsPatientsStatisticsResult);
}
 
源代码22 项目: pulsar   文件: Namespaces.java
@POST
@Path("/{property}/{cluster}/{namespace}/maxProducersPerTopic")
@ApiOperation(value = " Set maxProducersPerTopic configuration on a namespace.")
@ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission"),
        @ApiResponse(code = 404, message = "Namespace does not exist"),
        @ApiResponse(code = 409, message = "Concurrent modification"),
        @ApiResponse(code = 412, message = "maxProducersPerTopic value is not valid") })
public void setMaxProducersPerTopic(@PathParam("property") String property, @PathParam("cluster") String cluster,
        @PathParam("namespace") String namespace, int maxProducersPerTopic) {
    validateNamespaceName(property, cluster, namespace);
    internalSetMaxProducersPerTopic(maxProducersPerTopic);
}
 
源代码23 项目: fileServer   文件: RemoveController.java
@ApiOperation(value="删除文件", notes="删除文件")
@RequestMapping(value = "/file", method = RequestMethod.POST)
public boolean removeFile(
        @ApiParam(value = "文件服务器存放路径")
        @RequestParam("filePath") String filePath,
        @ApiParam(value = "删除标示,0:本文件,1:整个文件目录")
        @RequestParam("flag") int flag ) throws ServiceException {
    return removeService.removeFile(filePath,flag);
}
 
源代码24 项目: AthenaServing   文件: ServiceConfigController.java
/**
 * 批量推送配置
 *
 * @param body
 * @return
 */
@RequestMapping(value = "/batchPush", method = RequestMethod.POST)
@ApiOperation("批量推送")
public Response<PushServiceConfigResponseBody> batchPush(@RequestBody BatchPushServiceConfigRequestBody body) {
	List<String> configIds = body.getIds();
	if (null == configIds || configIds.isEmpty()) {
		return new Response<>(SystemErrCode.ERRCODE_INVALID_PARAMETER, SystemErrCode.ERRMSG_SERVICE_CONFIG_IDS_NOT_NULL);
	}
	List<String> ids = body.getRegionIds();
	if (null == ids || ids.isEmpty()) {
		return new Response<>(SystemErrCode.ERRCODE_INVALID_PARAMETER, SystemErrCode.ERRMSG_REGION_IDS_NOT_NULL);
	}
	return this.serviceConfigImpl.batchPush(body);
}
 
源代码25 项目: efo   文件: FileController.java
/**
 * 资源下载
 *
 * @param response {@link HttpServletResponse}
 */
@ApiOperation(value = "通过访问路径获取文件资源")
@AuthInterceptor(InterceptorLevel.NONE)
@RequestMapping(value = "/**", method = RequestMethod.GET)
public void getResource(HttpServletResponse response) throws IOException {
    ControllerUtils.loadResource(response, fileService.getResource(request.getServletPath(), request),
            ValueConsts.FALSE);
}
 
源代码26 项目: mall   文件: UmsPermissionController.java
@ApiOperation("添加权限")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsPermission permission) {
    int count = permissionService.create(permission);
    if(count>0){
        return CommonResult.success(count);
    }
    return CommonResult.failed();
}
 
源代码27 项目: open-cloud   文件: EmailTemplateController.java
/**
 * 批量删除数据
 *
 * @return
 */
@ApiOperation(value = "批量删除数据", notes = "批量删除数据")
@ApiImplicitParams({
        @ApiImplicitParam(name = "id", required = true, value = "id", paramType = "form")
})
@PostMapping("/batch/remove")
public ResultBody batchRemove(
        @RequestParam(value = "ids") String ids
) {
    targetService.removeByIds(Arrays.asList(ids.split(",")));
    return ResultBody.ok();
}
 
@ApiOperation("获取指定订单设置")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<OmsOrderSetting> getItem(@PathVariable Long id) {
    OmsOrderSetting orderSetting = orderSettingService.getItem(id);
    return CommonResult.success(orderSetting);
}
 
源代码29 项目: macrozheng   文件: OmsOrderController.java
@ApiOperation("批量删除订单")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
    int count = orderService.delete(ids);
    if (count > 0) {
        return CommonResult.success(count);
    }
    return CommonResult.failed();
}
 
源代码30 项目: pacbot   文件: UserRolesMappingController.java
/**
    * API to get all user roles mappings details
    * 
    * @author Nidhish
    * @param page - zero-based page index.
    * @param size - the size of the page to be returned.
    * @param searchTerm - searchTerm to be searched.
    * @return All UserRolesMapping Details
    */
@ApiOperation(httpMethod = "GET", value = "API to get all user roles mappings details", response = Response.class,  produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/list", method = RequestMethod.GET,  produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getAllUserRolesMapping(
	@ApiParam(value = "provide valid page number", required = true) @RequestParam("page") Integer page,
	@ApiParam(value = "provide valid page size", required = true) @RequestParam("size") Integer size,
	@ApiParam(value = "provide valid search term", required = false) @RequestParam(defaultValue="", name = "searchTerm", required = false) String searchTerm) {
	try {
		return ResponseUtils.buildSucessResponse(userRolesMappingService.getAllUserRolesMapping(searchTerm.trim(), page, size));
	} catch (Exception exception) {
		log.error(UNEXPECTED_ERROR_OCCURRED, exception);
		return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage());
	}
}