Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
travel-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
cloud
travel-cloud
Commits
dea50e99
提交
dea50e99
authored
6月 04, 2025
作者:
hzh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
代码优化
上级
c6061c70
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
49 行增加
和
4 行删除
+49
-4
ProductPropertyController.java
...ler/product/admin/property/ProductPropertyController.java
+1
-1
ProductPropertyRespVO.java
...uct/admin/property/vo/property/ProductPropertyRespVO.java
+3
-0
ProductPropertySaveReqVO.java
.../admin/property/vo/property/ProductPropertySaveReqVO.java
+3
-0
ProductSkuSaveReqVO.java
.../controller/product/admin/spu/vo/ProductSkuSaveReqVO.java
+3
-0
ProductPropertyDO.java
...va/org/dromara/mall/domain/product/ProductPropertyDO.java
+13
-2
ProductPropertyTypeEnum.java
...omara/mall/enums/product/spu/ProductPropertyTypeEnum.java
+20
-0
ProductPropertyServiceImpl.java
...mall/service/product/impl/ProductPropertyServiceImpl.java
+5
-0
ProductSkuServiceImpl.java
...mara/mall/service/product/impl/ProductSkuServiceImpl.java
+1
-1
没有找到文件。
ruoyi-modules/ruoyi-mall/src/main/java/org/dromara/mall/controller/product/admin/property/ProductPropertyController.java
浏览文件 @
dea50e99
...
@@ -78,7 +78,7 @@ public class ProductPropertyController {
...
@@ -78,7 +78,7 @@ public class ProductPropertyController {
public
R
<
List
<
ProductPropertyRespVO
>>
getPropertySimpleList
()
{
public
R
<
List
<
ProductPropertyRespVO
>>
getPropertySimpleList
()
{
List
<
ProductPropertyDO
>
list
=
productPropertyService
.
getPropertyList
();
List
<
ProductPropertyDO
>
list
=
productPropertyService
.
getPropertyList
();
return
R
.
ok
(
convertList
(
list
,
property
->
new
ProductPropertyRespVO
()
// 只返回 id、name 属性
return
R
.
ok
(
convertList
(
list
,
property
->
new
ProductPropertyRespVO
()
// 只返回 id、name 属性
.
setId
(
property
.
getId
()).
setName
(
property
.
getNam
e
())));
.
setId
(
property
.
getId
()).
setName
(
property
.
getName
()).
setType
(
property
.
getTyp
e
())));
}
}
}
}
ruoyi-modules/ruoyi-mall/src/main/java/org/dromara/mall/controller/product/admin/property/vo/property/ProductPropertyRespVO.java
浏览文件 @
dea50e99
...
@@ -17,6 +17,9 @@ public class ProductPropertyRespVO {
...
@@ -17,6 +17,9 @@ public class ProductPropertyRespVO {
@Schema
(
description
=
"名称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"颜色"
)
@Schema
(
description
=
"名称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"颜色"
)
private
String
name
;
private
String
name
;
@Schema
(
description
=
"类型"
,
example
=
"文本"
)
private
String
type
;
@Schema
(
description
=
"备注"
,
example
=
"颜色"
)
@Schema
(
description
=
"备注"
,
example
=
"颜色"
)
private
String
remark
;
private
String
remark
;
...
...
ruoyi-modules/ruoyi-mall/src/main/java/org/dromara/mall/controller/product/admin/property/vo/property/ProductPropertySaveReqVO.java
浏览文件 @
dea50e99
...
@@ -15,6 +15,9 @@ public class ProductPropertySaveReqVO {
...
@@ -15,6 +15,9 @@ public class ProductPropertySaveReqVO {
@NotBlank
(
message
=
"名称不能为空"
)
@NotBlank
(
message
=
"名称不能为空"
)
private
String
name
;
private
String
name
;
@Schema
(
description
=
"类型"
)
private
String
type
;
@Schema
(
description
=
"备注"
,
example
=
"颜色"
)
@Schema
(
description
=
"备注"
,
example
=
"颜色"
)
private
String
remark
;
private
String
remark
;
...
...
ruoyi-modules/ruoyi-mall/src/main/java/org/dromara/mall/controller/product/admin/spu/vo/ProductSkuSaveReqVO.java
浏览文件 @
dea50e99
...
@@ -67,6 +67,9 @@ public class ProductSkuSaveReqVO {
...
@@ -67,6 +67,9 @@ public class ProductSkuSaveReqVO {
@Schema
(
description
=
"属性名字"
,
example
=
"颜色"
)
@Schema
(
description
=
"属性名字"
,
example
=
"颜色"
)
private
String
propertyName
;
private
String
propertyName
;
@Schema
(
description
=
"属性类型"
,
example
=
"文本"
)
private
String
propertyType
;
@Schema
(
description
=
"属性值编号"
,
example
=
"10"
)
@Schema
(
description
=
"属性值编号"
,
example
=
"10"
)
private
Long
valueId
;
private
Long
valueId
;
...
...
ruoyi-modules/ruoyi-mall/src/main/java/org/dromara/mall/domain/product/ProductPropertyDO.java
浏览文件 @
dea50e99
package
org
.
dromara
.
mall
.
domain
.
product
;
package
org
.
dromara
.
mall
.
domain
.
product
;
import
org.dromara.common.tenant.core.TenantEntity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
org.dromara.common.tenant.core.TenantEntity
;
import
org.dromara.mall.enums.product.spu.ProductPropertyTypeEnum
;
import
java.io.Serial
;
import
java.io.Serial
;
...
@@ -29,6 +32,10 @@ public class ProductPropertyDO extends TenantEntity {
...
@@ -29,6 +32,10 @@ public class ProductPropertyDO extends TenantEntity {
* SPU 单规格时,默认属性名字
* SPU 单规格时,默认属性名字
*/
*/
public
static
final
String
NAME_DEFAULT
=
"默认"
;
public
static
final
String
NAME_DEFAULT
=
"默认"
;
/**
* SPU 单规格时,默认属性类型
*/
public
static
final
String
TYPE_DEFAULT
=
ProductPropertyTypeEnum
.
TEXT
.
name
();
/**
/**
* 编号
* 编号
...
@@ -40,6 +47,10 @@ public class ProductPropertyDO extends TenantEntity {
...
@@ -40,6 +47,10 @@ public class ProductPropertyDO extends TenantEntity {
* 名称
* 名称
*/
*/
private
String
name
;
private
String
name
;
/**
* 类型
*/
private
String
type
;
/**
/**
* 备注
* 备注
*/
*/
...
...
ruoyi-modules/ruoyi-mall/src/main/java/org/dromara/mall/enums/product/spu/ProductPropertyTypeEnum.java
0 → 100644
浏览文件 @
dea50e99
package
org
.
dromara
.
mall
.
enums
.
product
.
spu
;
import
lombok.Getter
;
/**
* @author wenhe
*/
@Getter
public
enum
ProductPropertyTypeEnum
{
/**
* 文本
*/
TEXT
,
/**
* 日期
*/
DATE
;
}
ruoyi-modules/ruoyi-mall/src/main/java/org/dromara/mall/service/product/impl/ProductPropertyServiceImpl.java
浏览文件 @
dea50e99
...
@@ -2,6 +2,7 @@ package org.dromara.mall.service.product.impl;
...
@@ -2,6 +2,7 @@ package org.dromara.mall.service.product.impl;
import
cn.hutool.core.util.ObjUtil
;
import
cn.hutool.core.util.ObjUtil
;
import
jakarta.annotation.Resource
;
import
jakarta.annotation.Resource
;
import
org.dromara.common.core.utils.StringUtils
;
import
org.dromara.common.mall.util.object.BeanUtils
;
import
org.dromara.common.mall.util.object.BeanUtils
;
import
org.dromara.common.mybatis.core.page.PageResult
;
import
org.dromara.common.mybatis.core.page.PageResult
;
import
org.dromara.common.mybatis.core.query.LambdaQueryWrapperX
;
import
org.dromara.common.mybatis.core.query.LambdaQueryWrapperX
;
...
@@ -56,6 +57,9 @@ public class ProductPropertyServiceImpl implements ProductPropertyService {
...
@@ -56,6 +57,9 @@ public class ProductPropertyServiceImpl implements ProductPropertyService {
// 插入
// 插入
ProductPropertyDO
property
=
BeanUtils
.
toBean
(
createReqVO
,
ProductPropertyDO
.
class
);
ProductPropertyDO
property
=
BeanUtils
.
toBean
(
createReqVO
,
ProductPropertyDO
.
class
);
property
.
setDeptId
(
LoginHelper
.
getDeptId
());
property
.
setDeptId
(
LoginHelper
.
getDeptId
());
if
(
StringUtils
.
isEmpty
(
property
.
getType
()))
{
property
.
setType
(
ProductPropertyDO
.
TYPE_DEFAULT
);
}
productPropertyMapper
.
insert
(
property
);
productPropertyMapper
.
insert
(
property
);
// 返回
// 返回
return
property
.
getId
();
return
property
.
getId
();
...
@@ -74,6 +78,7 @@ public class ProductPropertyServiceImpl implements ProductPropertyService {
...
@@ -74,6 +78,7 @@ public class ProductPropertyServiceImpl implements ProductPropertyService {
// 更新
// 更新
ProductPropertyDO
updateObj
=
BeanUtils
.
toBean
(
updateReqVO
,
ProductPropertyDO
.
class
);
ProductPropertyDO
updateObj
=
BeanUtils
.
toBean
(
updateReqVO
,
ProductPropertyDO
.
class
);
updateObj
.
setType
(
null
);
productPropertyMapper
.
updateById
(
updateObj
);
productPropertyMapper
.
updateById
(
updateObj
);
// 更新 sku 相关属性
// 更新 sku 相关属性
productSkuService
.
updateSkuProperty
(
updateObj
.
getId
(),
updateObj
.
getName
());
productSkuService
.
updateSkuProperty
(
updateObj
.
getId
(),
updateObj
.
getName
());
...
...
ruoyi-modules/ruoyi-mall/src/main/java/org/dromara/mall/service/product/impl/ProductSkuServiceImpl.java
浏览文件 @
dea50e99
...
@@ -90,7 +90,7 @@ public class ProductSkuServiceImpl implements ProductSkuService {
...
@@ -90,7 +90,7 @@ public class ProductSkuServiceImpl implements ProductSkuService {
ProductSkuSaveReqVO
skuVO
=
skus
.
get
(
0
);
ProductSkuSaveReqVO
skuVO
=
skus
.
get
(
0
);
List
<
ProductSkuSaveReqVO
.
Property
>
properties
=
new
ArrayList
<>();
List
<
ProductSkuSaveReqVO
.
Property
>
properties
=
new
ArrayList
<>();
ProductSkuSaveReqVO
.
Property
property
=
new
ProductSkuSaveReqVO
.
Property
()
ProductSkuSaveReqVO
.
Property
property
=
new
ProductSkuSaveReqVO
.
Property
()
.
setPropertyId
(
ProductPropertyDO
.
ID_DEFAULT
).
setPropertyName
(
ProductPropertyDO
.
NAME_DEFAULT
)
.
setPropertyId
(
ProductPropertyDO
.
ID_DEFAULT
).
setPropertyName
(
ProductPropertyDO
.
NAME_DEFAULT
)
.
setPropertyType
(
ProductPropertyDO
.
TYPE_DEFAULT
)
.
setValueId
(
ProductPropertyValueDO
.
ID_DEFAULT
).
setValueName
(
ProductPropertyValueDO
.
NAME_DEFAULT
);
.
setValueId
(
ProductPropertyValueDO
.
ID_DEFAULT
).
setValueName
(
ProductPropertyValueDO
.
NAME_DEFAULT
);
properties
.
add
(
property
);
properties
.
add
(
property
);
skuVO
.
setProperties
(
properties
);
skuVO
.
setProperties
(
properties
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论