com.macro.mall.common.api.CommonResult Java Examples

The following examples show how to use com.macro.mall.common.api.CommonResult. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DemoController.java    From mall-swarm with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "添加品牌")
@RequestMapping(value = "/brand/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult createBrand(@Validated @RequestBody PmsBrandDto pmsBrand, BindingResult result) {
    if (result.hasErrors()) {
        return CommonResult.validateFailed(result.getFieldError().getDefaultMessage());
    }
    CommonResult commonResult;
    int count = demoService.createBrand(pmsBrand);
    if (count == 1) {
        commonResult = CommonResult.success(pmsBrand);
        LOGGER.debug("createBrand success:{}", pmsBrand);
    } else {
        commonResult = CommonResult.failed("操作失败");
        LOGGER.debug("createBrand failed:{}", pmsBrand);
    }
    return commonResult;
}
 
Example #2
Source File: UmsAdminController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("修改指定用户信息")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody UmsAdmin admin) {
    int count = adminService.update(id, admin);
    if (count > 0) {
        return CommonResult.success(count);
    }
    return CommonResult.failed();
}
 
Example #3
Source File: OmsOrderController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #4
Source File: SmsFlashPromotionController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("获取活动详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public Object getItem(@PathVariable Long id) {
    SmsFlashPromotion flashPromotion = flashPromotionService.getItem(id);
    return CommonResult.success(flashPromotion);
}
 
Example #5
Source File: OssController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "oss上传成功回调")
@RequestMapping(value = "callback", method = RequestMethod.POST)
@ResponseBody
public CommonResult<OssCallbackResult> callback(HttpServletRequest request) {
    OssCallbackResult ossCallbackResult = ossService.callback(request);
    return CommonResult.success(ossCallbackResult);
}
 
Example #6
Source File: OmsOrderReturnApplyController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("修改申请状态")
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id, @RequestBody OmsUpdateStatusParam statusParam) {
    int count = returnApplyService.updateStatus(id, statusParam);
    if (count > 0) {
        return CommonResult.success(count);
    }
    return CommonResult.failed();
}
 
Example #7
Source File: SmsHomeRecommendSubjectController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("修改推荐排序")
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
    int count = recommendSubjectService.updateSort(id, sort);
    if (count > 0) {
        return CommonResult.success(count);
    }
    return CommonResult.failed();
}
 
Example #8
Source File: PmsProductCategoryController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("修改商品分类")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
                     @Validated
                     @RequestBody PmsProductCategoryParam productCategoryParam,
                     BindingResult result) {
    int count = productCategoryService.update(id, productCategoryParam);
    if (count > 0) {
        return CommonResult.success(count);
    } else {
        return CommonResult.failed();
    }
}
 
Example #9
Source File: GlobalExceptionHandler.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ResponseBody
@ExceptionHandler(value = ApiException.class)
public CommonResult handle(ApiException e) {
    if (e.getErrorCode() != null) {
        return CommonResult.failed(e.getErrorCode());
    }
    return CommonResult.failed(e.getMessage());
}
 
Example #10
Source File: SmsHomeRecommendProductController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation("批量删除推荐")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
    int count = recommendProductService.delete(ids);
    if (count > 0) {
        return CommonResult.success(count);
    }
    return CommonResult.failed();
}
 
Example #11
Source File: UmsPermissionController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #12
Source File: PmsProductController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("创建商品")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody PmsProductParam productParam, BindingResult bindingResult) {
    int count = productService.create(productParam);
    if (count > 0) {
        return CommonResult.success(count);
    } else {
        return CommonResult.failed();
    }
}
 
Example #13
Source File: PmsProductController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("根据商品id获取商品编辑信息")
@RequestMapping(value = "/updateInfo/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductResult> getUpdateInfo(@PathVariable Long id) {
    PmsProductResult productResult = productService.getUpdateInfo(id);
    return CommonResult.success(productResult);
}
 
Example #14
Source File: SmsFlashPromotionSessionController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("添加场次")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody SmsFlashPromotionSession promotionSession) {
    int count = flashPromotionSessionService.create(promotionSession);
    if (count > 0) {
        return CommonResult.success(count);
    }
    return CommonResult.failed();
}
 
Example #15
Source File: PmsProductAttributeCategoryController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("修改商品属性分类")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestParam String name) {
    int count = productAttributeCategoryService.update(id, name);
    if (count > 0) {
        return CommonResult.success(count);
    } else {
        return CommonResult.failed();
    }
}
 
Example #16
Source File: PmsProductAttributeCategoryController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("获取单个商品属性分类信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductAttributeCategory> getItem(@PathVariable Long id) {
    PmsProductAttributeCategory productAttributeCategory = productAttributeCategoryService.getItem(id);
    return CommonResult.success(productAttributeCategory);
}
 
Example #17
Source File: PmsProductController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("根据商品名称或货号模糊查询")
@RequestMapping(value = "/simpleList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProduct>> getList(String keyword) {
    List<PmsProduct> productList = productService.list(keyword);
    return CommonResult.success(productList);
}
 
Example #18
Source File: OmsOrderReturnReasonController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("批量删除退货原因")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
    int count = orderReturnReasonService.delete(ids);
    if (count > 0) {
        return CommonResult.success(count);
    }
    return CommonResult.failed();
}
 
Example #19
Source File: MemberReadHistoryController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("展示浏览记录")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<MemberReadHistory>> list(Long memberId) {
    List<MemberReadHistory> memberReadHistoryList = memberReadHistoryService.list(memberId);
    return CommonResult.success(memberReadHistoryList);
}
 
Example #20
Source File: RestTemplateDemoController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("getForEntity url")
@RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
@ResponseBody
public Object getForEntity(@PathVariable Long id) {
    String url = HOST_MALL_ADMIN + "/brand/{id}";
    ResponseEntity<CommonResult> responseEntity = restTemplate.getForEntity(url, CommonResult.class, id);
    return responseEntity.getBody();
}
 
Example #21
Source File: OmsPortalOrderController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("用户删除订单")
@RequestMapping(value = "/deleteOrder", method = RequestMethod.POST)
@ResponseBody
public CommonResult deleteOrder(Long orderId) {
    portalOrderService.deleteOrder(orderId);
    return CommonResult.success(null);
}
 
Example #22
Source File: UmsAdminController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("删除指定用户信息")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
    int count = adminService.delete(id);
    if (count > 0) {
        return CommonResult.success(count);
    }
    return CommonResult.failed();
}
 
Example #23
Source File: UmsRoleController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation("修改角色权限")
@RequestMapping(value = "/permission/update", method = RequestMethod.POST)
@ResponseBody
public CommonResult updatePermission(@RequestParam Long roleId,
                                     @RequestParam("permissionIds") List<Long> permissionIds) {
    int count = roleService.updatePermission(roleId, permissionIds);
    if (count > 0) {
        return CommonResult.success(count);
    }
    return CommonResult.failed();
}
 
Example #24
Source File: SmsHomeAdvertiseController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("获取广告详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsHomeAdvertise> getItem(@PathVariable Long id) {
    SmsHomeAdvertise advertise = advertiseService.getItem(id);
    return CommonResult.success(advertise);
}
 
Example #25
Source File: OmsPortalOrderController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("根据购物车信息生成订单")
@RequestMapping(value = "/generateOrder", method = RequestMethod.POST)
@ResponseBody
public CommonResult generateOrder(@RequestBody OrderParam orderParam) {
    Map<String, Object> result = portalOrderService.generateOrder(orderParam);
    return CommonResult.success(result, "下单成功");
}
 
Example #26
Source File: UmsResourceCategoryController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("修改后台资源分类")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
                           @RequestBody UmsResourceCategory umsResourceCategory) {
    int count = resourceCategoryService.update(id, umsResourceCategory);
    if (count > 0) {
        return CommonResult.success(count);
    } else {
        return CommonResult.failed();
    }
}
 
Example #27
Source File: PmsPortalProductController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("获取前台商品详情")
@RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsPortalProductDetail> detail(@PathVariable Long id) {
    PmsPortalProductDetail productDetail = portalProductService.detail(id);
    return CommonResult.success(productDetail);
}
 
Example #28
Source File: SmsFlashPromotionController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("删除活动信息")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public Object delete(@PathVariable Long id) {
    int count = flashPromotionService.delete(id);
    if (count > 0) {
        return CommonResult.success(count);
    }
    return CommonResult.failed();
}
 
Example #29
Source File: OmsOrderSettingController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation("获取指定订单设置")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<OmsOrderSetting> getItem(@PathVariable Long id) {
    OmsOrderSetting orderSetting = orderSettingService.getItem(id);
    return CommonResult.success(orderSetting);
}
 
Example #30
Source File: SmsFlashPromotionController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("根据活动名称分页查询")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public Object getItem(@RequestParam(value = "keyword", required = false) String keyword,
                      @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                      @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
    List<SmsFlashPromotion> flashPromotionList = flashPromotionService.list(keyword, pageSize, pageNum);
    return CommonResult.success(CommonPage.restPage(flashPromotionList));
}