Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
A
Afrishop refactored project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Whispa
Afrishop refactored project
Commits
066cf45f
提交
066cf45f
authored
12月 29, 2020
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复优惠券不失效bug
上级
0ab80810
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
410 行增加
和
36 行删除
+410
-36
AttributesController.java
...example/afrishop_v3/controllers/AttributesController.java
+50
-0
CartController.java
...a/com/example/afrishop_v3/controllers/CartController.java
+1
-1
OrderController.java
.../com/example/afrishop_v3/controllers/OrderController.java
+8
-4
Attributes.java
src/main/java/com/example/afrishop_v3/models/Attributes.java
+154
-0
AttributesDesc.java
...n/java/com/example/afrishop_v3/models/AttributesDesc.java
+142
-0
AttributesVo.java
...ain/java/com/example/afrishop_v3/models/AttributesVo.java
+16
-0
TbCfItemParam.java
...in/java/com/example/afrishop_v3/models/TbCfItemParam.java
+11
-31
AttributesDescRepository.java
...mple/afrishop_v3/repository/AttributesDescRepository.java
+16
-0
AttributesRepository.java
.../example/afrishop_v3/repository/AttributesRepository.java
+12
-0
没有找到文件。
src/main/java/com/example/afrishop_v3/controllers/AttributesController.java
0 → 100644
浏览文件 @
066cf45f
package
com
.
example
.
afrishop_v3
.
controllers
;
import
com.example.afrishop_v3.base.Result
;
import
com.example.afrishop_v3.models.AttributesDesc
;
import
com.example.afrishop_v3.models.AttributesVo
;
import
com.example.afrishop_v3.models.TbCfItemParam
;
import
com.example.afrishop_v3.repository.AttributesDescRepository
;
import
com.example.afrishop_v3.repository.AttributesRepository
;
import
com.example.afrishop_v3.repository.TbCfItemParamRepository
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @Auther: wudepeng
* @Date: 2020/12/29
* @Description:属性管理
*/
@RestController
@RequestMapping
(
"/attributes"
)
public
class
AttributesController
{
private
final
TbCfItemParamRepository
itemParamRepository
;
private
final
AttributesRepository
attributesRepository
;
private
final
AttributesDescRepository
attributesDescRepository
;
public
AttributesController
(
TbCfItemParamRepository
itemParamRepository
,
AttributesRepository
attributesRepository
,
AttributesDescRepository
attributesDescRepository
)
{
this
.
itemParamRepository
=
itemParamRepository
;
this
.
attributesRepository
=
attributesRepository
;
this
.
attributesDescRepository
=
attributesDescRepository
;
}
@GetMapping
(
"/getItemAttributesById/{itemId}"
)
public
Result
getItemAttributesById
(
@PathVariable
(
"itemId"
)
String
itemId
)
{
List
<
TbCfItemParam
>
list
=
itemParamRepository
.
findAllByItemId
(
itemId
);
if
(
list
.
size
()
>
0
&&
list
!=
null
)
{
list
.
forEach
(
p
->
{
AttributesVo
attributesVo
=
new
AttributesVo
();
attributesVo
.
setAttrName
(
attributesRepository
.
findById
(
p
.
getAttrId
()).
get
().
getAttrName
());
List
<
AttributesDesc
>
descs
=
attributesDescRepository
.
findByAttrDescIdIn
(
p
.
getAttrDescId
().
split
(
","
));
String
descValue
=
descs
.
stream
().
map
(
AttributesDesc:
:
getAttrValue
).
collect
(
Collectors
.
joining
(
","
));
attributesVo
.
setAttrValue
(
descValue
);
});
}
return
new
Result
();
}
}
src/main/java/com/example/afrishop_v3/controllers/CartController.java
浏览文件 @
066cf45f
...
@@ -65,7 +65,7 @@ public class CartController extends Controller {
...
@@ -65,7 +65,7 @@ public class CartController extends Controller {
//Add single item to the cart
//Add single item to the cart
@PostMapping
@PostMapping
public
Result
addToCart
(
@RequestParam
(
"checkFlag"
)
Integer
checkFlag
,
@RequestBody
TbCfCartRecordR
itemDetail
)
{
public
Result
addToCart
(
@RequestParam
(
value
=
"checkFlag"
,
required
=
false
)
Integer
checkFlag
,
@RequestBody
TbCfCartRecordR
itemDetail
)
{
TbCfUserInfo
user
=
this
.
user
.
user
();
TbCfUserInfo
user
=
this
.
user
.
user
();
...
...
src/main/java/com/example/afrishop_v3/controllers/OrderController.java
浏览文件 @
066cf45f
...
@@ -146,6 +146,7 @@ public class OrderController extends Controller {
...
@@ -146,6 +146,7 @@ public class OrderController extends Controller {
if
(
couponOptional
.
isPresent
())
{
if
(
couponOptional
.
isPresent
())
{
TbCfToicoupon
tbCfToicoupon
=
couponOptional
.
get
();
TbCfCoupon
coupon
=
couponOptional
.
get
().
getCoupon
();
TbCfCoupon
coupon
=
couponOptional
.
get
().
getCoupon
();
order
.
setCoupon
(
coupon
);
order
.
setCoupon
(
coupon
);
}
}
...
@@ -343,6 +344,9 @@ public class OrderController extends Controller {
...
@@ -343,6 +344,9 @@ public class OrderController extends Controller {
if
(
couponOptional
.
isPresent
())
{
if
(
couponOptional
.
isPresent
())
{
TbCfToicoupon
tbCfToicoupon
=
couponOptional
.
get
();
tbCfToicoupon
.
setEnableFlag
(
0
);
toicouponRepository
.
save
(
tbCfToicoupon
);
TbCfCoupon
coupon
=
couponOptional
.
get
().
getCoupon
();
TbCfCoupon
coupon
=
couponOptional
.
get
().
getCoupon
();
order
.
setCoupon
(
coupon
);
order
.
setCoupon
(
coupon
);
}
}
...
@@ -418,10 +422,10 @@ public class OrderController extends Controller {
...
@@ -418,10 +422,10 @@ public class OrderController extends Controller {
//implementation of coupon use
//implementation of coupon use
if
(
tbCfToicoupon
!=
null
)
{
//
if (tbCfToicoupon != null) {
tbCfToicoupon
.
setEnableFlag
(
0
);
//
tbCfToicoupon.setEnableFlag(0);
toicouponRepository
.
save
(
tbCfToicoupon
);
//
toicouponRepository.save(tbCfToicoupon);
}
//
}
//order.getItemOrderList().forEach(itemOrderRepository::save);
//order.getItemOrderList().forEach(itemOrderRepository::save);
...
...
src/main/java/com/example/afrishop_v3/models/Attributes.java
0 → 100644
浏览文件 @
066cf45f
package
com
.
example
.
afrishop_v3
.
models
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* 实体
* 表名 attributes
*
* @author lipengjun
* @date 2020-12-21 15:41:01
*/
@Entity
public
class
Attributes
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 商品属性ID
*/
@Id
private
String
id
;
/**
* 属性名
*/
private
String
attrName
;
/**
* 状态 0:隐藏 1:正常
*/
private
Integer
status
;
/**
* 排序
*/
private
Integer
sort
;
/**
* 是否必须 0:否 1:是
*/
@Column
(
name
=
"is_need"
)
private
boolean
isNeed
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
@OneToMany
(
mappedBy
=
"attributes"
,
cascade
=
CascadeType
.
ALL
)
@Transient
private
List
<
AttributesDesc
>
descList
;
public
List
<
AttributesDesc
>
getDescList
()
{
return
descList
;
}
public
void
setDescList
(
List
<
AttributesDesc
>
descList
)
{
this
.
descList
=
descList
;
}
/**
* 设置:商品属性ID
*/
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
/**
* 获取:商品属性ID
*/
public
String
getId
()
{
return
id
;
}
/**
* 设置:属性名
*/
public
void
setAttrName
(
String
attrName
)
{
this
.
attrName
=
attrName
;
}
/**
* 获取:属性名
*/
public
String
getAttrName
()
{
return
attrName
;
}
/**
* 设置:状态 0:隐藏 1:正常
*/
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
/**
* 获取:状态 0:隐藏 1:正常
*/
public
Integer
getStatus
()
{
return
status
;
}
/**
* 设置:排序
*/
public
void
setSort
(
Integer
sort
)
{
this
.
sort
=
sort
;
}
/**
* 获取:排序
*/
public
Integer
getSort
()
{
return
sort
;
}
public
boolean
isNeed
()
{
return
isNeed
;
}
public
void
setNeed
(
boolean
need
)
{
isNeed
=
need
;
}
/**
* 设置:创建时间
*/
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
/**
* 获取:创建时间
*/
public
Date
getCreateTime
()
{
return
createTime
;
}
/**
* 设置:更新时间
*/
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
/**
* 获取:更新时间
*/
public
Date
getUpdateTime
()
{
return
updateTime
;
}
}
src/main/java/com/example/afrishop_v3/models/AttributesDesc.java
0 → 100644
浏览文件 @
066cf45f
package
com
.
example
.
afrishop_v3
.
models
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.ManyToOne
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 实体
* 表名 attributes_desc
*
* @author lipengjun
* @date 2020-12-23 11:00:57
*/
@Entity
public
class
AttributesDesc
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 属性描述ID
*/
@Id
private
String
attrDescId
;
/**
* 属性ID
*/
@ManyToOne
private
Attributes
attribute
;
/**
* 属性值
*/
private
String
attrValue
;
/**
* 属性描述(中文)
*/
private
String
attrDesc
;
/**
* 状态
*/
private
Integer
status
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
/**
* 设置:属性描述ID
*/
public
void
setAttrDescId
(
String
attrDescId
)
{
this
.
attrDescId
=
attrDescId
;
}
/**
* 获取:属性描述ID
*/
public
String
getAttrDescId
()
{
return
attrDescId
;
}
public
Attributes
getAttribute
()
{
return
attribute
;
}
public
void
setAttribute
(
Attributes
attribute
)
{
this
.
attribute
=
attribute
;
}
/**
* 设置:属性值
*/
public
void
setAttrValue
(
String
attrValue
)
{
this
.
attrValue
=
attrValue
;
}
/**
* 获取:属性值
*/
public
String
getAttrValue
()
{
return
attrValue
;
}
/**
* 设置:属性描述(中文)
*/
public
void
setAttrDesc
(
String
attrDesc
)
{
this
.
attrDesc
=
attrDesc
;
}
/**
* 获取:属性描述(中文)
*/
public
String
getAttrDesc
()
{
return
attrDesc
;
}
/**
* 设置:状态
*/
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
/**
* 获取:状态
*/
public
Integer
getStatus
()
{
return
status
;
}
/**
* 设置:创建时间
*/
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
/**
* 获取:创建时间
*/
public
Date
getCreateTime
()
{
return
createTime
;
}
/**
* 设置:更新时间
*/
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
/**
* 获取:更新时间
*/
public
Date
getUpdateTime
()
{
return
updateTime
;
}
}
src/main/java/com/example/afrishop_v3/models/AttributesVo.java
0 → 100644
浏览文件 @
066cf45f
package
com
.
example
.
afrishop_v3
.
models
;
import
lombok.Data
;
/**
* @Auther: wudepeng
* @Date: 2020/12/29
* @Description:属性模板
*/
@Data
public
class
AttributesVo
{
private
String
attrName
;
private
String
attrValue
;
}
src/main/java/com/example/afrishop_v3/models/TbCfItemParam.java
浏览文件 @
066cf45f
...
@@ -23,18 +23,20 @@ public class TbCfItemParam {
...
@@ -23,18 +23,20 @@ public class TbCfItemParam {
*/
*/
@Id
@Id
private
String
id
;
private
String
id
;
/**
/**
*
参数名
*
商品ID
*/
*/
private
String
paramName
;
private
String
itemId
;
/**
/**
*
参数值
*
属性ID
*/
*/
private
String
paramValue
;
private
String
attrId
;
/**
/**
*
商品
ID
*
属性描述
ID
*/
*/
private
String
itemId
;
private
String
attrDescId
;
/**
/**
* 创建时间
* 创建时间
*/
*/
...
@@ -44,6 +46,7 @@ public class TbCfItemParam {
...
@@ -44,6 +46,7 @@ public class TbCfItemParam {
*/
*/
private
Date
updateTime
;
private
Date
updateTime
;
/**
/**
* 设置:商品参数ID
* 设置:商品参数ID
*/
*/
...
@@ -57,32 +60,7 @@ public class TbCfItemParam {
...
@@ -57,32 +60,7 @@ public class TbCfItemParam {
public
String
getId
()
{
public
String
getId
()
{
return
id
;
return
id
;
}
}
/**
* 设置:参数名
*/
public
void
setParamName
(
String
paramName
)
{
this
.
paramName
=
paramName
;
}
/**
* 获取:参数名
*/
public
String
getParamName
()
{
return
paramName
;
}
/**
* 设置:参数值
*/
public
void
setParamValue
(
String
paramValue
)
{
this
.
paramValue
=
paramValue
;
}
/**
* 获取:参数值
*/
public
String
getParamValue
()
{
return
paramValue
;
}
/**
/**
* 设置:商品ID
* 设置:商品ID
*/
*/
...
@@ -96,6 +74,7 @@ public class TbCfItemParam {
...
@@ -96,6 +74,7 @@ public class TbCfItemParam {
public
String
getItemId
()
{
public
String
getItemId
()
{
return
itemId
;
return
itemId
;
}
}
/**
/**
* 设置:创建时间
* 设置:创建时间
*/
*/
...
@@ -109,6 +88,7 @@ public class TbCfItemParam {
...
@@ -109,6 +88,7 @@ public class TbCfItemParam {
public
Date
getCreateTime
()
{
public
Date
getCreateTime
()
{
return
createTime
;
return
createTime
;
}
}
/**
/**
* 设置:更新时间
* 设置:更新时间
*/
*/
...
...
src/main/java/com/example/afrishop_v3/repository/AttributesDescRepository.java
0 → 100644
浏览文件 @
066cf45f
package
com
.
example
.
afrishop_v3
.
repository
;
import
com.example.afrishop_v3.models.AttributesDesc
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
java.util.List
;
/**
* @Auther: wudepeng
* @Date: 2020/12/29
* @Description:
*/
public
interface
AttributesDescRepository
extends
JpaRepository
<
AttributesDesc
,
String
>
{
List
<
AttributesDesc
>
findByAttrDescIdIn
(
String
[]
attrDescId
);
}
src/main/java/com/example/afrishop_v3/repository/AttributesRepository.java
0 → 100644
浏览文件 @
066cf45f
package
com
.
example
.
afrishop_v3
.
repository
;
import
com.example.afrishop_v3.models.Attributes
;
import
org.springframework.data.jpa.repository.JpaRepository
;
/**
* @Auther: wudepeng
* @Date: 2020/12/29
* @Description:
*/
public
interface
AttributesRepository
extends
JpaRepository
<
Attributes
,
String
>
{
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论