fix: 优化代码结构

This commit is contained in:
misworga831
2023-02-08 00:56:08 +08:00
parent 9e1837e89c
commit cb7e1cc03e
13 changed files with 37 additions and 39 deletions

View File

@@ -54,22 +54,22 @@ public class DistributionGoodsBuyerController {
@PreventDuplicateSubmissions
@ApiOperation(value = "选择分销商品")
@ApiImplicitParams({
@ApiImplicitParam(name = "distributionGoodsId", value = "分销ID", required = true, dataType = "String", paramType = "path"),
@ApiImplicitParam(name = "distributionGoodsId", value = "分销ID", required = true, dataType = "String", paramType = "path"),
@ApiImplicitParam(name = "checked", value = "是否选择", required = true, dataType = "boolean", paramType = "query")
})
@GetMapping(value = "/checked/{distributionGoodsId}")
public ResultMessage<Object> distributionCheckGoods(
@NotNull(message = "分销商品不能为空") @PathVariable("distributionGoodsId") String distributionGoodsId,Boolean checked) {
Boolean result=false;
if(checked){
result=distributionSelectedGoodsService.add(distributionGoodsId);
}else {
result=distributionSelectedGoodsService.delete(distributionGoodsId);
@NotNull(message = "分销商品不能为空") @PathVariable("distributionGoodsId") String distributionGoodsId, Boolean checked) {
Boolean result = false;
if (checked) {
result = distributionSelectedGoodsService.add(distributionGoodsId);
} else {
result = distributionSelectedGoodsService.delete(distributionGoodsId);
}
//判断操作结果
if(result){
if (result) {
return ResultUtil.success(ResultCode.SUCCESS);
}else{
} else {
throw new ServiceException(ResultCode.ERROR);
}