diff --git a/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/enums/PayTypeEnum.java b/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/enums/PayTypeEnum.java index ee74c5195..b471ae071 100644 --- a/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/enums/PayTypeEnum.java +++ b/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/enums/PayTypeEnum.java @@ -1,6 +1,5 @@ package com.youlai.mall.oms.enums; -import lombok.AllArgsConstructor; import lombok.Getter; /** @@ -9,25 +8,31 @@ import lombok.Getter; * @email huawei_code@163.com * @date 2021/1/16 */ -@AllArgsConstructor -public enum PayTypeEnum { +public enum PayTypeEnum { + + WEIXIN(1, "微信支付"), + ALIPAY(2, "支付宝支付"), + BALANCE(3, "会员余额支付"); + + PayTypeEnum(int code, String text) { + this.code = code; + this.text = text; + } - WEIXIN(1,"微信支付"), - ALIPAY(2,"支付宝支付"), - BALANCE(3,"会员余额支付") - ; @Getter private Integer code; @Getter private String text; - public static PayTypeEnum getByCode(Integer code){ + public static PayTypeEnum getByCode(Integer code) { + PayTypeEnum payTypeEnum = null; + for (PayTypeEnum value : values()) { if (value.getCode().equals(code)) { - return value; + payTypeEnum = value; } } - return null; + return payTypeEnum; } } diff --git a/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/CartServiceImpl.java b/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/CartServiceImpl.java index e336c94ce..befc8e6e4 100644 --- a/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/CartServiceImpl.java +++ b/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/CartServiceImpl.java @@ -5,7 +5,7 @@ import com.youlai.mall.oms.constant.OmsConstants; import com.youlai.mall.oms.pojo.vo.CartVO; import com.youlai.mall.oms.service.ICartService; import com.youlai.mall.pms.api.GoodsFeignClient; -import com.youlai.mall.pms.pojo.dto.SkuDTO; +import com.youlai.mall.pms.pojo.dto.app.SkuDTO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.data.redis.core.BoundHashOperations; diff --git a/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/OrderServiceImpl.java b/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/OrderServiceImpl.java index 09454b837..761b20975 100644 --- a/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/OrderServiceImpl.java +++ b/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/OrderServiceImpl.java @@ -27,8 +27,8 @@ import com.youlai.mall.oms.service.ICartService; import com.youlai.mall.oms.service.IOrderItemService; import com.youlai.mall.oms.service.IOrderService; import com.youlai.mall.pms.api.GoodsFeignClient; -import com.youlai.mall.pms.pojo.dto.SkuDTO; -import com.youlai.mall.pms.pojo.dto.SkuLockDTO; +import com.youlai.mall.pms.pojo.dto.app.SkuDTO; +import com.youlai.mall.pms.pojo.dto.app.SkuLockDTO; import com.youlai.mall.ums.api.MemberAddressFeignClient; import com.youlai.mall.ums.api.MemberFeignClient; import com.youlai.mall.ums.pojo.entity.UmsAddress; diff --git a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/api/GoodsFeignClient.java b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/api/GoodsFeignClient.java index 34b040984..a92074bd8 100644 --- a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/api/GoodsFeignClient.java +++ b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/api/GoodsFeignClient.java @@ -1,12 +1,10 @@ package com.youlai.mall.pms.api; import com.youlai.common.result.Result; -import com.youlai.mall.pms.pojo.dto.SkuDTO; -import com.youlai.mall.pms.pojo.dto.SkuLockDTO; +import com.youlai.mall.pms.pojo.dto.app.SkuDTO; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.*; - -import java.util.List; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; @FeignClient(value = "mall-pms") public interface GoodsFeignClient { @@ -16,25 +14,4 @@ public interface GoodsFeignClient { */ @GetMapping("/app-api/v1/goods/{id}") Result getSkuById(@PathVariable Long id); - - /** - * 锁定库存 - */ - @PutMapping("/app-api/v1/goods/stocks/_lock") - Result lockStock(@RequestBody List list); - - /** - * 解锁库存 - */ - @PutMapping("/app-api/v1/goods/stocks/_unlock") - Result unlockStock(@RequestParam String orderToken); - - - /** - * 扣减库存 - */ - @PutMapping("/app-api/v1/goods/stocks/_deduct") - Result deductStock(@RequestParam String orderToken); - - } diff --git a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/api/StockFeignClient.java b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/api/StockFeignClient.java new file mode 100644 index 000000000..6944425e5 --- /dev/null +++ b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/api/StockFeignClient.java @@ -0,0 +1,33 @@ +package com.youlai.mall.pms.api; + +import com.youlai.common.result.Result; +import com.youlai.mall.pms.pojo.dto.app.SkuLockDTO; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@FeignClient(value = "mall-pms") +public interface StockFeignClient { + + /** + * 锁定库存 + */ + @PutMapping("/app-api/v1/stocks/_lock") + Result lockStock(@RequestBody List list); + + /** + * 解锁库存 + */ + @PutMapping("/app-api/v1/stocks/_unlock") + Result unlockStock(@RequestParam String orderToken); + + + /** + * 扣减库存 + */ + @PutMapping("/app-api/v1/stocks/_deduct") + Result deductStock(@RequestParam String orderToken); + + +} diff --git a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/SpuDTO.java b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/SpuDTO.java deleted file mode 100644 index 9539d1084..000000000 --- a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/SpuDTO.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.youlai.mall.pms.pojo.dto; - -import lombok.Data; -import java.util.List; - -@Data -public class SpuDTO { - - private Long id; - private String name; - private Long categoryId; - private Long brandId; - private Long originPrice; - private Long price; - private Integer sales; - private String pic; - private List pics; - private String unit; - private String description; - private String detail; - private Integer status; -} diff --git a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/admin/AttributeFormDTO.java b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/admin/AttributeFormDTO.java index d061be51f..0d8651639 100644 --- a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/admin/AttributeFormDTO.java +++ b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/admin/AttributeFormDTO.java @@ -11,7 +11,7 @@ import java.util.List; @Data -@ApiModel("属性表单对象") +@ApiModel("属性表单") public class AttributeFormDTO { @ApiModelProperty("分类ID") diff --git a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/admin/GoodsFormDTO.java b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/admin/GoodsFormDTO.java new file mode 100644 index 000000000..b3ae0b4b5 --- /dev/null +++ b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/admin/GoodsFormDTO.java @@ -0,0 +1,29 @@ +package com.youlai.mall.pms.pojo.dto.admin; + +import com.youlai.mall.pms.pojo.entity.PmsSku; +import com.youlai.mall.pms.pojo.entity.PmsSpuAttributeValue; +import lombok.Data; +import java.util.List; + +/** + * @author xianrui + */ +@Data +public class GoodsFormDTO { + + private Long id; + private String name; + private Long categoryId; + private Long brandId; + private Long originPrice; + private Long price; + private String picUrl; + private List album; + private String description; + private String detail; + + private List attrValueList; + + private List skuList; + +} diff --git a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/admin/ProductFormDTO.java b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/admin/ProductFormDTO.java deleted file mode 100644 index 77a1aa9b2..000000000 --- a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/admin/ProductFormDTO.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.youlai.mall.pms.pojo.dto.admin; - -import com.youlai.mall.pms.pojo.dto.SpuDTO; -import com.youlai.mall.pms.pojo.entity.PmsSku; -import com.youlai.mall.pms.pojo.entity.PmsSpuAttributeValue; -import lombok.Data; - -import java.util.List; - -/** - * @author xianrui - */ -@Data -public class ProductFormDTO { - private SpuDTO spu; - - private List attrs; - - private List skus; - - -} diff --git a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/app/ProductFormDTO.java b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/app/ProductFormDTO.java index 8bf7e550a..371ffcb36 100644 --- a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/app/ProductFormDTO.java +++ b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/app/ProductFormDTO.java @@ -2,7 +2,6 @@ package com.youlai.mall.pms.pojo.dto.app; import com.youlai.mall.pms.pojo.entity.PmsSku; import com.youlai.mall.pms.pojo.entity.PmsSpuAttributeValue; -import com.youlai.mall.pms.pojo.dto.SpuDTO; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -14,11 +13,29 @@ import java.util.List; @NoArgsConstructor public class ProductFormDTO { - private SpuDTO spu; + private SpuInfo spuInfo; - private List attrs; + private List attrValueList; - private List skus; + private List skuList; + + + @Data + public static class SpuInfo { + private Long id; + private String name; + private Long categoryId; + private Long brandId; + private Long originPrice; + private Long price; + private Integer sales; + private String picUrl; + private List album; + private String unit; + private String description; + private String detail; + private Integer status; + } } diff --git a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/SkuDTO.java b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/app/SkuDTO.java similarity index 88% rename from mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/SkuDTO.java rename to mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/app/SkuDTO.java index c38500da9..5fc985836 100644 --- a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/SkuDTO.java +++ b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/app/SkuDTO.java @@ -1,4 +1,4 @@ -package com.youlai.mall.pms.pojo.dto; +package com.youlai.mall.pms.pojo.dto.app; import lombok.Data; diff --git a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/SkuLockDTO.java b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/app/SkuLockDTO.java similarity index 90% rename from mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/SkuLockDTO.java rename to mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/app/SkuLockDTO.java index 4bf5a3978..acca4ff7b 100644 --- a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/SkuLockDTO.java +++ b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/app/SkuLockDTO.java @@ -1,4 +1,4 @@ -package com.youlai.mall.pms.pojo.dto; +package com.youlai.mall.pms.pojo.dto.app; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/entity/PmsSku.java b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/entity/PmsSku.java index f515ce9e2..19b2b9929 100644 --- a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/entity/PmsSku.java +++ b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/entity/PmsSku.java @@ -13,7 +13,7 @@ public class PmsSku extends BaseEntity { private String name; private String sn; private String picUrl; - private String specifications; + private String specs; private Long originPrice; private Long price; private Integer stock; diff --git a/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/vo/admin/GoodsDetailVO.java b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/vo/admin/GoodsDetailVO.java new file mode 100644 index 000000000..2884f89d4 --- /dev/null +++ b/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/vo/admin/GoodsDetailVO.java @@ -0,0 +1,46 @@ +package com.youlai.mall.pms.pojo.vo.admin; + +import com.youlai.mall.pms.pojo.entity.PmsSku; +import com.youlai.mall.pms.pojo.entity.PmsSpuAttributeValue; +import lombok.Data; +import lombok.ToString; + +import java.util.List; + +/** + * 商品详情视图层对象 + * + * @author xianrui + */ +@Data +@ToString +public class GoodsDetailVO { + + private Long id; + + private String name; + + private Long categoryId; + + private Long brandId; + + private Long originPrice; + + private Long price; + + private String picUrl; + + private List subPicUrls; + + private String description; + + private String detail; + + + private List attrList; + + private List specList; + + private List skuList; + +} diff --git a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/common/enums/GoodsAttrTypeEnum.java b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/common/enums/GoodsAttrTypeEnum.java new file mode 100644 index 000000000..c50d827d9 --- /dev/null +++ b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/common/enums/GoodsAttrTypeEnum.java @@ -0,0 +1,37 @@ +package com.youlai.mall.pms.common.enums; + +import lombok.Getter; + +/** + * 商品属性类型枚举 + * + * @author xianrui + */ +public enum GoodsAttrTypeEnum { + + SPECIFICATION(1, "规格"), + ATTRIBUTE(2, "属性"); + + GoodsAttrTypeEnum(int value, String name) { + this.value = value; + this.name = name; + } + + @Getter + private Integer value; + + @Getter + private String name; + + public static GoodsAttrTypeEnum getByValue(Integer value) { + GoodsAttrTypeEnum goodsAttrTypeEnum = null; + + for (GoodsAttrTypeEnum item : values()) { + if (item.getValue().equals(value)) { + goodsAttrTypeEnum = item; + } + } + return goodsAttrTypeEnum; + } + +} diff --git a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/admin/GoodsController.java b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/admin/GoodsController.java index d5bba8395..0619d6472 100644 --- a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/admin/GoodsController.java +++ b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/admin/GoodsController.java @@ -4,8 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.youlai.common.result.Result; -import com.youlai.mall.pms.pojo.dto.admin.ProductFormDTO; +import com.youlai.mall.pms.pojo.dto.admin.GoodsFormDTO; import com.youlai.mall.pms.pojo.entity.PmsSpu; +import com.youlai.mall.pms.pojo.vo.admin.GoodsDetailVO; import com.youlai.mall.pms.service.IPmsSpuService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -13,7 +14,6 @@ import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.*; - import java.util.Arrays; import java.util.stream.Collectors; @@ -22,7 +22,7 @@ import java.util.stream.Collectors; */ @Api(tags = "系统管理端-商品信息") @RestController -@RequestMapping("/api/v1/products") +@RequestMapping("/api/v1/goods") @AllArgsConstructor public class GoodsController { @@ -38,30 +38,35 @@ public class GoodsController { }) @GetMapping("/page") public Result list(Integer page, Integer limit, String name, Long categoryId) { - IPage result = iPmsSpuService.list( - new Page<>(page, limit), - new PmsSpu().setName(name).setCategoryId(categoryId) - ); + IPage result = iPmsSpuService.list(new Page<>(page, limit), name, categoryId); return Result.success(result.getRecords(), result.getTotal()); } + @ApiOperation(value = "商品详情") + @ApiImplicitParam(name = "id", value = "商品id", required = true, paramType = "path", dataType = "Long") + @GetMapping("/{id}") + public Result detail(@PathVariable Long id) { + GoodsDetailVO goodsDetail = iPmsSpuService.getGoodsById(id); + return Result.success(goodsDetail); + } + @ApiOperation(value = "新增商品") - @ApiImplicitParam(name = "productForm", value = "实体JSON对象", required = true, paramType = "body", dataType = "ProductFormDTO") + @ApiImplicitParam(name = "goodsForm", value = "实体JSON对象", required = true, paramType = "body", dataType = "GoodsFormDTO") @PostMapping - public Result add(@RequestBody ProductFormDTO productForm) { - boolean status = iPmsSpuService.add(productForm); - return Result.judge(status); + public Result add(@RequestBody GoodsFormDTO goodsForm) { + boolean result = iPmsSpuService.addGoods(goodsForm); + return Result.judge(result); } @ApiOperation(value = "修改商品") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "商品id", required = true, paramType = "path", dataType = "Long"), - @ApiImplicitParam(name = "spu", value = "实体JSON对象", required = true, paramType = "body", dataType = "PmsSpu") + @ApiImplicitParam(name = "goodsForm", value = "实体JSON对象", required = true, paramType = "body", dataType = "GoodsFormDTO") }) @PutMapping(value = "/{id}") - public Result update(@PathVariable Long id, @RequestBody ProductFormDTO spu) { - boolean status = iPmsSpuService.updateById(spu); - return Result.judge(status); + public Result update(@PathVariable Long id, @RequestBody GoodsFormDTO goodsForm) { + boolean result = iPmsSpuService.updateGoods(goodsForm); + return Result.judge(result); } @ApiOperation(value = "删除商品") diff --git a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/admin/StockController.java b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/admin/StockController.java index fcfec5a42..23067fb94 100644 --- a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/admin/StockController.java +++ b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/admin/StockController.java @@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.*; */ @Api(tags = "系统管理端-库存信息") @RestController -@RequestMapping("/api/v1/goods") +@RequestMapping("/api/v1/inventories") @RequiredArgsConstructor public class StockController { diff --git a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/app/CategoryController.java b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/app/CategoryController.java index a5ee64384..08828e399 100644 --- a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/app/CategoryController.java +++ b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/app/CategoryController.java @@ -18,7 +18,7 @@ import java.util.List; * @author xianrui */ @Api(tags = "移动端-分类信息") -@RestController("AppCategoryController") +@RestController("appCategoryController") @RequestMapping("/app-api/v1/categories") @Slf4j @AllArgsConstructor diff --git a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/app/GoodsController.java b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/app/GoodsController.java index af2125524..9f6287da0 100644 --- a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/app/GoodsController.java +++ b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/controller/app/GoodsController.java @@ -1,8 +1,8 @@ package com.youlai.mall.pms.controller.app; import com.youlai.common.result.Result; -import com.youlai.mall.pms.pojo.dto.SkuDTO; -import com.youlai.mall.pms.pojo.dto.SkuLockDTO; +import com.youlai.mall.pms.pojo.dto.app.SkuDTO; +import com.youlai.mall.pms.pojo.dto.app.SkuLockDTO; import com.youlai.mall.pms.service.IPmsSkuService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; diff --git a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/mapper/PmsSkuMapper.java b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/mapper/PmsSkuMapper.java index a32ffd1ab..96cedb79a 100644 --- a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/mapper/PmsSkuMapper.java +++ b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/mapper/PmsSkuMapper.java @@ -2,7 +2,7 @@ package com.youlai.mall.pms.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.youlai.mall.pms.pojo.entity.PmsSku; -import com.youlai.mall.pms.pojo.dto.SkuDTO; +import com.youlai.mall.pms.pojo.dto.app.SkuDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; diff --git a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/mapper/PmsSpuMapper.java b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/mapper/PmsSpuMapper.java index 9a018bebc..560af81cf 100644 --- a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/mapper/PmsSpuMapper.java +++ b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/mapper/PmsSpuMapper.java @@ -13,5 +13,5 @@ import java.util.List; @Mapper public interface PmsSpuMapper extends BaseMapper { - List list(Page page, PmsSpu spu); + List list(Page page, String name, Long categoryId); } diff --git a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/IPmsSkuService.java b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/IPmsSkuService.java index 7435f37d0..96ce9eeb3 100644 --- a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/IPmsSkuService.java +++ b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/IPmsSkuService.java @@ -2,8 +2,8 @@ package com.youlai.mall.pms.service; import com.baomidou.mybatisplus.extension.service.IService; import com.youlai.mall.pms.pojo.entity.PmsSku; -import com.youlai.mall.pms.pojo.dto.SkuDTO; -import com.youlai.mall.pms.pojo.dto.SkuLockDTO; +import com.youlai.mall.pms.pojo.dto.app.SkuDTO; +import com.youlai.mall.pms.pojo.dto.app.SkuLockDTO; import java.util.List; diff --git a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/IPmsSpuService.java b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/IPmsSpuService.java index f83ebe2d5..53f4788a8 100644 --- a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/IPmsSpuService.java +++ b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/IPmsSpuService.java @@ -3,22 +3,22 @@ package com.youlai.mall.pms.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; -import com.youlai.mall.pms.pojo.dto.app.ProductFormDTO; +import com.youlai.mall.pms.pojo.dto.admin.GoodsFormDTO; import com.youlai.mall.pms.pojo.entity.PmsSpu; +import com.youlai.mall.pms.pojo.vo.admin.GoodsDetailVO; + import java.util.List; public interface IPmsSpuService extends IService { - IPage list(Page page, PmsSpu spu); + IPage list(Page page, String name,Long categoryId); - boolean add(com.youlai.mall.pms.pojo.dto.admin.ProductFormDTO productFormDTO); - - com.youlai.mall.pms.pojo.dto.admin.ProductFormDTO getBySpuId(Long id); + boolean addGoods(GoodsFormDTO goodsFormDTO); boolean removeBySpuIds(List spuIds); - boolean updateById(com.youlai.mall.pms.pojo.dto.admin.ProductFormDTO productFormDTO); + boolean updateGoods(GoodsFormDTO goodsFormDTO); - ProductFormDTO getProductByIdForApp(Long id); + GoodsDetailVO getGoodsById(Long id); } diff --git a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/impl/PmsSkuServiceImpl.java b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/impl/PmsSkuServiceImpl.java index 000a19c8d..4849c93e3 100644 --- a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/impl/PmsSkuServiceImpl.java +++ b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/impl/PmsSkuServiceImpl.java @@ -10,8 +10,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.youlai.common.web.exception.BizException; import com.youlai.mall.pms.mapper.PmsSkuMapper; import com.youlai.mall.pms.pojo.entity.PmsSku; -import com.youlai.mall.pms.pojo.dto.SkuDTO; -import com.youlai.mall.pms.pojo.dto.SkuLockDTO; +import com.youlai.mall.pms.pojo.dto.app.SkuDTO; +import com.youlai.mall.pms.pojo.dto.app.SkuLockDTO; import com.youlai.mall.pms.service.IPmsSkuService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -126,8 +126,8 @@ public class PmsSkuServiceImpl extends ServiceImpl impleme skuLockList.forEach(item -> { boolean result = this.update(new LambdaUpdateWrapper() .eq(PmsSku::getId, item.getSkuId()) - .setSql("stock = stock - " + item.getCount()) // 扣减库存 - .setSql("locked_stock = locked_stock - " + item.getCount()) + .setSql("inventory = inventory - " + item.getCount()) // 扣减库存 + .setSql("locked_inventory = locked_inventory - " + item.getCount()) ); if (!result) { throw new BizException("扣减库存失败,商品" + item.getSkuId() + "库存不足"); diff --git a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/impl/PmsSpuServiceImpl.java b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/impl/PmsSpuServiceImpl.java index 93c88aa87..485e1f366 100644 --- a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/impl/PmsSpuServiceImpl.java +++ b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/impl/PmsSpuServiceImpl.java @@ -1,54 +1,58 @@ package com.youlai.mall.pms.service.impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.youlai.mall.pms.common.enums.GoodsAttrTypeEnum; import com.youlai.mall.pms.component.BloomRedisService; import com.youlai.mall.pms.mapper.PmsSpuMapper; -import com.youlai.mall.pms.pojo.dto.SpuDTO; -import com.youlai.mall.pms.pojo.dto.admin.ProductFormDTO; -import com.youlai.mall.pms.pojo.entity.*; -import com.youlai.mall.pms.service.*; +import com.youlai.mall.pms.pojo.dto.admin.GoodsFormDTO; +import com.youlai.mall.pms.pojo.entity.PmsSku; +import com.youlai.mall.pms.pojo.entity.PmsSpu; +import com.youlai.mall.pms.pojo.entity.PmsSpuAttributeValue; +import com.youlai.mall.pms.pojo.vo.admin.GoodsDetailVO; +import com.youlai.mall.pms.service.IPmsAttributeService; +import com.youlai.mall.pms.service.IPmsSkuService; +import com.youlai.mall.pms.service.IPmsSpuAttributeValueService; +import com.youlai.mall.pms.service.IPmsSpuService; import lombok.AllArgsConstructor; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; - -import static com.youlai.mall.pms.common.constant.PmsConstants.PRODUCT_REDIS_BLOOM_FILTER; /** * @author xianrui */ @Service -@AllArgsConstructor +@RequiredArgsConstructor public class PmsSpuServiceImpl extends ServiceImpl implements IPmsSpuService { - private IPmsSkuService iPmsSkuService; - private IPmsSpuAttributeValueService iPmsSpuAttributeValueService; - private IPmsAttributeService attributeService; - private BloomRedisService bloomRedisService; - + private final IPmsSkuService iPmsSkuService; + private final IPmsSpuAttributeValueService iPmsSpuAttributeValueService; + private final IPmsAttributeService attributeService; + private final BloomRedisService bloomRedisService; @Override - public IPage list(Page page, PmsSpu spu) { - List list = this.baseMapper.list(page, spu); + public IPage list(Page page, String name, Long categoryId) { + List list = this.baseMapper.list(page, name, categoryId); page.setRecords(list); return page; } @Override @Transactional - public boolean add(ProductFormDTO productFormDTO) { - SpuDTO SpuDTO = productFormDTO.getSpu(); - List attrValues = productFormDTO.getAttrs(); - List specs = productFormDTO.getAttrs(); - List skuList = productFormDTO.getSkus(); + public boolean addGoods(GoodsFormDTO goodsForm) { +/* SpuDTO SpuDTO = goodsForm.getSpu(); + List attrValues = goodsForm.getAttrs(); + List specs = goodsForm.getAttrs(); + List skuList = goodsForm.getSkus(); // spu保存 PmsSpu spu = new PmsSpu(); @@ -67,8 +71,8 @@ public class PmsSpuServiceImpl extends ServiceImpl impleme // 规格保存 Optional.ofNullable(specs).ifPresent(list -> { - /* list.forEach(item -> item.setSpuId(spu.getId())); - iPmsSpuSpecValueService.saveBatch(list);*/ + *//* list.forEach(item -> item.setSpuId(spu.getId())); + iPmsSpuSpecValueService.saveBatch(list);*//* }); // sku保存 @@ -76,45 +80,18 @@ public class PmsSpuServiceImpl extends ServiceImpl impleme list.forEach(item -> item.setSpuId(spu.getId())); iPmsSkuService.saveBatch(skuList); }); - bloomRedisService.addByBloomFilter(PRODUCT_REDIS_BLOOM_FILTER, spu.getId() + ""); + bloomRedisService.addByBloomFilter(PRODUCT_REDIS_BLOOM_FILTER, spu.getId() + "");*/ return true; } - @Override - public ProductFormDTO getBySpuId(Long id) { - // spu - SpuDTO spuDTO = new SpuDTO(); - PmsSpu spu = this.getById(id); - BeanUtil.copyProperties(spu, spuDTO); - - if (StrUtil.isNotBlank(spu.getAlbum())) { - // spu专辑图片转换处理 json字符串 -> List - List pics = JSONUtil.toList(JSONUtil.parseArray(spu.getAlbum()), String.class); - spuDTO.setPics(pics); - } - - // 属性 - List attrs = iPmsSpuAttributeValueService. - list(new LambdaQueryWrapper().eq(PmsSpuAttributeValue::getSpuId, id)); - // 规格 - List specs = iPmsSpuAttributeValueService.list(new LambdaQueryWrapper().eq(PmsSpuAttributeValue::getSpuId, id)); - // sku - List skus = iPmsSkuService.list(new LambdaQueryWrapper().eq(PmsSku::getSpuId, id)); - - // 组合 - // ProductFormDTO productFormDTO = new ProductFormDTO(spuDTO, attrs, specs, skus); - ProductFormDTO productFormDTO = new ProductFormDTO(); - return productFormDTO; - } - @Override - public boolean updateById(ProductFormDTO productFormDTO) { - SpuDTO SpuDTO = productFormDTO.getSpu(); + public boolean updateGoods(GoodsFormDTO goodsFormDTO) { + /* SpuDTO SpuDTO = goodsFormDTO.getSpu(); - List attrValues = productFormDTO.getAttrs(); - List specs = productFormDTO.getAttrs(); - List skuList = productFormDTO.getSkus(); + List attrValues = goodsFormDTO.getAttrs(); + List specs = goodsFormDTO.getAttrs(); + List skuList = goodsFormDTO.getSkus(); // spu保存 PmsSpu spu = new PmsSpu(); @@ -174,10 +151,48 @@ public class PmsSpuServiceImpl extends ServiceImpl impleme iPmsSkuService.removeByIds(removeIds); iPmsSkuService.saveOrUpdateBatch(skuList); - }); + });*/ return true; } + + @Override + public GoodsDetailVO getGoodsById(Long id) { + GoodsDetailVO goodsDetailVO = new GoodsDetailVO(); + + PmsSpu spu = this.getById(id); + Assert.isTrue(spu != null, "商品不存在"); + + BeanUtil.copyProperties(spu, goodsDetailVO); + + // 商品图册JSON字符串转JSON + String album = spu.getAlbum(); + if (StrUtil.isNotBlank(album)) { + List picUrls = JSONUtil.toList(album, String.class); + goodsDetailVO.setSubPicUrls(picUrls); + } + + // 商品属性列表 + List attrList = iPmsSpuAttributeValueService.list(new LambdaQueryWrapper() + .eq(PmsSpuAttributeValue::getSpuId, id) + .eq(PmsSpuAttributeValue::getType, GoodsAttrTypeEnum.ATTRIBUTE.getValue()) + ); + goodsDetailVO.setAttrList(attrList); + + // 商品规格列表 + List specList = iPmsSpuAttributeValueService.list(new LambdaQueryWrapper() + .eq(PmsSpuAttributeValue::getSpuId, id) + .eq(PmsSpuAttributeValue::getType, GoodsAttrTypeEnum.SPECIFICATION.getValue()) + ); + goodsDetailVO.setSpecList(specList); + + // 商品SKU列表 + List skuList = iPmsSkuService.list(new LambdaQueryWrapper().eq(PmsSku::getSpuId, id)); + goodsDetailVO.setSkuList(skuList); + + return goodsDetailVO; + } + @Override public boolean removeBySpuIds(List spuIds) { Optional.ofNullable(spuIds).ifPresent( @@ -195,31 +210,5 @@ public class PmsSpuServiceImpl extends ServiceImpl impleme return true; } - @Override - public com.youlai.mall.pms.pojo.dto.app.ProductFormDTO getProductByIdForApp(Long spuId) { - // spu - PmsSpu spu = this.getById(spuId); - SpuDTO SpuDTO = new SpuDTO(); - BeanUtil.copyProperties(spu, SpuDTO); - if (StrUtil.isNotBlank(spu.getAlbum())) { - // spu专辑图片转换处理 json字符串 -> List - List pics = JSONUtil.toList(JSONUtil.parseArray(spu.getAlbum()), String.class); - SpuDTO.setPics(pics); - } - // 属性 - List attrs = iPmsSpuAttributeValueService.list( - new LambdaQueryWrapper( - ).eq(PmsSpuAttributeValue::getSpuId, spuId) - ); - // 规格 - // List specs = attributeService.listBySpuId(spuId); - List specs = null; - // sku - List skuList = iPmsSkuService.list(new LambdaQueryWrapper().eq(PmsSku::getSpuId, spuId)); - - // com.youlai.mall.pms.pojo.dto.app.ProductFormDTO product = new com.youlai.mall.pms.pojo.dto.app.ProductFormDTO(SpuDTO, attrs, specs, skuList); - com.youlai.mall.pms.pojo.dto.app.ProductFormDTO product=new com.youlai.mall.pms.pojo.dto.app.ProductFormDTO(); - return product; - } } diff --git a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/impl/ProductServiceImpl.java b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/impl/ProductServiceImpl.java index 5842e5266..a5da4c120 100644 --- a/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/impl/ProductServiceImpl.java +++ b/mall-pms/pms-boot/src/main/java/com/youlai/mall/pms/service/impl/ProductServiceImpl.java @@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.youlai.common.redis.utils.RedisUtils; import com.youlai.mall.pms.config.ProductLocalCache; import com.youlai.mall.pms.mapper.PmsSpuMapper; -import com.youlai.mall.pms.pojo.dto.SpuDTO; import com.youlai.mall.pms.pojo.dto.app.ProductFormDTO; import com.youlai.mall.pms.pojo.entity.PmsAttribute; import com.youlai.mall.pms.pojo.entity.PmsSku; @@ -50,7 +49,7 @@ public class ProductServiceImpl extends ServiceImpl implem public ProductFormDTO getProductById(Long spuId) { //1、一级本地缓存设置 ProductFormDTO product = productLocalCache.get(PRODUCT_DETAIL_CACHE + spuId); - if (null != product) { + /* if (null != product) { log.info("get LocalCache product:" + product); return product; } @@ -104,7 +103,7 @@ public class ProductServiceImpl extends ServiceImpl implem lock.unlock(); } } - } + }*/ return product; } } diff --git a/mall-pms/pms-boot/src/main/resources/mapper/PmsSkuMapper.xml b/mall-pms/pms-boot/src/main/resources/mapper/PmsSkuMapper.xml index b9ebf0080..4e9029add 100644 --- a/mall-pms/pms-boot/src/main/resources/mapper/PmsSkuMapper.xml +++ b/mall-pms/pms-boot/src/main/resources/mapper/PmsSkuMapper.xml @@ -10,7 +10,7 @@ - + @@ -21,7 +21,7 @@ id,spu_id,name, - sn,pic_url,specifications, + sn,pic_url,specs, origin_price,price,stock, locked_stock,gmt_create,gmt_modified diff --git a/mall-pms/pms-boot/src/main/resources/mapper/PmsSpuMapper.xml b/mall-pms/pms-boot/src/main/resources/mapper/PmsSpuMapper.xml index 196958a3a..f5e9ae0a3 100644 --- a/mall-pms/pms-boot/src/main/resources/mapper/PmsSpuMapper.xml +++ b/mall-pms/pms-boot/src/main/resources/mapper/PmsSpuMapper.xml @@ -3,56 +3,67 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - id,name,category_id, + id + ,name,category_id, brand_id,origin_price,price, sales,pic_url,album, unit,description,detail, status,gmt_create,gmt_modified - + SELECT t1.*, + t3.NAME categoryName, + t4.NAME brandName, + t2.id skuId, + t2.NAME skuName, + t2.sn, + t2.pic_url skuPicUrl, + t2.specifications, + t2.origin_price skuOriginPrice, + t2.price skuPrice, + t2.stock + FROM pms_spu t1 + LEFT JOIN pms_sku t2 ON t1.id = t2.spu_id + LEFT JOIN pms_category t3 ON t1.category_id = t3.id + LEFT JOIN pms_brand t4 ON t1.brand_id = t4.id + WHERE 1 = 1 + + AND t1.category_id =#{categoryId} + + + AND t1.category_id =#{categoryId} + diff --git a/mall-pms/pms-boot/src/test/java/com/youlai/mall/pms/service/impl/PmsSpuServiceImplTest.java b/mall-pms/pms-boot/src/test/java/com/youlai/mall/pms/service/impl/PmsSpuServiceImplTest.java new file mode 100644 index 000000000..5b7d97e24 --- /dev/null +++ b/mall-pms/pms-boot/src/test/java/com/youlai/mall/pms/service/impl/PmsSpuServiceImplTest.java @@ -0,0 +1,26 @@ +package com.youlai.mall.pms.service.impl; + +import com.youlai.mall.pms.pojo.vo.admin.GoodsDetailVO; +import com.youlai.mall.pms.service.IPmsSpuService; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +/** + * @author xianrui + * @date 2021/7/17 + */ +@SpringBootTest +@Slf4j +class PmsSpuServiceImplTest { + + @Autowired + private IPmsSpuService iPmsSpuService; + + @Test + void getGoodsById() { + GoodsDetailVO goodsDetail = iPmsSpuService.getGoodsById(1l); + log.info(goodsDetail.toString()); + } +} \ No newline at end of file diff --git a/mall-sms/sms-api/src/main/java/com/youlai/mall/sms/pojo/to/SeckillSkuRedisTO.java b/mall-sms/sms-api/src/main/java/com/youlai/mall/sms/pojo/to/SeckillSkuRedisTO.java index 3d8c4dcca..0edd97634 100644 --- a/mall-sms/sms-api/src/main/java/com/youlai/mall/sms/pojo/to/SeckillSkuRedisTO.java +++ b/mall-sms/sms-api/src/main/java/com/youlai/mall/sms/pojo/to/SeckillSkuRedisTO.java @@ -1,6 +1,6 @@ package com.youlai.mall.sms.pojo.to; -import com.youlai.mall.pms.pojo.dto.SkuDTO; +import com.youlai.mall.pms.pojo.dto.app.SkuDTO; import lombok.Data; import lombok.ToString; diff --git a/mall-sms/sms-api/src/main/java/com/youlai/mall/sms/pojo/vo/SmsSeckillSkuVO.java b/mall-sms/sms-api/src/main/java/com/youlai/mall/sms/pojo/vo/SmsSeckillSkuVO.java index 023f9e095..ea4503449 100644 --- a/mall-sms/sms-api/src/main/java/com/youlai/mall/sms/pojo/vo/SmsSeckillSkuVO.java +++ b/mall-sms/sms-api/src/main/java/com/youlai/mall/sms/pojo/vo/SmsSeckillSkuVO.java @@ -1,6 +1,6 @@ package com.youlai.mall.sms.pojo.vo; -import com.youlai.mall.pms.pojo.dto.SkuDTO; +import com.youlai.mall.pms.pojo.dto.app.SkuDTO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/youlai-admin/admin-api/src/main/java/com/youlai/admin/pojo/entity/SysMenu.java b/youlai-admin/admin-api/src/main/java/com/youlai/admin/pojo/entity/SysMenu.java index 31f4117f6..e5b9443b4 100644 --- a/youlai-admin/admin-api/src/main/java/com/youlai/admin/pojo/entity/SysMenu.java +++ b/youlai-admin/admin-api/src/main/java/com/youlai/admin/pojo/entity/SysMenu.java @@ -24,17 +24,12 @@ public class SysMenu extends BaseEntity { private String name; - private String icon; - - /** - * 路由名称 - */ - private String routeName; + private String iconUrl; /** * 路由路径 */ - private String routePath; + private String path; private String component; diff --git a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/common/enums/PermTypeEnum.java b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/common/enums/PermTypeEnum.java index 0a3f4f91a..fcb1521cf 100644 --- a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/common/enums/PermTypeEnum.java +++ b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/common/enums/PermTypeEnum.java @@ -6,9 +6,8 @@ import lombok.Setter; /** * 权限类型 * - * @Author haoxr - * @Date 2021-02-05 10:10 - * @Version 1.0.0 + * @author xianrui + * @date 2021-02-05 */ public enum PermTypeEnum { diff --git a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/MenuController.java b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/MenuController.java index a2ff46bfa..12178c322 100644 --- a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/MenuController.java +++ b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/MenuController.java @@ -20,7 +20,7 @@ import java.util.Arrays; import java.util.List; /** - * @author haoxr + * @author xianrui * @date 2020-11-06 */ @Api(tags = "菜单接口") diff --git a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/RouteController.java b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/RouteController.java index 69861b360..e1baefc8f 100644 --- a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/RouteController.java +++ b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/RouteController.java @@ -14,9 +14,8 @@ import org.springframework.web.bind.annotation.RestController; import java.util.List; /** - * @author haoxr - * @description TODO - * @createTime 2021/6/1 22:40 + * @author xianrui + * @date 2021/6/1 22:40 */ @Api(tags = "路由接口") @RestController diff --git a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysMenuServiceImpl.java b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysMenuServiceImpl.java index da97e814f..ff70c54cf 100644 --- a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysMenuServiceImpl.java +++ b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysMenuServiceImpl.java @@ -20,8 +20,8 @@ import java.util.Optional; /** - * @Author haoxr - * @Date 2020-11-06 + * @author xianrui + * @date 2020-11-06 */ @Service public class SysMenuServiceImpl extends ServiceImpl implements ISysMenuService { @@ -107,13 +107,13 @@ public class SysMenuServiceImpl extends ServiceImpl impl RouteVO routeVO = new RouteVO(); routeVO.setName(menu.getId() + ""); // 根据name路由跳转 this.$router.push({path:xxx}) - routeVO.setPath(menu.getRoutePath()); // 根据path路由跳转 this.$router.push({name:xxx}) + routeVO.setPath(menu.getPath()); // 根据path路由跳转 this.$router.push({name:xxx}) routeVO.setRedirect(menu.getRedirect()); routeVO.setComponent(menu.getComponent()); routeVO.setRedirect(menu.getRedirect()); routeVO.setMeta(routeVO.new Meta( menu.getName(), - menu.getIcon(), + menu.getIconUrl(), menu.getRoles() )); // 菜单显示隐藏 diff --git a/youlai-admin/admin-boot/src/main/resources/mapper/SysMenuMapper.xml b/youlai-admin/admin-boot/src/main/resources/mapper/SysMenuMapper.xml index b5a477934..8d647d2f8 100644 --- a/youlai-admin/admin-boot/src/main/resources/mapper/SysMenuMapper.xml +++ b/youlai-admin/admin-boot/src/main/resources/mapper/SysMenuMapper.xml @@ -7,11 +7,10 @@ - - + - + @@ -33,10 +32,9 @@ select t1.id, t1.name, t1.parent_id, - t1.route_name, - t1.route_path, + t1.path, t1.component, - t1.icon, + t1.icon_url, t1.sort, t1.visible, t1.redirect,