fix: 优化统一接口返回值
This commit is contained in:
		
							parent
							
								
									88db57c64b
								
							
						
					
					
						commit
						12476fc173
					
				@ -48,8 +48,8 @@ public class GoodsManagerController {
 | 
			
		||||
 | 
			
		||||
    @ApiOperation(value = "分页获取")
 | 
			
		||||
    @GetMapping(value = "/list")
 | 
			
		||||
    public IPage<Goods> getByPage(GoodsSearchParams goodsSearchParams) {
 | 
			
		||||
        return goodsService.queryByParams(goodsSearchParams);
 | 
			
		||||
    public ResultMessage<IPage<Goods>> getByPage(GoodsSearchParams goodsSearchParams) {
 | 
			
		||||
        return ResultUtil.data(goodsService.queryByParams(goodsSearchParams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @ApiOperation(value = "分页获取商品列表")
 | 
			
		||||
@ -60,10 +60,9 @@ public class GoodsManagerController {
 | 
			
		||||
 | 
			
		||||
    @ApiOperation(value = "分页获取待审核商品")
 | 
			
		||||
    @GetMapping(value = "/auth/list")
 | 
			
		||||
    public IPage<Goods> getAuthPage(GoodsSearchParams goodsSearchParams) {
 | 
			
		||||
 | 
			
		||||
    public ResultMessage<IPage<Goods>> getAuthPage(GoodsSearchParams goodsSearchParams) {
 | 
			
		||||
        goodsSearchParams.setAuthFlag(GoodsAuthEnum.TOBEAUDITED.name());
 | 
			
		||||
        return goodsService.queryByParams(goodsSearchParams);
 | 
			
		||||
        return ResultUtil.data(goodsService.queryByParams(goodsSearchParams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PreventDuplicateSubmissions
 | 
			
		||||
@ -104,7 +103,7 @@ public class GoodsManagerController {
 | 
			
		||||
            @ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, allowMultiple = true)
 | 
			
		||||
    })
 | 
			
		||||
    public ResultMessage<Object> unpGoods(@PathVariable List<String> 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);
 | 
			
		||||
 | 
			
		||||
@ -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<Specification> getAll() {
 | 
			
		||||
        List<Specification> list = specificationService.list();
 | 
			
		||||
        return list;
 | 
			
		||||
    public ResultMessage<List<Specification>> getAll() {
 | 
			
		||||
        return ResultUtil.data(specificationService.list());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping
 | 
			
		||||
    @ApiOperation(value = "搜索规格")
 | 
			
		||||
    public Page<Specification> page(String specName, PageVO page) {
 | 
			
		||||
    public ResultMessage<Page<Specification>> page(String specName, PageVO page) {
 | 
			
		||||
        LambdaQueryWrapper<Specification> 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 class SpecificationManagerController {
 | 
			
		||||
    @ApiOperation(value = "更改规格")
 | 
			
		||||
    public ResultMessage<Object> 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<Object> delAllByIds(@PathVariable List<String> ids) {
 | 
			
		||||
        specificationService.deleteSpecification(ids);
 | 
			
		||||
        return ResultUtil.success();
 | 
			
		||||
        return ResultUtil.data(specificationService.deleteSpecification(ids));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user