diff --git a/README.md b/README.md index 86b8317a3..9d37689d1 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ ## 🐶 新手必读 * 演示地址【Vue3 + element-plus】: +* 演示地址【Vue3 + vben(ant-design-vue)】: * 演示地址【Vue2 + element-ui】: * 启动文档: * 视频教程: @@ -24,8 +25,8 @@ ![架构图](https://static.iocoder.cn/ruoyi-vue-pro-architecture.png?imageView2/2/format/webp) -* 管理后台的 Vue3 版本采用 [vue-element-plus-admin](https://gitee.com/kailong110120130/vue-element-plus-admin) ,Vue2 版本采用 [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) -* 管理后台的移动端采用 [uni-app](https://github.com/dcloudio/uni-app) 方案,一份代码多终端适配,同时支持 APP、小程序、H5! +* 管理后台的电脑端:Vue3 提供 [element-plus](https://gitee.com/yudaocode/yudao-ui-admin-vue3)、[vben(ant-design-vue)](https://gitee.com/yudaocode/yudao-ui-admin-vben) 两个版本,Vue2 提供 [element-ui](https://gitee.com/zhijiantianya/ruoyi-vue-pro/tree/master/yudao-ui-admin) 版本 +* 管理后台的移动端:采用 [uni-app](https://github.com/dcloudio/uni-app) 方案,一份代码多终端适配,同时支持 APP、小程序、H5! * 后端采用 Spring Boot 多模块架构、MySQL + MyBatis Plus、Redis + Redisson * 数据库可使用 MySQL、Oracle、PostgreSQL、SQL Server、MariaDB、国产达梦 DM、TiDB 等 * 权限认证使用 Spring Security & Token & Redis,支持多终端、多种用户的认证系统,支持 SSO 单点登录 diff --git a/pom.xml b/pom.xml index b3651b59a..57989ebcd 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ https://github.com/YunaiV/ruoyi-vue-pro - 1.7.1-snapshot + 1.7.2-snapshot 1.8 ${java.version} diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index b536514a4..abfc23e06 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -14,7 +14,7 @@ https://github.com/YunaiV/ruoyi-vue-pro - 1.7.1-snapshot + 1.7.2-snapshot 2.7.10 diff --git a/yudao-framework/yudao-spring-boot-starter-biz-weixin/src/main/java/cn/iocoder/yudao/framework/weixin/package-info.java b/yudao-framework/yudao-spring-boot-starter-biz-weixin/src/main/java/cn/iocoder/yudao/framework/weixin/package-info.java new file mode 100644 index 000000000..cf15f39bf --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-weixin/src/main/java/cn/iocoder/yudao/framework/weixin/package-info.java @@ -0,0 +1,7 @@ +/** + * 微信拓展 + * 1. 基于 weixin-java-mp 库,对接微信公众号平台。目前主要解决微信公众号的支付场景。 + * 2. 基于 weixin-java-miniapp 库,对接微信小程序。目前主要解决微信小程序的一键登录场景。 + */ +package cn.iocoder.yudao.framework.weixin; + diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm index eaab40703..8bd1c4ee3 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm @@ -1,9 +1,10 @@ import request from '@/config/axios' +#set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}") export interface ${simpleClassName}VO { #foreach ($column in $columns) #if ($column.createOperation || $column.updateOperation) -#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "double" || ${column.javaType.toLowerCase()} == "bigdecimal") +#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "short" || ${column.javaType.toLowerCase()} == "double" || ${column.javaType.toLowerCase()} == "bigdecimal") ${column.javaField}: number #elseif(${column.javaType.toLowerCase()} == "date" || ${column.javaType.toLowerCase()} == "localdatetime") ${column.javaField}: Date @@ -16,30 +17,30 @@ export interface ${simpleClassName}VO { // 查询${table.classComment}列表 export const get${simpleClassName}Page = async (params: ${simpleClassName}PageReqVO) => { - return await request.get({ url: '${baseURL}/page', params }) + return await request.get({ url: `${baseURL}/page`, params }) } // 查询${table.classComment}详情 export const get${simpleClassName} = async (id: number) => { - return await request.get({ url: '${baseURL}/get?id=' + id }) + return await request.get({ url: `${baseURL}/get?id=` + id }) } // 新增${table.classComment} export const create${simpleClassName} = async (data: ${simpleClassName}VO) => { - return await request.post({ url: '${baseURL}/create', data }) + return await request.post({ url: `${baseURL}/create`, data }) } // 修改${table.classComment} export const update${simpleClassName} = async (data: ${simpleClassName}VO) => { - return await request.put({ url: '${baseURL}/update', data }) + return await request.put({ url: `${baseURL}/update`, data }) } // 删除${table.classComment} export const delete${simpleClassName} = async (id: number) => { - return await request.delete({ url: '${baseURL}/delete?id=' + id }) + return await request.delete({ url: `${baseURL}/delete?id=` + id }) } // 导出${table.classComment} Excel -export const export${simpleClassName}Api = async (params) => { - return await request.download({ url: '${baseURL}/export-excel', params }) +export const export${simpleClassName} = async (params) => { + return await request.download({ url: `${baseURL}/export-excel`, params }) } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/form.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/form.vue.vm index 99cce39f2..6604263ea 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/form.vue.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/form.vue.vm @@ -102,7 +102,7 @@ diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm index f396dde32..58bc69bc7 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm @@ -66,7 +66,7 @@ cn.iocoder.boot yudao-spring-boot-starter-biz-operatelog + cn.iocoder.boot yudao-spring-boot-starter-biz-tenant diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java index 0c203b551..831319ed5 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java @@ -12,7 +12,6 @@ import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueServ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; -import oracle.jdbc.proxy.annotation.Post; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -85,7 +84,8 @@ public class ProductPropertyController { @PostMapping("/get-value-list") @Operation(summary = "获得属性项列表") @PreAuthorize("@ss.hasPermission('product:property:query')") - public CommonResult> getPropertyAndValueList(@Valid @RequestBody ProductPropertyListReqVO listReqVO) { + public CommonResult> getPropertyAndValueList( + @Valid @RequestBody ProductPropertyListReqVO listReqVO) { // 查询属性项 List keys = productPropertyService.getPropertyList(listReqVO); if (CollUtil.isEmpty(keys)) { diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyListReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyListReqVO.java index 44935147c..e366864eb 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyListReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyListReqVO.java @@ -4,7 +4,6 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.ToString; -import javax.validation.constraints.NotEmpty; import java.util.List; @Schema(description = "管理后台 - 属性项 List Request VO") @@ -15,6 +14,8 @@ public class ProductPropertyListReqVO { @Schema(description = "属性名称", example = "颜色") private String name; - @Schema(description = "属性ids", example = "1,2") + // TODO @puhui999:这个查询条件的作用是啥呀? + @Schema(description = "属性编号的数组", example = "1,2") private List propertyIds; + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java index dde623b50..4cc258082 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java @@ -1,11 +1,7 @@ package cn.iocoder.yudao.module.product.controller.admin.sku.vo; -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; -import cn.iocoder.yudao.framework.common.validation.InEnum; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; @@ -50,6 +46,7 @@ public class ProductSkuBaseVO { @Schema(description = "商品体积", example = "1024") // 单位:m^3 平米 private Double volume; + // TODO @pitui999:注释可以去掉,VO 使用 @Schema 作为注释 /** * 一级分销的佣金,单位:分 */ diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateOrUpdateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateOrUpdateReqVO.java index 54de91cf1..a1253ca26 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateOrUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateOrUpdateReqVO.java @@ -11,6 +11,7 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class ProductSkuCreateOrUpdateReqVO extends ProductSkuBaseVO { + @Schema(description = "商品属性") @Data @AllArgsConstructor diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java index 11bf4a734..815761615 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java @@ -4,12 +4,8 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import javax.validation.constraints.NotNull; -import java.time.LocalDateTime; import java.util.List; -/** - * @author HUIHUI - */ @Schema(description = "管理后台 - 商品 SKU Response VO") @Data @EqualsAndHashCode(callSuper = true) @@ -29,13 +25,17 @@ public class ProductSkuRespVO extends ProductSkuBaseVO { @NotNull(message = "属性编号不能为空") private Long propertyId; + // TODO @puhui999:propertyName 是不是也返回下 + @Schema(description = "属性值编号", required = true, example = "1024") @NotNull(message = "属性值编号不能为空") private Long valueId; @Schema(description = "属性值", example = "1024") private String valueName; + } + /** * 属性数组 */ diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java index 3a4923bbe..698681856 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java @@ -3,12 +3,9 @@ package cn.iocoder.yudao.module.product.controller.admin.spu; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; -import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; -import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService; -import cn.iocoder.yudao.module.product.service.property.bo.ProductPropertyValueDetailRespBO; import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; import io.swagger.v3.oas.annotations.Operation; @@ -23,9 +20,7 @@ import javax.validation.Valid; import java.util.List; import java.util.Map; -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SPU_NOT_EXISTS; @Tag(name = "管理后台 - 商品 SPU") @RestController @@ -94,6 +89,8 @@ public class ProductSpuController { public CommonResult> getSpuPage(@Valid ProductSpuPageReqVO pageVO) { return success(ProductSpuConvert.INSTANCE.convertPage(productSpuService.getSpuPage(pageVO))); } + + // TODO @tuihui999:get-count;另外,url 使用 - 拆分 @GetMapping("/tabsCount") @Operation(summary = "获得商品 SPU tabsCount") @PreAuthorize("@ss.hasPermission('product:spu:query')") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java index 251b4be47..5a0a64ef3 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java @@ -1,13 +1,5 @@ package cn.iocoder.yudao.module.product.controller.admin.spu.vo; -import cn.iocoder.yudao.framework.common.validation.InEnum; -import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO; -import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; -import cn.iocoder.yudao.module.product.dal.dataobject.delivery.DeliveryTemplateDO; -import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; -import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -116,5 +108,4 @@ public class ProductSpuBaseVO { @Schema(description = "虚拟销量", required = true, example = "芋道") private Integer virtualSalesCount; - } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java index 4672911ff..51ea5d38a 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java @@ -1,14 +1,11 @@ package cn.iocoder.yudao.module.product.controller.admin.spu.vo; -import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueDetailRespVO; -import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuBaseVO; import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuRespVO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import javax.validation.constraints.NotNull; import java.util.List; @Schema(description = "管理后台 - 商品 SPU 详细 Response VO") // 包括关联的 SKU 等信息 @@ -19,6 +16,7 @@ public class ProductSpuDetailRespVO extends ProductSpuBaseVO { @Schema(description = "商品编号", example = "1") private Long id; + // ========== SKU 相关字段 ========= @Schema(description = "SKU 数组", example = "1") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageReqVO.java index cee193637..9c3b51e21 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageReqVO.java @@ -20,6 +20,7 @@ public class ProductSpuPageReqVO extends PageParam { @Schema(description = "商品名称", example = "yutou") private String name; + // TODO @puhui999:加下 @InEnum 校验 @Schema(description = "前端请求的tab类型", example = "1") private Integer tabType; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageRespVO.java index 0517cd41c..83933ebdb 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageRespVO.java @@ -1,15 +1,15 @@ package cn.iocoder.yudao.module.product.controller.admin.spu.vo; -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.time.LocalDateTime; +// TODO @puhui999:可以直接继承 ProductSpuRespVO 么?一般情况下,多返回一些字段问题不大的;另外,是不是使用 ProductSpuRespVO 替代 @Schema(description = "管理后台 - 商品 SPU 分页 response VO") @Data public class ProductSpuPageRespVO { + @Schema(description = "spuId", example = "1") private Long id; @Schema(description = "商品封面图", example = "1") @@ -28,4 +28,5 @@ public class ProductSpuPageRespVO { private LocalDateTime createTime; @Schema(description = "商品状态", example = "1") private Integer status; + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/AppFavoriteController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/AppFavoriteController.java index 385cde3ec..1b085e144 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/AppFavoriteController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/AppFavoriteController.java @@ -1,27 +1,22 @@ package cn.iocoder.yudao.module.product.controller.app.favorite; -import cn.hutool.core.lang.Assert; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoritePageReqVO; import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteReqVO; -import cn.iocoder.yudao.module.product.service.favorite.ProductFavoriteService; import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteRespVO; +import cn.iocoder.yudao.module.product.service.favorite.ProductFavoriteService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; -import java.util.Objects; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -import static cn.iocoder.yudao.module.product.enums.favorite.ProductFavoriteTypeEnum.COLLECT; +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; -/** - * @author jason - */ -@Tag(name = "用户 APP - 喜爱商品") +@Tag(name = "用户 APP - 商品收藏") @RestController @RequestMapping("/product/favorite") public class AppFavoriteController { @@ -29,23 +24,31 @@ public class AppFavoriteController { @Resource private ProductFavoriteService productFavoriteService; - @PostMapping(value = "/collect") + @PostMapping(value = "/create") @Operation(summary = "商品收藏") - public CommonResult collect(@RequestBody @Valid AppFavoriteReqVO reqVO) { - Assert.isTrue(Objects.equals(COLLECT.getType(), reqVO.getType()), "参数type 不匹配"); - return success(productFavoriteService.collect(reqVO)); + public CommonResult create(@RequestBody @Valid AppFavoriteReqVO reqVO) { + Long loginUserId = getLoginUserId(); + return success(productFavoriteService.create(loginUserId, reqVO)); } - @PostMapping(value = "/cancelCollect") + @DeleteMapping(value = "/delete") @Operation(summary = "取消商品收藏(通过商品详情)") - public CommonResult cancelCollect(@RequestBody @Valid AppFavoriteReqVO reqVO) { - Assert.isTrue(Objects.equals(COLLECT.getType(), reqVO.getType()), "参数type 不匹配"); - return success(productFavoriteService.cancelCollect(reqVO)); + public CommonResult delete(@RequestBody @Valid AppFavoriteReqVO reqVO) { + Long loginUserId = getLoginUserId(); + return success(productFavoriteService.delete(loginUserId,reqVO)); } - @GetMapping(value = "/collectList") - @Operation(summary = "商品收藏列表") - public CommonResult> pageCollectList(AppFavoritePageReqVO reqVO) { - return success(productFavoriteService.pageCollectList(reqVO)); + @GetMapping(value = "/page") + @Operation(summary = "分页获取商品收藏列表") + public CommonResult> page(AppFavoritePageReqVO reqVO) { + Long userId = getLoginUserId(); + return success(productFavoriteService.page(userId,reqVO)); + } + + @GetMapping(value = "/checkFavorite") + @Operation(summary = "检查是否收藏过商品") + public CommonResult checkFavorite(AppFavoriteReqVO reqVO) { + Long userId = getLoginUserId(); + return success(productFavoriteService.checkFavorite(userId,reqVO)); } } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoritePageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoritePageReqVO.java index ef68cb736..3ca8b6da6 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoritePageReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoritePageReqVO.java @@ -10,15 +10,13 @@ import javax.validation.constraints.NotNull; import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; -/** - * @author jason - */ -@Schema(description = "用户APP - 喜爱商品分页查询 Request VO") +@Schema(description = "用户APP - 商品收藏分页查询 Request VO") @Data public class AppFavoritePageReqVO extends PageParam { - @Schema(description = "类型 1:收藏 2:点赞", requiredMode = REQUIRED, example = "1") + @Schema(description = "类型", requiredMode = REQUIRED, example = "1") @NotNull(message = "类型不能为空") @InEnum(ProductFavoriteTypeEnum.class) private Integer type; + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteReqVO.java index b611922cc..292750a7b 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteReqVO.java @@ -9,21 +9,17 @@ import javax.validation.constraints.NotNull; import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; - - -/** - * @author jason - */ -@Schema(description = "用户APP - 喜爱商品创建 Request VO") +@Schema(description = "用户 APP - 商品收藏 Request VO") @Data public class AppFavoriteReqVO { - @Schema(description = "商品SPU编号", requiredMode = REQUIRED, example = "29502") - @NotNull(message = "商品SPU编号不能为空") + @Schema(description = "商品 SPU 编号", requiredMode = REQUIRED, example = "29502") + @NotNull(message = "商品 SPU 编号不能为空") private Long spuId; - @Schema(description = "类型 1:收藏 2:点赞", requiredMode = REQUIRED, example = "1") + @Schema(description = "类型", requiredMode = REQUIRED, example = "1") @NotNull(message = "类型不能为空") @InEnum(ProductFavoriteTypeEnum.class) private Integer type; + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteRespVO.java index b15c49a62..da6937c5b 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteRespVO.java @@ -1,23 +1,25 @@ package cn.iocoder.yudao.module.product.controller.app.favorite.vo; -import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -/** - * @author jason - */ -@Schema(description = "用户APP - 喜爱商品 Response VO") +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + +@Schema(description = "用户APP - 商品收藏 Response VO") @Data public class AppFavoriteRespVO { - @Schema(description = "编号", example = "1") + @Schema(description = "编号", requiredMode = REQUIRED, example = "1") private Long id; - @Schema(description = "商品SPU编号", example = "29502") + @Schema(description = "商品 SPU 编号", requiredMode = REQUIRED, example = "29502") private Long spuId; - @Schema(description = "商品SPU名称", example = "赵六") + @Schema(description = "类型", requiredMode = REQUIRED, example = "1") + private Integer type; + + // ========== 商品相关字段 ========== + @Schema(description = "商品 SPU 名称", example = "赵六") private String spuName; @Schema(description = "商品封面图", example = "https://domain/pic.png") @@ -26,6 +28,4 @@ public class AppFavoriteRespVO { @Schema(description = "商品单价", example = "100") private Integer price; - @Schema(description = "类型 1:收藏 2:点赞", example = "1") - private Integer type; } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/favorite/ProductFavoriteConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/favorite/ProductFavoriteConvert.java index 04b6dc56a..0d9e5e809 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/favorite/ProductFavoriteConvert.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/favorite/ProductFavoriteConvert.java @@ -1,19 +1,20 @@ package cn.iocoder.yudao.module.product.convert.favorite; import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteReqVO; +import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteRespVO; import cn.iocoder.yudao.module.product.dal.dataobject.favorite.ProductFavoriteDO; +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; import org.mapstruct.Mapper; +import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; -/** - * 喜爱商品 Convert - * - * @author jason - */ @Mapper public interface ProductFavoriteConvert { ProductFavoriteConvert INSTANCE = Mappers.getMapper(ProductFavoriteConvert.class); ProductFavoriteDO convert(Long userId, AppFavoriteReqVO reqVO); + @Mapping(target = "id", source = "favoriteDO.id") + @Mapping(target = "spuName", source = "spuDO.name") + AppFavoriteRespVO convert(ProductSpuDO spuDO, ProductFavoriteDO favoriteDO); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java index dc4198186..79091974b 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java @@ -47,7 +47,7 @@ public interface ProductSpuConvert { List convertList02(List list); - + // TODO @puhui999:是不是可以删除啦 default ProductSpuDetailRespVO convert03(ProductSpuDO spu, List skus, List propertyValues) { ProductSpuDetailRespVO spuVO = convert03(spu); diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/favorite/ProductFavoriteDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/favorite/ProductFavoriteDO.java index 20b712aff..177087646 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/favorite/ProductFavoriteDO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/favorite/ProductFavoriteDO.java @@ -1,7 +1,8 @@ package cn.iocoder.yudao.module.product.dal.dataobject.favorite; -import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; +import cn.iocoder.yudao.module.product.enums.favorite.ProductFavoriteTypeEnum; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -20,7 +21,7 @@ import lombok.*; @Builder @NoArgsConstructor @AllArgsConstructor -public class ProductFavoriteDO extends TenantBaseDO { +public class ProductFavoriteDO extends BaseDO { /** * 编号,主键自增 @@ -40,7 +41,9 @@ public class ProductFavoriteDO extends TenantBaseDO { */ private Long spuId; /** - * 类型 1 收藏;2 点赞 + * 类型 + * + * 枚举 {@link ProductFavoriteTypeEnum} */ private Integer type; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java index bf631c420..6da6af9fe 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java @@ -1,6 +1,5 @@ package cn.iocoder.yudao.module.product.dal.dataobject.property; -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableId; @@ -20,7 +19,7 @@ import lombok.*; @Builder @NoArgsConstructor @AllArgsConstructor -public class ProductPropertyDO extends TenantBaseDO { +public class ProductPropertyDO extends TenantBaseDO { // TODO @puhui999:这里是不是用 BaseDO 就可以了? /** * 主键 diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyValueDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyValueDO.java index 4043afc61..be64373a5 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyValueDO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyValueDO.java @@ -1,6 +1,5 @@ package cn.iocoder.yudao.module.product.dal.dataobject.property; -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableId; @@ -21,7 +20,7 @@ import lombok.*; @Builder @NoArgsConstructor @AllArgsConstructor -public class ProductPropertyValueDO extends TenantBaseDO { +public class ProductPropertyValueDO extends TenantBaseDO { // TODO @puhui999:这里是不是用 BaseDO 就可以了? /** * 主键 diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java index 1b6f54ae2..4e6c7f8a1 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java @@ -1,7 +1,6 @@ package cn.iocoder.yudao.module.product.dal.dataobject.sku; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; @@ -28,7 +27,7 @@ import java.util.List; @Builder @NoArgsConstructor @AllArgsConstructor -public class ProductSkuDO extends TenantBaseDO { +public class ProductSkuDO extends TenantBaseDO { // TODO @puhui999:这里是不是用 BaseDO 就可以了? /** * 商品 SKU 编号,自增 @@ -116,7 +115,7 @@ public class ProductSkuDO extends TenantBaseDO { // * 冗余 {@link ProductPropertyDO#getName()} // * // * 注意:每次属性名字发生变化时,需要更新该冗余 - // */ TODO 与已有代码逻辑存在冲突 + // */ TODO @puhui999:与已有代码逻辑存在冲突;芋艿:冲突点是啥呀? //private String propertyName; /** @@ -131,7 +130,7 @@ public class ProductSkuDO extends TenantBaseDO { // * 冗余 {@link ProductPropertyValueDO#getName()} // * // * 注意:每次属性值名字发生变化时,需要更新该冗余 - // */ TODO 与已有代码逻辑存在冲突 + // */ TODO @puhui999:与已有代码逻辑存在冲突;芋艿:冲突点是啥呀? //private String valueName; } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/favorite/ProductFavoriteMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/favorite/ProductFavoriteMapper.java index e9ee46a7f..a9c19026a 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/favorite/ProductFavoriteMapper.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/favorite/ProductFavoriteMapper.java @@ -8,35 +8,31 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; import cn.iocoder.yudao.module.product.dal.dataobject.favorite.ProductFavoriteDO; import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteRespVO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -/** - * 喜爱商品 Mapper - * - * @author jason - */ @Mapper public interface ProductFavoriteMapper extends BaseMapperX { - default ProductFavoriteDO selectByUserAndSpuAndType(Long userId, Long spuId, Integer type){ - Assert.notNull(userId, "the userId argument must not be null"); - Assert.notNull(spuId, "the spuId argument must not be null"); - Assert.notNull(type, "the type argument must not be null"); + default ProductFavoriteDO selectByUserAndSpuAndType(Long userId, Long spuId, Integer type) { + Assert.notNull(userId, "the userId must not be null"); + Assert.notNull(spuId, "the spuId must not be null"); + Assert.notNull(type, "the type must not be null"); return selectOne(new LambdaQueryWrapperX() .eq(ProductFavoriteDO::getUserId, userId) .eq(ProductFavoriteDO::getSpuId, spuId) .eq(ProductFavoriteDO::getType, type)); } - default PageResult selectPageByUserAndType(Long userId, Integer type, PageParam pageParam){ - Page page = MyBatisUtils.buildPage(pageParam); - page = selectFavoriteProductList(page, userId, type); - return new PageResult<>(page.getRecords(), page.getTotal()); + default PageResult selectPageByUserAndType(Long userId, Integer type, PageParam pageParam) { + Assert.notNull(userId, "the userId must not be null"); + Assert.notNull(type, "the type must not be null"); + Assert.notNull(pageParam, "the pageParam must not be null"); + return selectPage(pageParam, new LambdaQueryWrapper() + .eq(ProductFavoriteDO::getUserId, userId) + .eq(ProductFavoriteDO::getType, type) + .orderByDesc(ProductFavoriteDO::getId)); } - - Page selectFavoriteProductList(Page page, - @Param("userId") Long userId, - @Param("type") Integer type); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java index f3101ab4e..ae4389eb2 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java @@ -1,11 +1,9 @@ package cn.iocoder.yudao.module.product.dal.mysql.spu; import cn.hutool.core.util.ObjUtil; -import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuPageReqVO; import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO; import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; @@ -14,24 +12,14 @@ import cn.iocoder.yudao.module.product.enums.spu.ProductSpuTabTypeEnum; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.apache.ibatis.annotations.Mapper; -import java.util.Map; import java.util.Objects; import java.util.Set; -/** - * 商品spu Mapper - * - * @author 芋道源码 - */ @Mapper public interface ProductSpuMapper extends BaseMapperX { - //default PageResult selectPage(ProductSpuPageReqVO reqVO) { - // return selectPage(reqVO, new LambdaQueryWrapperX() - // .likeIfPresent(ProductSpuDO::getName, reqVO.getName()) - // .orderByDesc(ProductSpuDO::getSort)); - //} default PageResult selectPage(ProductSpuPageReqVO reqVO) { + // TODO @puhui999:多个 tab,写 if else 去补条件,可阅读性会好点哈 return selectPage(reqVO, new LambdaQueryWrapperX() // 商品名称 .likeIfPresent(ProductSpuDO::getName, reqVO.getName()) @@ -42,7 +30,7 @@ public interface ProductSpuMapper extends BaseMapperX { .eq(ProductSpuTabTypeEnum.IN_WAREHOUSE.getType().equals(reqVO.getTabType()),ProductSpuDO::getStatus,ProductSpuStatusEnum.DISABLE.getStatus()) // 已售空商品 .eq(ProductSpuTabTypeEnum.SOLD_OUT.getType().equals(reqVO.getTabType()),ProductSpuDO::getStock,0) - // TODO 警戒库存暂时为 10,后期需要使用常量或者数据库配置替换 + // TODO @phuui999:警戒库存暂时为 10,后期需要使用常量或者数据库配置替换 .le(ProductSpuTabTypeEnum.ALERT_STOCK.getType().equals(reqVO.getTabType()),ProductSpuDO::getStock,10) // 回收站 .eq(ProductSpuTabTypeEnum.RECYCLE_BIN.getType().equals(reqVO.getTabType()),ProductSpuDO::getStatus,ProductSpuStatusEnum.RECYCLE.getStatus()) diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/favorite/ProductFavoriteService.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/favorite/ProductFavoriteService.java index c1b85af17..d75cb4a2d 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/favorite/ProductFavoriteService.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/favorite/ProductFavoriteService.java @@ -15,20 +15,31 @@ import javax.validation.Valid; public interface ProductFavoriteService { /** - * 商品收藏 + * 创建商品收藏 + * @param userId 用户id * @param reqVO 请求vo */ - Boolean collect(@Valid AppFavoriteReqVO reqVO); + Boolean create(Long userId, @Valid AppFavoriteReqVO reqVO); /** * 取消商品收藏 (通过商品详情页面) + * @param userId 用户id * @param reqVO 请求vo */ - Boolean cancelCollect(@Valid AppFavoriteReqVO reqVO); + Boolean delete(Long userId, @Valid AppFavoriteReqVO reqVO); /** * 分页查询用户收藏列表 + * @param userId 用户id * @param reqVO 请求 vo */ - PageResult pageCollectList(@Valid AppFavoritePageReqVO reqVO); + PageResult page(Long userId, @Valid AppFavoritePageReqVO reqVO); + + /** + * 检查是否收藏过商品 + * @param userId 用户id + * @param reqVO 请求 vo + * @return true: 已收藏 false: 未收藏 + */ + Boolean checkFavorite(Long userId, @Valid AppFavoriteReqVO reqVO); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/favorite/ProductFavoriteServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/favorite/ProductFavoriteServiceImpl.java index 1b295157c..d2c741045 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/favorite/ProductFavoriteServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/favorite/ProductFavoriteServiceImpl.java @@ -1,62 +1,93 @@ package cn.iocoder.yudao.module.product.service.favorite; +import cn.hutool.core.lang.Assert; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoritePageReqVO; import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteReqVO; import cn.iocoder.yudao.module.product.convert.favorite.ProductFavoriteConvert; import cn.iocoder.yudao.module.product.dal.dataobject.favorite.ProductFavoriteDO; +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; import cn.iocoder.yudao.module.product.dal.mysql.favorite.ProductFavoriteMapper; import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteRespVO; +import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import java.util.Objects; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; -import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.COLLECTION_EXISTS; -import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.COLLECTION_NOT_EXISTS; +import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PRODUCT_FAVORITE_EXISTS; +import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PRODUCT_FAVORITE_NOT_EXISTS; /** - * 喜爱商品 Service 实现类 + * 商品收藏 Service 实现类 * * @author jason */ @Service @Validated public class ProductFavoriteServiceImpl implements ProductFavoriteService { - + @Resource + private ProductSpuService productSpuService; @Resource private ProductFavoriteMapper mapper; @Override - public Boolean collect(@Valid AppFavoriteReqVO reqVO) { - Long userId = getLoginUserId(); + public Boolean create(Long userId, @Valid AppFavoriteReqVO reqVO) { + Assert.notNull(userId, "the userId must not be null"); ProductFavoriteDO favoriteDO = mapper.selectByUserAndSpuAndType(userId, reqVO.getSpuId(), reqVO.getType()); if (Objects.nonNull(favoriteDO)) { - throw exception(COLLECTION_EXISTS); + throw exception(PRODUCT_FAVORITE_EXISTS); } ProductFavoriteDO entity = ProductFavoriteConvert.INSTANCE.convert(userId, reqVO); - int count = mapper.insert(entity); - return count == 1; + mapper.insert(entity); + return Boolean.TRUE; } @Override - public Boolean cancelCollect(@Valid AppFavoriteReqVO reqVO) { - Long loginUserId = getLoginUserId(); - ProductFavoriteDO favoriteDO = mapper.selectByUserAndSpuAndType(loginUserId, reqVO.getSpuId(), reqVO.getType()); + public Boolean delete(Long userId, @Valid AppFavoriteReqVO reqVO) { + Assert.notNull(userId, "the userId must not be null "); + ProductFavoriteDO favoriteDO = mapper.selectByUserAndSpuAndType(userId, reqVO.getSpuId(), reqVO.getType()); if (Objects.isNull(favoriteDO)) { - throw exception(COLLECTION_NOT_EXISTS); + throw exception(PRODUCT_FAVORITE_NOT_EXISTS); } - int count = mapper.deleteById(favoriteDO.getId()); - return count == 1; + mapper.deleteById(favoriteDO.getId()); + return Boolean.TRUE; } @Override - public PageResult pageCollectList(@Valid AppFavoritePageReqVO reqVO) { - Long userId = getLoginUserId(); - return mapper.selectPageByUserAndType(userId, reqVO.getType(), reqVO); + public PageResult page(Long userId, @Valid AppFavoritePageReqVO reqVO) { + Assert.notNull(userId, "the userId must not be null "); + PageResult favorites = mapper.selectPageByUserAndType(userId, reqVO.getType(), reqVO); + if (favorites.getTotal() > 0) { + PageResult pageResult = new PageResult<>(favorites.getTotal()); + List list = favorites.getList(); + //得到商品spu 信息 + List spuIds = CollectionUtils.convertList(list, ProductFavoriteDO::getSpuId); + Map spuMap = CollectionUtils.convertMap(productSpuService.getSpuList(spuIds), ProductSpuDO::getId, val -> val); + List resultList = new ArrayList<>(list.size()); + for (ProductFavoriteDO item : list) { + ProductSpuDO spuDO = spuMap.get(item.getSpuId()); + resultList.add(ProductFavoriteConvert.INSTANCE.convert(spuDO, item)); + } + pageResult.setList(resultList); + return pageResult; + }else { + return PageResult.empty(); + } } + + @Override + public Boolean checkFavorite(Long userId, @Valid AppFavoriteReqVO reqVO) { + Assert.notNull(userId, "the userId must not be null "); + ProductFavoriteDO favoriteDO = mapper.selectByUserAndSpuAndType(userId, reqVO.getSpuId(), reqVO.getType()); + return Objects.nonNull(favoriteDO); + } + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyService.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyService.java index 564bc82a9..6a1ceb95a 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyService.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyService.java @@ -40,6 +40,7 @@ public interface ProductPropertyService { /** * 获得属性项列表 + * * @param listReqVO 集合查询 * @return 属性项集合 */ diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java index 7554a508e..d33d4df15 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java @@ -94,7 +94,7 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { @Override public List getPropertyList(ProductPropertyListReqVO listReqVO) { - // 增加使用属性id查询 + // 增加使用属性 id 查询 if (CollUtil.isNotEmpty(listReqVO.getPropertyIds())){ return productPropertyMapper.selectBatchIds(listReqVO.getPropertyIds()); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuService.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuService.java index 8eb5f73fb..0b34cc2d8 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuService.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuService.java @@ -87,7 +87,9 @@ public interface ProductSkuService { /** * 基于 SPU 编号和状态,获得商品 SKU 集合 - * TODO SKU中已经不存在status属性 + * + * TODO @puhui999:SKU中已经不存在status属性;芋艿:那就去掉 status 哈 + * * @param spuId SPU 编号 * @param status 状态 * @return 商品 SKU 集合 diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java index 23421c988..fd1cac880 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java @@ -1,12 +1,9 @@ package cn.iocoder.yudao.module.product.service.spu; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.convert.Convert; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO; import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuRespVO; import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; @@ -23,7 +20,6 @@ import cn.iocoder.yudao.module.product.service.category.ProductCategoryService; import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService; import cn.iocoder.yudao.module.product.service.property.bo.ProductPropertyValueDetailRespBO; import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -34,7 +30,7 @@ import java.util.*; import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.getSumValue; import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SPU_NOT_EXISTS; import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SPU_SAVE_FAIL_CATEGORY_LEVEL_ERROR; @@ -63,17 +59,18 @@ public class ProductSpuServiceImpl implements ProductSpuService { @Override @Transactional(rollbackFor = Exception.class) public Long createSpu(ProductSpuCreateReqVO createReqVO) { - // 校验分类 TODO 暂不清楚为什么只能选择第三层的结点 + // 校验分类 TODO puhui999:暂不清楚为什么只能选择第三层的结点;芋艿:改成二级分类,因为商品只能放在叶子节点级别; //validateCategory(createReqVO.getCategoryId()); - // 校验品牌 TODO 暂不校验,前端没有做品牌选择 + // 校验品牌 TODO puhui999:暂不校验,前端没有做品牌选择;芋艿:可以加下哈 //brandService.validateProductBrand(createReqVO.getBrandId()); List skuSaveReqList = createReqVO.getSkus(); - // 校验SKU + // 校验 SKU productSkuService.validateSkuList(skuSaveReqList, createReqVO.getSpecType()); ProductSpuDO spu = ProductSpuConvert.INSTANCE.convert(createReqVO); - // 初始化SPU中SKU相关属性 + // 初始化 SPU 中 SKU 相关属性 initSpuFromSkus(spu, skuSaveReqList); + // 插入 SPU productSpuMapper.insert(spu); // 插入 SKU @@ -193,6 +190,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { stockIncrCounts.forEach((id, incCount) -> productSpuMapper.updateStock(id, incCount)); } + // TODO @puhui999:Service 尽量不做一些跟 VO 相关的拼接逻辑,目的是让 Service 更加简洁一点哈。 @Override public ProductSpuDetailRespVO getSpuDetail(Long id) { // 获得商品 SPU @@ -204,12 +202,17 @@ public class ProductSpuServiceImpl implements ProductSpuService { // 查询商品 SKU List skus = productSkuService.getSkuListBySpuId(spu.getId()); if (CollUtil.isNotEmpty(skus)){ + // TODO @puhui999:skuVOs 更简洁一点。然后大小写要注释哈。RespVOs;因为 VO 是缩写,s 是复数 List skuRespVoS = ProductSkuConvert.INSTANCE.convertList(skus); // 非多规格,不需要处理 + // TODO @puhui999:统一模型,即使是单规格,也查询下,问题不大的 if (ObjectUtil.equal(productSpuDetailRespVO.getSpecType(), true)) { - // 获取所有的属性值id - Set valueIds = skus.stream().flatMap(p -> p.getProperties().stream()).map(ProductSkuDO.Property::getValueId).collect(Collectors.toSet()); + // 获取所有的属性值 id + Set valueIds = skus.stream().flatMap(p -> p.getProperties().stream()) + .map(ProductSkuDO.Property::getValueId) + .collect(Collectors.toSet()); List valueDetailList = productPropertyValueService.getPropertyValueDetailList(valueIds); + // TODO @puhui999:拼接的逻辑,最好查询好后,丢到 convert 里面统一处理;这样 Service or Controller 也可以更简洁;原则上,Controller 去组合;Service 写逻辑;Convert 转换 Map stringMap = valueDetailList.stream().collect(Collectors.toMap(ProductPropertyValueDetailRespBO::getValueId, ProductPropertyValueDetailRespBO::getValueName)); // 设置属性值名称 skuRespVoS.stream().flatMap(p -> p.getProperties().stream()).forEach(item ->item.setValueName(stringMap.get(item.getValueId()))); @@ -232,6 +235,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { @Override public Map getTabsCount() { + // TODO @puhui999:map =》counts;尽量避免出现 map 这种命名,无命名含义哈 Map map = new HashMap<>(); // 查询销售中的商品数量 map.put(ProductSpuTabTypeEnum.FOR_SALE.getType(), productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.ENABLE.getStatus())); @@ -240,6 +244,8 @@ public class ProductSpuServiceImpl implements ProductSpuService { // 查询售空的商品数量 map.put(ProductSpuTabTypeEnum.SOLD_OUT.getType(),productSpuMapper.selectCount(ProductSpuDO::getStock, 0)); // 查询触发警戒库存的商品数量 TODO 警戒库存暂时为 10,后期需要使用常量或者数据库配置替换 + // TODO @puhui999:要有空格;, productSpuMapper + // TODO @puhui999:Service 不要有 Mapper 的逻辑;想想咋抽象一下哈 map.put(ProductSpuTabTypeEnum.ALERT_STOCK.getType(),productSpuMapper.selectCount(new LambdaQueryWrapperX().le(ProductSpuDO::getStock, 10))); // 查询回收站中的商品数量 map.put(ProductSpuTabTypeEnum.RECYCLE_BIN.getType(),productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.RECYCLE.getStatus())); diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/resources/mapper/favorite/ProductFavoriteMapper.xml b/yudao-module-mall/yudao-module-product-biz/src/main/resources/mapper/favorite/ProductFavoriteMapper.xml deleted file mode 100644 index 8d2741e03..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/resources/mapper/favorite/ProductFavoriteMapper.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java index bd61c4e93..b6f150a11 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java +++ b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java @@ -5,11 +5,11 @@ import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.RandomUtil; import cn.iocoder.yudao.framework.common.exception.ServiceException; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; -import cn.iocoder.yudao.framework.common.util.collection.SetUtils; import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; -import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO; -import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; +import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuCreateReqVO; +import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuPageReqVO; +import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuPageRespVO; +import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuUpdateReqVO; import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO; import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; @@ -34,7 +34,6 @@ import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.getSumValue; import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; @@ -79,13 +78,10 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { @Test public void testCreateSpu_success() { // 准备参数 - ProductSpuCreateReqVO createReqVO = randomPojo(ProductSpuCreateReqVO.class, o -> { - o.setSpecType(true); - }); + ProductSpuCreateReqVO createReqVO = randomPojo(ProductSpuCreateReqVO.class); Long spu = productSpuService.createSpu(createReqVO); ProductSpuDO productSpuDO = productSpuMapper.selectById(spu); assertPojoEquals(createReqVO, productSpuDO); - } @Test @@ -96,7 +92,6 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { // 准备参数 ProductSpuUpdateReqVO reqVO = randomPojo(ProductSpuUpdateReqVO.class, o -> { o.setId(createReqVO.getId()); // 设置更新的 ID - o.setSpecType(true); }); // 调用 productSpuService.updateSpu(reqVO); @@ -107,9 +102,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { @Test public void testValidateSpuExists_exception() { - ProductSpuUpdateReqVO reqVO = randomPojo(ProductSpuUpdateReqVO.class, o -> { - o.setSpecType(true); - }); + ProductSpuUpdateReqVO reqVO = randomPojo(ProductSpuUpdateReqVO.class); // 调用 Assertions.assertThrows(ServiceException.class, () -> productSpuService.updateSpu(reqVO)); } @@ -174,7 +167,6 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { //o.setMinPrice(1); // TODO ProductSpuDO中已没有相关属性 //o.setMaxPrice(50); o.setMarketPrice(25); - o.setSpecType(false); o.setBrandId(brandId); o.setCategoryId(categoryId); //o.setClickCount(100); @@ -222,8 +214,8 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { //o.setMinPrice(1); // TODO ProductSpuDO中已没有相关属性 //o.setMaxPrice(1); o.setMarketPrice(1); - o.setSpecType(false); o.setBrandId(brandId); + o.setSpecType(false); o.setCategoryId(categoryId); //o.setClickCount(1); // TODO ProductSpuDO中已没有相关属性 //o.setCode(generateNo()); diff --git a/yudao-server/src/test/java/cn/iocoder/yudao/ProjectReactor.java b/yudao-server/src/test/java/cn/iocoder/yudao/ProjectReactor.java index 41171d988..6209c08e2 100644 --- a/yudao-server/src/test/java/cn/iocoder/yudao/ProjectReactor.java +++ b/yudao-server/src/test/java/cn/iocoder/yudao/ProjectReactor.java @@ -66,7 +66,7 @@ public class ProjectReactor { // 写入文件 files.forEach(file -> { // 如果是白名单的文件类型,不进行重写,直接拷贝 - String fileType = FileTypeUtil.getType(file); + String fileType = getFileType(file); if (WHITE_FILE_TYPES.contains(fileType)) { copyFile(file, projectBaseDir, projectBaseDirNew, packageNameNew, artifactIdNew); return; @@ -106,7 +106,7 @@ public class ProjectReactor { String titleNew) { String content = FileUtil.readString(file, StandardCharsets.UTF_8); // 如果是白名单的文件类型,不进行重写 - String fileType = FileTypeUtil.getType(file); + String fileType = getFileType(file); if (WHITE_FILE_TYPES.contains(fileType)) { return content; } @@ -139,4 +139,8 @@ public class ProjectReactor { .replaceAll(StrUtil.upperFirst(ARTIFACT_ID), StrUtil.upperFirst(artifactIdNew)); } + private static String getFileType(File file) { + return file.length() > 0 ? FileTypeUtil.getType(file) : ""; + } + } diff --git a/yudao-ui-admin/package.json b/yudao-ui-admin/package.json index e15da953b..e0777abd0 100644 --- a/yudao-ui-admin/package.json +++ b/yudao-ui-admin/package.json @@ -1,6 +1,6 @@ { "name": "yudao-ui-admin", - "version": "1.7.1-snapshot", + "version": "1.7.2-snapshot", "description": "芋道管理系统", "author": "芋道", "license": "MIT", diff --git a/yudao-ui-admin/src/views/login.vue b/yudao-ui-admin/src/views/login.vue index 39b84d504..f2a1625bd 100644 --- a/yudao-ui-admin/src/views/login.vue +++ b/yudao-ui-admin/src/views/login.vue @@ -83,6 +83,14 @@ + + + + 📚开发指南 + 🔥视频教程 + ⚡面试手册 + 🤝外包咨询 +