diff --git a/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java b/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java index f58b9e6e2..71af808d5 100644 --- a/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java @@ -48,8 +48,8 @@ public class GoodsManagerController { @ApiOperation(value = "分页获取") @GetMapping(value = "/list") - public IPage getByPage(GoodsSearchParams goodsSearchParams) { - return goodsService.queryByParams(goodsSearchParams); + public ResultMessage> getByPage(GoodsSearchParams goodsSearchParams) { + return ResultUtil.data(goodsService.queryByParams(goodsSearchParams)); } @ApiOperation(value = "分页获取商品列表") @@ -60,10 +60,9 @@ public ResultMessage> getSkuByPage(GoodsSearchParams goodsSearch @ApiOperation(value = "分页获取待审核商品") @GetMapping(value = "/auth/list") - public IPage getAuthPage(GoodsSearchParams goodsSearchParams) { - + public ResultMessage> getAuthPage(GoodsSearchParams goodsSearchParams) { goodsSearchParams.setAuthFlag(GoodsAuthEnum.TOBEAUDITED.name()); - return goodsService.queryByParams(goodsSearchParams); + return ResultUtil.data(goodsService.queryByParams(goodsSearchParams)); } @PreventDuplicateSubmissions @@ -104,7 +103,7 @@ public ResultMessage auth(@PathVariable List goodsIds, @RequestP @ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, allowMultiple = true) }) public ResultMessage unpGoods(@PathVariable List goodsId) { - if (goodsService.updateGoodsMarketAble(goodsId, GoodsStatusEnum.UPPER, "")) { + if (Boolean.TRUE.equals(goodsService.updateGoodsMarketAble(goodsId, GoodsStatusEnum.UPPER, ""))) { return ResultUtil.success(); } throw new ServiceException(ResultCode.GOODS_UPPER_ERROR); diff --git a/manager-api/src/main/java/cn/lili/controller/goods/SpecificationManagerController.java b/manager-api/src/main/java/cn/lili/controller/goods/SpecificationManagerController.java index cb6735463..ac97fd6b1 100644 --- a/manager-api/src/main/java/cn/lili/controller/goods/SpecificationManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/goods/SpecificationManagerController.java @@ -1,13 +1,13 @@ package cn.lili.controller.goods; +import cn.hutool.core.text.CharSequenceUtil; import cn.lili.common.enums.ResultUtil; -import cn.lili.mybatis.util.PageUtil; -import cn.lili.common.utils.StringUtils; import cn.lili.common.vo.PageVO; import cn.lili.common.vo.ResultMessage; import cn.lili.modules.goods.entity.dos.Specification; import cn.lili.modules.goods.service.SpecificationService; +import cn.lili.mybatis.util.PageUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; @@ -37,17 +37,16 @@ public class SpecificationManagerController { @GetMapping("/all") @ApiOperation(value = "获取所有可用规格") - public List getAll() { - List list = specificationService.list(); - return list; + public ResultMessage> getAll() { + return ResultUtil.data(specificationService.list()); } @GetMapping @ApiOperation(value = "搜索规格") - public Page page(String specName, PageVO page) { + public ResultMessage> page(String specName, PageVO page) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.like(StringUtils.isNotEmpty(specName), Specification::getSpecName, specName); - return specificationService.page(PageUtil.initPage(page), lambdaQueryWrapper); + lambdaQueryWrapper.like(CharSequenceUtil.isNotEmpty(specName), Specification::getSpecName, specName); + return ResultUtil.data(specificationService.page(PageUtil.initPage(page), lambdaQueryWrapper)); } @PostMapping @@ -61,15 +60,13 @@ public ResultMessage save(@Valid Specification specification) { @ApiOperation(value = "更改规格") public ResultMessage update(@Valid Specification specification, @PathVariable String id) { specification.setId(id); - specificationService.saveOrUpdate(specification); - return ResultUtil.success(); + return ResultUtil.data(specificationService.saveOrUpdate(specification)); } @DeleteMapping("/{ids}") @ApiImplicitParam(name = "ids", value = "规格ID", required = true, dataType = "String", allowMultiple = true, paramType = "path") @ApiOperation(value = "批量删除") public ResultMessage delAllByIds(@PathVariable List ids) { - specificationService.deleteSpecification(ids); - return ResultUtil.success(); + return ResultUtil.data(specificationService.deleteSpecification(ids)); } }