Commit 9632c33d279f33348276c27d592ed8241bd827c6

Authored by YunaiV
1 parent 1bd1c79f

mall:优化商品的分类、品牌的代码

Showing 13 changed files with 58 additions and 28 deletions
sql/optional/mall/mall.sql
@@ -39,7 +39,7 @@ CREATE TABLE `market_activity` ( @@ -39,7 +39,7 @@ CREATE TABLE `market_activity` (
39 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 39 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
40 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', 40 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
41 PRIMARY KEY (`id`) USING BTREE 41 PRIMARY KEY (`id`) USING BTREE
42 -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '促销活动'; 42 +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '促销活动';
43 43
44 -- ---------------------------- 44 -- ----------------------------
45 -- Records of market_activity 45 -- Records of market_activity
@@ -66,7 +66,7 @@ CREATE TABLE `market_banner` ( @@ -66,7 +66,7 @@ CREATE TABLE `market_banner` (
66 `sort` tinyint NULL DEFAULT NULL COMMENT '排序', 66 `sort` tinyint NULL DEFAULT NULL COMMENT '排序',
67 `memo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '描述', 67 `memo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '描述',
68 PRIMARY KEY (`id`) USING BTREE 68 PRIMARY KEY (`id`) USING BTREE
69 -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Banner管理'; 69 +) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Banner管理';
70 70
71 -- ---------------------------- 71 -- ----------------------------
72 -- Records of market_banner 72 -- Records of market_banner
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java
@@ -19,6 +19,8 @@ public interface ErrorCodeConstants { @@ -19,6 +19,8 @@ public interface ErrorCodeConstants {
19 19
20 // ========== 商品品牌相关编号 1008002000 ========== 20 // ========== 商品品牌相关编号 1008002000 ==========
21 ErrorCode BRAND_NOT_EXISTS = new ErrorCode(1008002000, "品牌不存在"); 21 ErrorCode BRAND_NOT_EXISTS = new ErrorCode(1008002000, "品牌不存在");
  22 + ErrorCode BRAND_DISABLED = new ErrorCode(1008002001, "品牌不存在");
  23 + ErrorCode BRAND_NAME_EXISTS = new ErrorCode(1008002002, "品牌名称已存在");
22 24
23 // ========== 商品规格名称 1008003000 ========== 25 // ========== 商品规格名称 1008003000 ==========
24 ErrorCode PROPERTY_NOT_EXISTS = new ErrorCode(1008003000, "规格名称不存在"); 26 ErrorCode PROPERTY_NOT_EXISTS = new ErrorCode(1008003000, "规格名称不存在");
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/ProductBrandController.java
@@ -33,7 +33,7 @@ public class ProductBrandController { @@ -33,7 +33,7 @@ public class ProductBrandController {
33 @ApiOperation("创建品牌") 33 @ApiOperation("创建品牌")
34 @PreAuthorize("@ss.hasPermission('product:brand:create')") 34 @PreAuthorize("@ss.hasPermission('product:brand:create')")
35 public CommonResult<Long> createBrand(@Valid @RequestBody ProductBrandCreateReqVO createReqVO) { 35 public CommonResult<Long> createBrand(@Valid @RequestBody ProductBrandCreateReqVO createReqVO) {
36 - return success(brandService.createProductBrand(createReqVO)); 36 + return success(brandService.createBrand(createReqVO));
37 } 37 }
38 38
39 @PutMapping("/update") 39 @PutMapping("/update")
@@ -73,7 +73,7 @@ public class ProductBrandController { @@ -73,7 +73,7 @@ public class ProductBrandController {
73 @GetMapping("/list") 73 @GetMapping("/list")
74 @ApiOperation("获得品牌列表") 74 @ApiOperation("获得品牌列表")
75 @PreAuthorize("@ss.hasPermission('product:brand:query')") 75 @PreAuthorize("@ss.hasPermission('product:brand:query')")
76 - public CommonResult<List<ProductBrandRespVO>> getProductCategoryList(@Valid ProductBrandListReqVO listVO) { 76 + public CommonResult<List<ProductBrandRespVO>> getBrandList(@Valid ProductBrandListReqVO listVO) {
77 List<ProductBrandDO> list = brandService.getBrandList(listVO); 77 List<ProductBrandDO> list = brandService.getBrandList(listVO);
78 list.sort(Comparator.comparing(ProductBrandDO::getSort)); 78 list.sort(Comparator.comparing(ProductBrandDO::getSort));
79 return success(ProductBrandConvert.INSTANCE.convertList(list)); 79 return success(ProductBrandConvert.INSTANCE.convertList(list));
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/vo/ProductBrandBaseVO.java
@@ -20,7 +20,8 @@ public class ProductBrandBaseVO { @@ -20,7 +20,8 @@ public class ProductBrandBaseVO {
20 @NotNull(message = "品牌图片不能为空") 20 @NotNull(message = "品牌图片不能为空")
21 private String picUrl; 21 private String picUrl;
22 22
23 - @ApiModelProperty(value = "品牌排序", example = "1") 23 + @ApiModelProperty(value = "品牌排序", required = true, example = "1")
  24 + @NotNull(message = "品牌排序不能为空")
24 private Integer sort; 25 private Integer sort;
25 26
26 @ApiModelProperty(value = "品牌描述", example = "描述") 27 @ApiModelProperty(value = "品牌描述", example = "描述")
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/vo/ProductBrandPageReqVO.java
@@ -21,7 +21,7 @@ public class ProductBrandPageReqVO extends PageParam { @@ -21,7 +21,7 @@ public class ProductBrandPageReqVO extends PageParam {
21 @ApiModelProperty(value = "品牌名称", example = "芋道") 21 @ApiModelProperty(value = "品牌名称", example = "芋道")
22 private String name; 22 private String name;
23 23
24 - @ApiModelProperty(value = "状态", example = "0") 24 + @ApiModelProperty(value = "状态", example = "0", notes = "参考 CommonStatusEnum 枚举")
25 private Integer status; 25 private Integer status;
26 26
27 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) 27 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/category/ProductCategoryController.java
@@ -34,14 +34,14 @@ public class ProductCategoryController { @@ -34,14 +34,14 @@ public class ProductCategoryController {
34 @PostMapping("/create") 34 @PostMapping("/create")
35 @ApiOperation("创建商品分类") 35 @ApiOperation("创建商品分类")
36 @PreAuthorize("@ss.hasPermission('product:category:create')") 36 @PreAuthorize("@ss.hasPermission('product:category:create')")
37 - public CommonResult<Long> createProductCategory(@Valid @RequestBody ProductCategoryCreateReqVO createReqVO) { 37 + public CommonResult<Long> createCategory(@Valid @RequestBody ProductCategoryCreateReqVO createReqVO) {
38 return success(categoryService.createCategory(createReqVO)); 38 return success(categoryService.createCategory(createReqVO));
39 } 39 }
40 40
41 @PutMapping("/update") 41 @PutMapping("/update")
42 @ApiOperation("更新商品分类") 42 @ApiOperation("更新商品分类")
43 @PreAuthorize("@ss.hasPermission('product:category:update')") 43 @PreAuthorize("@ss.hasPermission('product:category:update')")
44 - public CommonResult<Boolean> updateProductCategory(@Valid @RequestBody ProductCategoryUpdateReqVO updateReqVO) { 44 + public CommonResult<Boolean> updateCategory(@Valid @RequestBody ProductCategoryUpdateReqVO updateReqVO) {
45 categoryService.updateCategory(updateReqVO); 45 categoryService.updateCategory(updateReqVO);
46 return success(true); 46 return success(true);
47 } 47 }
@@ -50,7 +50,7 @@ public class ProductCategoryController { @@ -50,7 +50,7 @@ public class ProductCategoryController {
50 @ApiOperation("删除商品分类") 50 @ApiOperation("删除商品分类")
51 @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) 51 @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
52 @PreAuthorize("@ss.hasPermission('product:category:delete')") 52 @PreAuthorize("@ss.hasPermission('product:category:delete')")
53 - public CommonResult<Boolean> deleteProductCategory(@RequestParam("id") Long id) { 53 + public CommonResult<Boolean> deleteCategory(@RequestParam("id") Long id) {
54 categoryService.deleteCategory(id); 54 categoryService.deleteCategory(id);
55 return success(true); 55 return success(true);
56 } 56 }
@@ -59,7 +59,7 @@ public class ProductCategoryController { @@ -59,7 +59,7 @@ public class ProductCategoryController {
59 @ApiOperation("获得商品分类") 59 @ApiOperation("获得商品分类")
60 @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) 60 @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
61 @PreAuthorize("@ss.hasPermission('product:category:query')") 61 @PreAuthorize("@ss.hasPermission('product:category:query')")
62 - public CommonResult<ProductCategoryRespVO> getProductCategory(@RequestParam("id") Long id) { 62 + public CommonResult<ProductCategoryRespVO> getCategory(@RequestParam("id") Long id) {
63 ProductCategoryDO category = categoryService.getCategory(id); 63 ProductCategoryDO category = categoryService.getCategory(id);
64 return success(ProductCategoryConvert.INSTANCE.convert(category)); 64 return success(ProductCategoryConvert.INSTANCE.convert(category));
65 } 65 }
@@ -67,7 +67,7 @@ public class ProductCategoryController { @@ -67,7 +67,7 @@ public class ProductCategoryController {
67 @GetMapping("/list") 67 @GetMapping("/list")
68 @ApiOperation("获得商品分类列表") 68 @ApiOperation("获得商品分类列表")
69 @PreAuthorize("@ss.hasPermission('product:category:query')") 69 @PreAuthorize("@ss.hasPermission('product:category:query')")
70 - public CommonResult<List<ProductCategoryRespVO>> getProductCategoryList(@Valid ProductCategoryListReqVO treeListReqVO) { 70 + public CommonResult<List<ProductCategoryRespVO>> getCategoryList(@Valid ProductCategoryListReqVO treeListReqVO) {
71 List<ProductCategoryDO> list = categoryService.getEnableCategoryList(treeListReqVO); 71 List<ProductCategoryDO> list = categoryService.getEnableCategoryList(treeListReqVO);
72 list.sort(Comparator.comparing(ProductCategoryDO::getSort)); 72 list.sort(Comparator.comparing(ProductCategoryDO::getSort));
73 return success(ProductCategoryConvert.INSTANCE.convertList(list)); 73 return success(ProductCategoryConvert.INSTANCE.convertList(list));
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/brand/ProductBrandMapper.java
@@ -27,4 +27,8 @@ public interface ProductBrandMapper extends BaseMapperX&lt;ProductBrandDO&gt; { @@ -27,4 +27,8 @@ public interface ProductBrandMapper extends BaseMapperX&lt;ProductBrandDO&gt; {
27 .likeIfPresent(ProductBrandDO::getName, reqVO.getName())); 27 .likeIfPresent(ProductBrandDO::getName, reqVO.getName()));
28 } 28 }
29 29
  30 + default ProductBrandDO selectByName(String name) {
  31 + return selectOne(ProductBrandDO::getName, name);
  32 + }
  33 +
30 } 34 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/brand/ProductBrandService.java
@@ -21,7 +21,7 @@ public interface ProductBrandService { @@ -21,7 +21,7 @@ public interface ProductBrandService {
21 * @param createReqVO 创建信息 21 * @param createReqVO 创建信息
22 * @return 编号 22 * @return 编号
23 */ 23 */
24 - Long createProductBrand(@Valid ProductBrandCreateReqVO createReqVO); 24 + Long createBrand(@Valid ProductBrandCreateReqVO createReqVO);
25 25
26 /** 26 /**
27 * 更新品牌 27 * 更新品牌
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/brand/ProductBrandServiceImpl.java
1 package cn.iocoder.yudao.module.product.service.brand; 1 package cn.iocoder.yudao.module.product.service.brand;
2 2
  3 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandCreateReqVO; 5 import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandCreateReqVO;
5 import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandListReqVO; 6 import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandListReqVO;
@@ -8,6 +9,7 @@ import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandUpd @@ -8,6 +9,7 @@ import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandUpd
8 import cn.iocoder.yudao.module.product.convert.brand.ProductBrandConvert; 9 import cn.iocoder.yudao.module.product.convert.brand.ProductBrandConvert;
9 import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO; 10 import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO;
10 import cn.iocoder.yudao.module.product.dal.mysql.brand.ProductBrandMapper; 11 import cn.iocoder.yudao.module.product.dal.mysql.brand.ProductBrandMapper;
  12 +import com.google.common.annotations.VisibleForTesting;
11 import org.springframework.stereotype.Service; 13 import org.springframework.stereotype.Service;
12 import org.springframework.validation.annotation.Validated; 14 import org.springframework.validation.annotation.Validated;
13 15
@@ -16,7 +18,7 @@ import java.util.Collection; @@ -16,7 +18,7 @@ import java.util.Collection;
16 import java.util.List; 18 import java.util.List;
17 19
18 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 20 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
19 -import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.BRAND_NOT_EXISTS; 21 +import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*;
20 22
21 /** 23 /**
22 * 品牌 Service 实现类 24 * 品牌 Service 实现类
@@ -31,7 +33,10 @@ public class ProductBrandServiceImpl implements ProductBrandService { @@ -31,7 +33,10 @@ public class ProductBrandServiceImpl implements ProductBrandService {
31 private ProductBrandMapper brandMapper; 33 private ProductBrandMapper brandMapper;
32 34
33 @Override 35 @Override
34 - public Long createProductBrand(ProductBrandCreateReqVO createReqVO) { 36 + public Long createBrand(ProductBrandCreateReqVO createReqVO) {
  37 + // 校验
  38 + validateBrandNameUnique(null, createReqVO.getName());
  39 +
35 // 插入 40 // 插入
36 ProductBrandDO brand = ProductBrandConvert.INSTANCE.convert(createReqVO); 41 ProductBrandDO brand = ProductBrandConvert.INSTANCE.convert(createReqVO);
37 brandMapper.insert(brand); 42 brandMapper.insert(brand);
@@ -43,6 +48,7 @@ public class ProductBrandServiceImpl implements ProductBrandService { @@ -43,6 +48,7 @@ public class ProductBrandServiceImpl implements ProductBrandService {
43 public void updateBrand(ProductBrandUpdateReqVO updateReqVO) { 48 public void updateBrand(ProductBrandUpdateReqVO updateReqVO) {
44 // 校验存在 49 // 校验存在
45 validateBrandExists(updateReqVO.getId()); 50 validateBrandExists(updateReqVO.getId());
  51 + validateBrandNameUnique(updateReqVO.getId(), updateReqVO.getName());
46 // 更新 52 // 更新
47 ProductBrandDO updateObj = ProductBrandConvert.INSTANCE.convert(updateReqVO); 53 ProductBrandDO updateObj = ProductBrandConvert.INSTANCE.convert(updateReqVO);
48 brandMapper.updateById(updateObj); 54 brandMapper.updateById(updateObj);
@@ -51,7 +57,7 @@ public class ProductBrandServiceImpl implements ProductBrandService { @@ -51,7 +57,7 @@ public class ProductBrandServiceImpl implements ProductBrandService {
51 @Override 57 @Override
52 public void deleteBrand(Long id) { 58 public void deleteBrand(Long id) {
53 // 校验存在 59 // 校验存在
54 - this.validateBrandExists(id); 60 + validateBrandExists(id);
55 // 删除 61 // 删除
56 brandMapper.deleteById(id); 62 brandMapper.deleteById(id);
57 } 63 }
@@ -62,6 +68,21 @@ public class ProductBrandServiceImpl implements ProductBrandService { @@ -62,6 +68,21 @@ public class ProductBrandServiceImpl implements ProductBrandService {
62 } 68 }
63 } 69 }
64 70
  71 + @VisibleForTesting
  72 + public void validateBrandNameUnique(Long id, String name) {
  73 + ProductBrandDO brand = brandMapper.selectByName(name);
  74 + if (brand == null) {
  75 + return;
  76 + }
  77 + // 如果 id 为空,说明不用比较是否为相同 id 的字典类型
  78 + if (id == null) {
  79 + throw exception(BRAND_NAME_EXISTS);
  80 + }
  81 + if (!brand.getId().equals(id)) {
  82 + throw exception(BRAND_NAME_EXISTS);
  83 + }
  84 + }
  85 +
65 @Override 86 @Override
66 public ProductBrandDO getBrand(Long id) { 87 public ProductBrandDO getBrand(Long id) {
67 return brandMapper.selectById(id); 88 return brandMapper.selectById(id);
@@ -79,9 +100,13 @@ public class ProductBrandServiceImpl implements ProductBrandService { @@ -79,9 +100,13 @@ public class ProductBrandServiceImpl implements ProductBrandService {
79 100
80 @Override 101 @Override
81 public void validateProductBrand(Long id) { 102 public void validateProductBrand(Long id) {
82 - if(getBrand(id) == null){ 103 + ProductBrandDO brand = brandMapper.selectById(id);
  104 + if (brand == null) {
83 throw exception(BRAND_NOT_EXISTS); 105 throw exception(BRAND_NOT_EXISTS);
84 } 106 }
  107 + if (brand.getStatus().equals(CommonStatusEnum.DISABLE.getStatus())) {
  108 + throw exception(BRAND_DISABLED);
  109 + }
85 } 110 }
86 111
87 @Override 112 @Override
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/category/ProductCategoryServiceImpl.java
@@ -63,7 +63,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { @@ -63,7 +63,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
63 if (productCategoryMapper.selectCountByParentId(id) > 0) { 63 if (productCategoryMapper.selectCountByParentId(id) > 0) {
64 throw exception(CATEGORY_EXISTS_CHILDREN); 64 throw exception(CATEGORY_EXISTS_CHILDREN);
65 } 65 }
66 - 66 + // TODO 芋艿 补充只有不存在商品才可以删除
67 // 删除 67 // 删除
68 productCategoryMapper.deleteById(id); 68 productCategoryMapper.deleteById(id);
69 } 69 }
@@ -94,8 +94,8 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { @@ -94,8 +94,8 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
94 @Override 94 @Override
95 public void validateCategoryLevel(Long id) { 95 public void validateCategoryLevel(Long id) {
96 Integer level = getProductCategoryLevel(id, 1); 96 Integer level = getProductCategoryLevel(id, 1);
97 - if(level < 3){  
98 - throw exception(CATEGORY_LEVEL_ERROR); 97 + if (level < 3){
  98 + throw exception(CATEGORY_LEVEL_ERROR);
99 } 99 }
100 } 100 }
101 101
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/brand/ProductBrandServiceImplTest.java
@@ -43,7 +43,7 @@ public class ProductBrandServiceImplTest extends BaseDbUnitTest { @@ -43,7 +43,7 @@ public class ProductBrandServiceImplTest extends BaseDbUnitTest {
43 ProductBrandCreateReqVO reqVO = randomPojo(ProductBrandCreateReqVO.class); 43 ProductBrandCreateReqVO reqVO = randomPojo(ProductBrandCreateReqVO.class);
44 44
45 // 调用 45 // 调用
46 - Long brandId = brandService.createProductBrand(reqVO); 46 + Long brandId = brandService.createBrand(reqVO);
47 // 断言 47 // 断言
48 assertNotNull(brandId); 48 assertNotNull(brandId);
49 // 校验记录的属性是否正确 49 // 校验记录的属性是否正确
yudao-server/src/main/resources/application-local.yaml
@@ -45,7 +45,7 @@ spring: @@ -45,7 +45,7 @@ spring:
45 datasource: 45 datasource:
46 master: 46 master:
47 name: ruoyi-vue-pro 47 name: ruoyi-vue-pro
48 - url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 48 + url: jdbc:mysql://139.9.196.247:3306/${spring.datasource.dynamic.datasource.master.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
49 # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 49 # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
50 # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例 50 # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
51 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 51 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
@@ -56,7 +56,7 @@ spring: @@ -56,7 +56,7 @@ spring:
56 # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W 56 # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
57 slave: # 模拟从库,可根据自己需要修改 57 slave: # 模拟从库,可根据自己需要修改
58 name: ruoyi-vue-pro 58 name: ruoyi-vue-pro
59 - url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 59 + url: jdbc:mysql://139.9.196.247:3306/${spring.datasource.dynamic.datasource.slave.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
60 # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 60 # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
61 # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例 61 # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
62 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 62 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
@@ -68,10 +68,10 @@ spring: @@ -68,10 +68,10 @@ spring:
68 68
69 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 69 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
70 redis: 70 redis:
71 - host: 127.0.0.1 # 地址 71 + host: 139.9.196.247 # 地址
72 port: 6379 # 端口 72 port: 6379 # 端口
73 database: 0 # 数据库索引 73 database: 0 # 数据库索引
74 -# password: 123456 # 密码,建议生产环境开启 74 + password: 123456 # 密码,建议生产环境开启
75 75
76 jasypt: 76 jasypt:
77 encryptor: 77 encryptor:
yudao-ui-admin/src/views/mall/product/category/index.vue
@@ -61,10 +61,8 @@ @@ -61,10 +61,8 @@
61 <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> 61 <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
62 <el-form ref="form" :model="form" :rules="rules" label-width="80px"> 62 <el-form ref="form" :model="form" :rules="rules" label-width="80px">
63 <el-form-item label="上级分类" prop="parentId"> 63 <el-form-item label="上级分类" prop="parentId">
64 - <Treeselect v-model="form.parentId" :options="parentCategoryOptions" :normalizer="normalizer"  
65 - :show-count="true"  
66 - :defaultExpandLevel="1"  
67 - placeholder="上级分类"/> 64 + <Treeselect v-model="form.parentId" :options="parentCategoryOptions" :normalizer="normalizer" :show-count="true"
  65 + :defaultExpandLevel="1" placeholder="上级分类"/>
68 </el-form-item> 66 </el-form-item>
69 <el-form-item label="分类名称" prop="name"> 67 <el-form-item label="分类名称" prop="name">
70 <el-input v-model="form.name" placeholder="请输入分类名称"/> 68 <el-input v-model="form.name" placeholder="请输入分类名称"/>