fix: 优化统一接口返回值
This commit is contained in:
		
							parent
							
								
									88db57c64b
								
							
						
					
					
						commit
						12476fc173
					
				@ -48,8 +48,8 @@ public class GoodsManagerController {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @ApiOperation(value = "分页获取")
 | 
					    @ApiOperation(value = "分页获取")
 | 
				
			||||||
    @GetMapping(value = "/list")
 | 
					    @GetMapping(value = "/list")
 | 
				
			||||||
    public IPage<Goods> getByPage(GoodsSearchParams goodsSearchParams) {
 | 
					    public ResultMessage<IPage<Goods>> getByPage(GoodsSearchParams goodsSearchParams) {
 | 
				
			||||||
        return goodsService.queryByParams(goodsSearchParams);
 | 
					        return ResultUtil.data(goodsService.queryByParams(goodsSearchParams));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @ApiOperation(value = "分页获取商品列表")
 | 
					    @ApiOperation(value = "分页获取商品列表")
 | 
				
			||||||
@ -60,10 +60,9 @@ public class GoodsManagerController {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @ApiOperation(value = "分页获取待审核商品")
 | 
					    @ApiOperation(value = "分页获取待审核商品")
 | 
				
			||||||
    @GetMapping(value = "/auth/list")
 | 
					    @GetMapping(value = "/auth/list")
 | 
				
			||||||
    public IPage<Goods> getAuthPage(GoodsSearchParams goodsSearchParams) {
 | 
					    public ResultMessage<IPage<Goods>> getAuthPage(GoodsSearchParams goodsSearchParams) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        goodsSearchParams.setAuthFlag(GoodsAuthEnum.TOBEAUDITED.name());
 | 
					        goodsSearchParams.setAuthFlag(GoodsAuthEnum.TOBEAUDITED.name());
 | 
				
			||||||
        return goodsService.queryByParams(goodsSearchParams);
 | 
					        return ResultUtil.data(goodsService.queryByParams(goodsSearchParams));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @PreventDuplicateSubmissions
 | 
					    @PreventDuplicateSubmissions
 | 
				
			||||||
@ -104,7 +103,7 @@ public class GoodsManagerController {
 | 
				
			|||||||
            @ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, allowMultiple = true)
 | 
					            @ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, allowMultiple = true)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    public ResultMessage<Object> unpGoods(@PathVariable List<String> goodsId) {
 | 
					    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();
 | 
					            return ResultUtil.success();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        throw new ServiceException(ResultCode.GOODS_UPPER_ERROR);
 | 
					        throw new ServiceException(ResultCode.GOODS_UPPER_ERROR);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,13 +1,13 @@
 | 
				
			|||||||
package cn.lili.controller.goods;
 | 
					package cn.lili.controller.goods;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import cn.hutool.core.text.CharSequenceUtil;
 | 
				
			||||||
import cn.lili.common.enums.ResultUtil;
 | 
					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.PageVO;
 | 
				
			||||||
import cn.lili.common.vo.ResultMessage;
 | 
					import cn.lili.common.vo.ResultMessage;
 | 
				
			||||||
import cn.lili.modules.goods.entity.dos.Specification;
 | 
					import cn.lili.modules.goods.entity.dos.Specification;
 | 
				
			||||||
import cn.lili.modules.goods.service.SpecificationService;
 | 
					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.core.conditions.query.LambdaQueryWrapper;
 | 
				
			||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
					import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
				
			||||||
import io.swagger.annotations.Api;
 | 
					import io.swagger.annotations.Api;
 | 
				
			||||||
@ -37,17 +37,16 @@ public class SpecificationManagerController {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @GetMapping("/all")
 | 
					    @GetMapping("/all")
 | 
				
			||||||
    @ApiOperation(value = "获取所有可用规格")
 | 
					    @ApiOperation(value = "获取所有可用规格")
 | 
				
			||||||
    public List<Specification> getAll() {
 | 
					    public ResultMessage<List<Specification>> getAll() {
 | 
				
			||||||
        List<Specification> list = specificationService.list();
 | 
					        return ResultUtil.data(specificationService.list());
 | 
				
			||||||
        return list;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @GetMapping
 | 
					    @GetMapping
 | 
				
			||||||
    @ApiOperation(value = "搜索规格")
 | 
					    @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<Specification> lambdaQueryWrapper = new LambdaQueryWrapper<>();
 | 
				
			||||||
        lambdaQueryWrapper.like(StringUtils.isNotEmpty(specName), Specification::getSpecName, specName);
 | 
					        lambdaQueryWrapper.like(CharSequenceUtil.isNotEmpty(specName), Specification::getSpecName, specName);
 | 
				
			||||||
        return specificationService.page(PageUtil.initPage(page), lambdaQueryWrapper);
 | 
					        return ResultUtil.data(specificationService.page(PageUtil.initPage(page), lambdaQueryWrapper));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @PostMapping
 | 
					    @PostMapping
 | 
				
			||||||
@ -61,15 +60,13 @@ public class SpecificationManagerController {
 | 
				
			|||||||
    @ApiOperation(value = "更改规格")
 | 
					    @ApiOperation(value = "更改规格")
 | 
				
			||||||
    public ResultMessage<Object> update(@Valid Specification specification, @PathVariable String id) {
 | 
					    public ResultMessage<Object> update(@Valid Specification specification, @PathVariable String id) {
 | 
				
			||||||
        specification.setId(id);
 | 
					        specification.setId(id);
 | 
				
			||||||
        specificationService.saveOrUpdate(specification);
 | 
					        return ResultUtil.data(specificationService.saveOrUpdate(specification));
 | 
				
			||||||
        return ResultUtil.success();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @DeleteMapping("/{ids}")
 | 
					    @DeleteMapping("/{ids}")
 | 
				
			||||||
    @ApiImplicitParam(name = "ids", value = "规格ID", required = true, dataType = "String", allowMultiple = true, paramType = "path")
 | 
					    @ApiImplicitParam(name = "ids", value = "规格ID", required = true, dataType = "String", allowMultiple = true, paramType = "path")
 | 
				
			||||||
    @ApiOperation(value = "批量删除")
 | 
					    @ApiOperation(value = "批量删除")
 | 
				
			||||||
    public ResultMessage<Object> delAllByIds(@PathVariable List<String> ids) {
 | 
					    public ResultMessage<Object> delAllByIds(@PathVariable List<String> ids) {
 | 
				
			||||||
        specificationService.deleteSpecification(ids);
 | 
					        return ResultUtil.data(specificationService.deleteSpecification(ids));
 | 
				
			||||||
        return ResultUtil.success();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user