refactor: 类名重命名优化

This commit is contained in:
haoxr 2022-12-24 10:23:41 +08:00
parent cf82da770f
commit 9398be088f
8 changed files with 57 additions and 55 deletions

View File

@ -4,13 +4,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.youlai.common.base.IBaseEnum;
import com.youlai.common.result.PageResult;
import com.youlai.common.result.Result;
import com.youlai.mall.oms.enums.PayTypeEnum;
import com.youlai.mall.oms.common.enums.PayTypeEnum;
import com.youlai.mall.oms.pojo.entity.OmsOrder;
import com.youlai.mall.oms.pojo.form.OrderSubmitForm;
import com.youlai.mall.oms.pojo.query.OrderPageQuery;
import com.youlai.mall.oms.pojo.vo.OrderConfirmVO;
import com.youlai.mall.oms.pojo.vo.OrderSubmitVO;
import com.youlai.mall.oms.service.IOrderService;
import com.youlai.mall.oms.pojo.vo.OrderSubmitResultVO;
import com.youlai.mall.oms.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@ -19,20 +19,20 @@ import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
* 移动端订单控制层
*
* @author huawei
* @email huawei_code@163.com
* @date 2020-12-30 22:31:10
*/
@Api(tags = "「移动端」订单管理")
@Api(tags = "「移动端」订单接口")
@RestController
@RequestMapping("/app-api/v1/orders")
@RequiredArgsConstructor
public class OrderController {
final IOrderService orderService;
final OrderService orderService;
@ApiOperation("分页列表")
@GetMapping
@ -60,7 +60,7 @@ public class OrderController {
@ApiOperation("订单提交")
@PostMapping("/_submit")
public Result submitOrder(@RequestBody @Validated OrderSubmitForm orderSubmitForm) {
OrderSubmitVO result = orderService.submitOrder(orderSubmitForm);
OrderSubmitResultVO result = orderService.submitOrder(orderSubmitForm);
return Result.success(result);
}
@ -83,10 +83,4 @@ public class OrderController {
return Result.judge(result);
}
@ApiOperation("订单取消")
@PutMapping("/cancel")
public Result cancel(@RequestParam Long id) {
boolean result = orderService.cancelOrder(id);
return Result.judge(result);
}
}

View File

@ -2,7 +2,7 @@ package com.youlai.mall.pms.api;
import com.youlai.common.result.Result;
import com.youlai.mall.pms.pojo.dto.CheckPriceDTO;
import com.youlai.mall.pms.pojo.dto.SkuInfoDTO;
import com.youlai.mall.pms.pojo.dto.SkuDTO;
import com.youlai.mall.pms.pojo.dto.LockStockDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
@ -15,7 +15,7 @@ public interface SkuFeignClient {
* 获取商品库存单元信息
*/
@GetMapping("/app-api/v1/sku/{skuId}/info")
Result<SkuInfoDTO> getSkuInfo(@PathVariable Long skuId);
Result<SkuDTO> getSkuInfo(@PathVariable Long skuId);
/**
* 锁定商品库存

View File

@ -10,7 +10,7 @@ import lombok.Data;
*/
@Data
public class SkuInfoDTO {
public class SkuDTO {
/**
* skuId
*/

View File

@ -4,11 +4,12 @@ import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.youlai.common.result.Result;
import com.youlai.common.web.model.Option;
import com.youlai.mall.pms.pojo.entity.PmsCategoryAttribute;
import com.youlai.mall.pms.pojo.entity.PmsCategory;
import com.youlai.mall.pms.pojo.vo.CategoryVO;
import com.youlai.mall.pms.service.IPmsAttributeService;
import com.youlai.mall.pms.service.IPmsCategoryService;
import com.youlai.mall.pms.service.AttributeService;
import com.youlai.mall.pms.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
@ -32,20 +33,20 @@ import java.util.List;
@RequiredArgsConstructor
public class PmsCategoryController {
private final IPmsCategoryService iPmsCategoryService;
private final IPmsAttributeService iPmsAttributeService;
private final CategoryService categoryService;
private final AttributeService attributeService;
@ApiOperation(value = "商品分类列表")
@GetMapping
public Result<List<CategoryVO>> list() {
List<CategoryVO> list = iPmsCategoryService.listCategory(null);
List<CategoryVO> list = categoryService.listCategory(null);
return Result.success(list);
}
@ApiOperation(value = "商品分类级联列表")
@GetMapping("/options")
public Result listCategoryOptions() {
List list = iPmsCategoryService.listCategoryOptions();
List<Option> list = categoryService.listCategoryOptions();
return Result.success(list);
}
@ -54,14 +55,14 @@ public class PmsCategoryController {
public Result detail(
@ApiParam("商品分类ID") @PathVariable Long id
) {
PmsCategory category = iPmsCategoryService.getById(id);
PmsCategory category = categoryService.getById(id);
return Result.success(category);
}
@ApiOperation(value = "新增商品分类")
@PostMapping
public Result addCategory(@RequestBody PmsCategory category) {
Long id = iPmsCategoryService.saveCategory(category);
Long id = categoryService.saveCategory(category);
return Result.success(id);
}
@ -72,7 +73,7 @@ public class PmsCategoryController {
@RequestBody PmsCategory category
) {
category.setId(id);
id = iPmsCategoryService.saveCategory(category);
id = categoryService.saveCategory(category);
return Result.success(id);
}
@ -82,9 +83,9 @@ public class PmsCategoryController {
@CacheEvict(value = "pms", key = "'categoryList'")
public Result delete(@PathVariable String ids) {
List<String> categoryIds = Arrays.asList(ids.split(","));
iPmsAttributeService.remove(new LambdaQueryWrapper<PmsCategoryAttribute>().in(CollectionUtil.isNotEmpty(categoryIds),
attributeService.remove(new LambdaQueryWrapper<PmsCategoryAttribute>().in(CollectionUtil.isNotEmpty(categoryIds),
PmsCategoryAttribute::getCategoryId, categoryIds));
boolean result = iPmsCategoryService.removeByIds(categoryIds);
boolean result = categoryService.removeByIds(categoryIds);
return Result.judge(result);
}
@ -92,9 +93,10 @@ public class PmsCategoryController {
@PatchMapping(value = "/{id}")
@CacheEvict(value = "pms", key = "'categoryList'")
public Result patch(@PathVariable Long id, @RequestBody PmsCategory category) {
LambdaUpdateWrapper<PmsCategory> updateWrapper = new LambdaUpdateWrapper<PmsCategory>().eq(PmsCategory::getId, id);
LambdaUpdateWrapper<PmsCategory> updateWrapper = new LambdaUpdateWrapper<PmsCategory>()
.eq(PmsCategory::getId, id);
updateWrapper.set(category.getVisible() != null, PmsCategory::getVisible, category.getVisible());
boolean result = iPmsCategoryService.update(updateWrapper);
boolean result = categoryService.update(updateWrapper);
return Result.judge(result);
}
}

View File

@ -3,23 +3,23 @@ package com.youlai.mall.pms.controller.admin;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.youlai.common.result.Result;
import com.youlai.mall.pms.pojo.entity.PmsSku;
import com.youlai.mall.pms.service.IPmsSkuService;
import com.youlai.mall.pms.service.SkuService;
import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* 管理端SKU控制器
* 管理端商品SKU控制层
*
* @author haoxr
* @date 2022/2/8
*/
@Api(tags = "「管理端」SKU接口")
@Api(tags = "「管理端」商品SKU接口")
@RestController
@RequestMapping("/api/v1/sku")
@RequiredArgsConstructor
public class PmsSkuController {
private final IPmsSkuService skuService;
private final SkuService skuService;
@ApiOperation(value = "商品SKU详情")
@GetMapping("/{skuId}")
@ -47,7 +47,10 @@ public class PmsSkuController {
@RequestParam Integer count
) {
boolean result = skuService.deductStock(skuId, count);
boolean result = skuService.update(new LambdaUpdateWrapper<PmsSku>()
.setSql("stock_num = stock_num - " + count)
.eq(PmsSku::getId, skuId)
);
return Result.judge(result);
}

View File

@ -7,7 +7,7 @@ import com.youlai.mall.pms.pojo.form.PmsSpuForm;
import com.youlai.mall.pms.pojo.query.SpuPageQuery;
import com.youlai.mall.pms.pojo.vo.PmsSpuDetailVO;
import com.youlai.mall.pms.pojo.vo.PmsSpuPageVO;
import com.youlai.mall.pms.service.IPmsSpuService;
import com.youlai.mall.pms.service.SpuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -15,37 +15,37 @@ import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* 管理端商品管理控制器
* 管理端商品控制层
*
* @author haoxr
* @date 2021/1/4
**/
@Api(tags = "「管理端」商品管理")
@Api(tags = "「管理端」商品SPU接口")
@RestController
@RequestMapping("/api/v1/spu")
@AllArgsConstructor
public class PmsSpuController {
private IPmsSpuService pmsSpuServiced;
private SpuService spuServiced;
@ApiOperation(value = "商品分页列表")
@GetMapping("/pages")
public PageResult listPmsSpuPages(SpuPageQuery queryParams) {
IPage<PmsSpuPageVO> result = pmsSpuServiced.listPmsSpuPages(queryParams);
IPage<PmsSpuPageVO> result = spuServiced.listPmsSpuPages(queryParams);
return PageResult.success(result);
}
@ApiOperation(value = "商品详情")
@GetMapping("/{id}")
public Result detail( @ApiParam("商品ID") @PathVariable Long id) {
PmsSpuDetailVO pmsSpuDetailVO = pmsSpuServiced.getPmsSpuDetail(id);
PmsSpuDetailVO pmsSpuDetailVO = spuServiced.getPmsSpuDetail(id);
return Result.success(pmsSpuDetailVO);
}
@ApiOperation(value = "新增商品")
@PostMapping
public Result addSpu(@RequestBody PmsSpuForm formData) {
boolean result = pmsSpuServiced.addSpu(formData);
boolean result = spuServiced.addSpu(formData);
return Result.judge(result);
}
@ -55,14 +55,14 @@ public class PmsSpuController {
@ApiParam("商品ID") @PathVariable Long id,
@RequestBody PmsSpuForm formData
) {
boolean result = pmsSpuServiced.updateSpuById(id,formData);
boolean result = spuServiced.updateSpuById(id,formData);
return Result.judge(result);
}
@ApiOperation(value = "删除商品")
@DeleteMapping("/{ids}")
public Result delete(@ApiParam("商品ID,多个以英文逗号(,)分隔") @PathVariable String ids) {
boolean result = pmsSpuServiced.removeBySpuIds(ids);
boolean result = spuServiced.removeBySpuIds(ids);
return Result.judge(result);
}

View File

@ -2,9 +2,9 @@ package com.youlai.mall.pms.controller.app;
import com.youlai.common.result.Result;
import com.youlai.mall.pms.pojo.dto.CheckPriceDTO;
import com.youlai.mall.pms.pojo.dto.SkuInfoDTO;
import com.youlai.mall.pms.pojo.dto.SkuDTO;
import com.youlai.mall.pms.pojo.dto.LockStockDTO;
import com.youlai.mall.pms.service.IPmsSkuService;
import com.youlai.mall.pms.service.SkuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -12,29 +12,32 @@ import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* 商品库存单元控制器 (Stock Keeping Unit)
* SKU控制层
*
* @author haoxr
* @date 2022/12/21
*/
@Api(tags = "「移动端」库存信息")
@Api(tags = "「移动端」SKU接口")
@RestController
@RequestMapping("/app-api/v1/sku")
@RequiredArgsConstructor
public class SkuController {
private final IPmsSkuService skuService;
private final SkuService skuService;
@ApiOperation(value = "获取商品库存信息")
@GetMapping("/{skuId}/info")
public Result<SkuInfoDTO> getSkuInfo(
@ApiParam("SKU ID") @PathVariable Long skuId
public Result<SkuDTO> getSkuInfo(
@ApiParam("商品ID") @PathVariable Long skuId
) {
SkuInfoDTO skuInfo = skuService.getSkuInfo(skuId);
SkuDTO skuInfo = skuService.getSkuInfo(skuId);
return Result.success(skuInfo);
}
@ApiOperation("获取商品库存数量")
@GetMapping("/{skuId}/stock_num")
public Result<Integer> getStockNum(
@ApiParam("商品库存单元ID") @PathVariable Long skuId
@ApiParam("商品ID") @PathVariable Long skuId
) {
Integer stockNum = skuService.getStockNum(skuId);
return Result.success(stockNum);

View File

@ -7,7 +7,7 @@ import com.youlai.mall.pms.pojo.query.SpuPageQuery;
import com.youlai.mall.pms.pojo.vo.SeckillingSpuVO;
import com.youlai.mall.pms.pojo.vo.SpuPageVO;
import com.youlai.mall.pms.pojo.vo.SpuDetailVO;
import com.youlai.mall.pms.service.IPmsSpuService;
import com.youlai.mall.pms.service.SpuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -25,7 +25,7 @@ import java.util.List;
@RequiredArgsConstructor
public class SpuController {
private final IPmsSpuService spuService;
private final SpuService spuService;
@ApiOperation(value = "商品分页列表")
@GetMapping("/pages")