Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pms
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
pms
Commits
243e3266
提交
243e3266
authored
7月 27, 2023
作者:
xiaowang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改:修改类型
上级
f5b6a4de
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
35 行增加
和
40 行删除
+35
-40
AppMallGoodsController.java
...a/com/mmc/pms/controller/mall/AppMallGoodsController.java
+1
-1
MallGoodsController.java
...java/com/mmc/pms/controller/mall/MallGoodsController.java
+5
-5
MallGoodsDao.java
src/main/java/com/mmc/pms/dao/mall/MallGoodsDao.java
+7
-7
GoodsSpecDO.java
src/main/java/com/mmc/pms/entity/mall/GoodsSpecDO.java
+1
-1
MallGoodsDO.java
src/main/java/com/mmc/pms/entity/mall/MallGoodsDO.java
+1
-1
MallGoodsResourcesDO.java
...in/java/com/mmc/pms/entity/mall/MallGoodsResourcesDO.java
+1
-1
GoodsSpecVO.java
src/main/java/com/mmc/pms/model/mall/GoodsSpecVO.java
+1
-1
MallGoodsVO.java
src/main/java/com/mmc/pms/model/mall/MallGoodsVO.java
+2
-2
MallGoodsService.java
src/main/java/com/mmc/pms/service/mall/MallGoodsService.java
+4
-4
MallGoodsServiceImpl.java
...a/com/mmc/pms/service/mall/impl/MallGoodsServiceImpl.java
+8
-13
MallGoodsDao.xml
src/main/resources/mapper/mall/MallGoodsDao.xml
+4
-4
没有找到文件。
src/main/java/com/mmc/pms/controller/mall/AppMallGoodsController.java
浏览文件 @
243e3266
...
...
@@ -31,7 +31,7 @@ public class AppMallGoodsController extends BaseController {
@ApiOperation
(
value
=
"小程序商品详情"
)
@GetMapping
(
"appMallGoodsDetails"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
MallGoodsVO
.
class
)})
public
ResultBody
<
MallGoodsVO
>
appMallGoodsDetails
(
@RequestParam
Long
id
)
{
public
ResultBody
<
MallGoodsVO
>
appMallGoodsDetails
(
@RequestParam
Integer
id
)
{
return
mallGoodsService
.
mallGoodsDetails
(
id
);
}
...
...
src/main/java/com/mmc/pms/controller/mall/MallGoodsController.java
浏览文件 @
243e3266
...
...
@@ -33,7 +33,7 @@ public class MallGoodsController extends BaseController {
@ApiOperation
(
value
=
"商城商品详情"
)
@GetMapping
(
"mallGoodsDetails"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
MallGoodsVO
.
class
)})
public
ResultBody
<
MallGoodsVO
>
mallGoodsDetails
(
@RequestParam
Long
id
)
{
public
ResultBody
<
MallGoodsVO
>
mallGoodsDetails
(
@RequestParam
Integer
id
)
{
return
mallGoodsService
.
mallGoodsDetails
(
id
);
}
...
...
@@ -61,15 +61,15 @@ public class MallGoodsController extends BaseController {
@ApiOperation
(
value
=
"商品列表-排序"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@GetMapping
(
"exchange"
)
public
ResultBody
exchange
(
@ApiParam
(
value
=
"第一个商品id"
,
required
=
true
)
@RequestParam
(
value
=
"firstId"
)
Long
firstId
,
@ApiParam
(
value
=
"第二个商品id"
,
required
=
true
)
@RequestParam
(
value
=
"secondId"
)
Long
secondId
)
{
public
ResultBody
exchange
(
@ApiParam
(
value
=
"第一个商品id"
,
required
=
true
)
@RequestParam
(
value
=
"firstId"
)
Integer
firstId
,
@ApiParam
(
value
=
"第二个商品id"
,
required
=
true
)
@RequestParam
(
value
=
"secondId"
)
Integer
secondId
)
{
return
mallGoodsService
.
exchange
(
firstId
,
secondId
);
}
@ApiOperation
(
value
=
"商品列表-上架或下架"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@GetMapping
(
"upOrDownShelf"
)
public
ResultBody
upOrDownShelf
(
@ApiParam
(
value
=
"商品id"
,
required
=
true
)
@RequestParam
(
value
=
"id"
)
Long
id
,
public
ResultBody
upOrDownShelf
(
@ApiParam
(
value
=
"商品id"
,
required
=
true
)
@RequestParam
(
value
=
"id"
)
Integer
id
,
@ApiParam
(
value
=
"状态 0:下架 1: 上架"
,
required
=
true
)
@RequestParam
(
value
=
"status"
)
Integer
status
)
{
return
mallGoodsService
.
upOrDownShelf
(
id
,
status
);
}
...
...
@@ -77,7 +77,7 @@ public class MallGoodsController extends BaseController {
@ApiOperation
(
value
=
"商品列表-删除"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@GetMapping
(
"removeMallGoods"
)
public
ResultBody
removeMallGoods
(
@ApiParam
(
value
=
"商品id"
,
required
=
true
)
@RequestParam
(
value
=
"id"
)
Long
id
)
{
public
ResultBody
removeMallGoods
(
@ApiParam
(
value
=
"商品id"
,
required
=
true
)
@RequestParam
(
value
=
"id"
)
Integer
id
)
{
return
mallGoodsService
.
removeMallGoods
(
id
);
}
}
src/main/java/com/mmc/pms/dao/mall/MallGoodsDao.java
浏览文件 @
243e3266
...
...
@@ -30,17 +30,17 @@ public interface MallGoodsDao {
void
batchInsertMallGoodsResources
(
List
<
MallGoodsResourcesDO
>
mallGoodsResourcesList
);
MallGoodsDO
getMallGoodsBaseInfo
(
Long
id
);
MallGoodsDO
getMallGoodsBaseInfo
(
Integer
id
);
List
<
MallGoodsResourcesDO
>
getMallGoodsResources
(
Long
id
);
List
<
MallGoodsResourcesDO
>
getMallGoodsResources
(
Integer
id
);
List
<
GoodsSpecDO
>
getMallGoodsSpec
(
Long
id
);
List
<
GoodsSpecDO
>
getMallGoodsSpec
(
Integer
id
);
List
<
GoodsSpecValuesDO
>
getMallGoodsSpecValues
(
List
<
Integer
>
ids
);
void
updateMallGoods
(
@Param
(
"mallGoodsDO"
)
MallGoodsDO
mallGoodsDO
);
void
deleteMallGoodsResources
(
Long
id
);
void
deleteMallGoodsResources
(
Integer
id
);
void
deleteGoodsSpec
(
List
<
Integer
>
deleteSpec
);
...
...
@@ -56,9 +56,9 @@ public interface MallGoodsDao {
List
<
MallGoodsDO
>
listMallGoods
(
MallGoodsQO
param
);
int
updateMallGoodsSort
(
Long
id
,
Integer
sort
);
int
updateMallGoodsSort
(
Integer
id
,
Integer
sort
);
void
updateMallGoodsByShelf
(
Long
id
,
Integer
status
);
void
updateMallGoodsByShelf
(
Integer
id
,
Integer
status
);
void
removeMallGoods
(
Long
id
);
void
removeMallGoods
(
Integer
id
);
}
src/main/java/com/mmc/pms/entity/mall/GoodsSpecDO.java
浏览文件 @
243e3266
...
...
@@ -24,7 +24,7 @@ public class GoodsSpecDO implements Serializable {
/**
* 商品id
*/
private
Long
mallGoodsId
;
private
Integer
mallGoodsId
;
/**
* 规格名称
*/
...
...
src/main/java/com/mmc/pms/entity/mall/MallGoodsDO.java
浏览文件 @
243e3266
...
...
@@ -23,7 +23,7 @@ import java.util.List;
public
class
MallGoodsDO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
709941898403563905L
;
private
Long
id
;
private
Integer
id
;
/**
* 商品编号(ID12345678)
*/
...
...
src/main/java/com/mmc/pms/entity/mall/MallGoodsResourcesDO.java
浏览文件 @
243e3266
...
...
@@ -22,7 +22,7 @@ public class MallGoodsResourcesDO implements Serializable {
private
Integer
id
;
private
Long
mallGoodsId
;
private
Integer
mallGoodsId
;
/**
* 资源url
*/
...
...
src/main/java/com/mmc/pms/model/mall/GoodsSpecVO.java
浏览文件 @
243e3266
...
...
@@ -21,7 +21,7 @@ public class GoodsSpecVO {
@ApiModelProperty
(
value
=
"id"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"商品id"
)
private
Long
mallGoodsId
;
private
Integer
mallGoodsId
;
@ApiModelProperty
(
value
=
"规格名称"
,
example
=
"规格名称"
,
required
=
true
)
private
String
specName
;
@ApiModelProperty
(
value
=
"选择方式 :0单选,1多选"
,
example
=
"1"
,
required
=
true
)
...
...
src/main/java/com/mmc/pms/model/mall/MallGoodsVO.java
浏览文件 @
243e3266
...
...
@@ -26,7 +26,7 @@ import java.util.List;
public
class
MallGoodsVO
{
@ApiModelProperty
(
value
=
"id"
,
example
=
"1"
)
@NotNull
(
message
=
"id不能为空"
,
groups
=
{
Update
.
class
})
private
Long
id
;
private
Integer
id
;
@ApiModelProperty
(
value
=
"商品名称"
,
example
=
"这是商品名称"
,
required
=
true
)
@NotBlank
(
message
=
"商品名称不能为空"
,
groups
=
{
Update
.
class
,
Create
.
class
})
...
...
@@ -67,7 +67,7 @@ public class MallGoodsVO {
@ApiModelProperty
(
value
=
"创建时间 用作列表回显"
)
private
Date
createTime
;
@ApiModelProperty
(
value
=
"店铺id 小程序用"
)
private
Integer
userAccountId
;
}
src/main/java/com/mmc/pms/service/mall/MallGoodsService.java
浏览文件 @
243e3266
...
...
@@ -13,7 +13,7 @@ import com.mmc.pms.page.PageResult;
public
interface
MallGoodsService
{
ResultBody
addMallGoods
(
MallGoodsVO
mallGoodsVO
,
Integer
userAccountId
);
ResultBody
<
MallGoodsVO
>
mallGoodsDetails
(
Long
id
);
ResultBody
<
MallGoodsVO
>
mallGoodsDetails
(
Integer
id
);
ResultBody
editMallGoods
(
MallGoodsVO
mallGoodsVO
,
Integer
userAccountId
);
...
...
@@ -21,9 +21,9 @@ public interface MallGoodsService {
PageResult
listPageGoodsInfo
(
MallGoodsQO
param
,
LoginSuccessDTO
loginSuccessDTO
);
ResultBody
exchange
(
Long
firstId
,
Long
secondId
);
ResultBody
exchange
(
Integer
firstId
,
Integer
secondId
);
ResultBody
upOrDownShelf
(
Long
id
,
Integer
status
);
ResultBody
upOrDownShelf
(
Integer
id
,
Integer
status
);
ResultBody
removeMallGoods
(
Long
id
);
ResultBody
removeMallGoods
(
Integer
id
);
}
src/main/java/com/mmc/pms/service/mall/impl/MallGoodsServiceImpl.java
浏览文件 @
243e3266
...
...
@@ -18,7 +18,6 @@ import com.mmc.pms.model.sale.qo.MallGoodsQO;
import
com.mmc.pms.page.PageResult
;
import
com.mmc.pms.service.mall.MallGoodsService
;
import
com.mmc.pms.util.CodeUtil
;
import
com.mmc.pms.util.SnowFlake
;
import
com.mmc.pms.util.TDateUtil
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.stereotype.Service
;
...
...
@@ -47,10 +46,6 @@ public class MallGoodsServiceImpl implements MallGoodsService {
ResultBody
resultError
=
checkInformation
(
mallGoodsVO
,
userAccountId
);
if
(
resultError
!=
null
)
return
resultError
;
int
count
=
mallGoodsDao
.
countMallGoods
(
userAccountId
);
// 使用雪花算法生成雪花id,用作商品id,及其他id
SnowFlake
snowFlake
=
new
SnowFlake
(
2
,
3
);
long
id
=
snowFlake
.
nextId
();
mallGoodsVO
.
setId
(
id
);
MallGoodsDO
mallGoodsDO
=
new
MallGoodsDO
(
mallGoodsVO
);
mallGoodsDO
.
setGoodsNo
(
"MG"
+
TDateUtil
.
getDateStr
(
new
Date
(),
"yyyyMMddHHmmss"
)
+
CodeUtil
.
getRandomNum
(
4
));
mallGoodsDO
.
setUserAccountId
(
userAccountId
);
...
...
@@ -58,14 +53,14 @@ public class MallGoodsServiceImpl implements MallGoodsService {
// 将基础信息存储入库
mallGoodsDao
.
insertMallGoodsBaseInfo
(
mallGoodsDO
);
// 将商品图片等资源存入数据库中
insertMallGoodsResources
(
mallGoodsVO
,
id
);
insertMallGoodsResources
(
mallGoodsVO
,
mallGoodsDO
.
getId
()
);
// 将商品规格存入数据库
insertMallGoodsSpec
(
mallGoodsVO
.
getGoodsSpecList
(),
id
);
insertMallGoodsSpec
(
mallGoodsVO
.
getGoodsSpecList
(),
mallGoodsDO
.
getId
()
);
return
ResultBody
.
success
();
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
insertMallGoodsSpec
(
List
<
GoodsSpecVO
>
goodsSpecList
,
long
id
)
{
public
void
insertMallGoodsSpec
(
List
<
GoodsSpecVO
>
goodsSpecList
,
Integer
id
)
{
// 获取输入的规格信息
for
(
GoodsSpecVO
goodsSpecVO
:
goodsSpecList
)
{
goodsSpecVO
.
setMallGoodsId
(
id
);
...
...
@@ -82,7 +77,7 @@ public class MallGoodsServiceImpl implements MallGoodsService {
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
insertMallGoodsResources
(
MallGoodsVO
mallGoodsVO
,
long
id
)
{
public
void
insertMallGoodsResources
(
MallGoodsVO
mallGoodsVO
,
Integer
id
)
{
List
<
MallGoodsResourcesDO
>
mallGoodsResourcesList
=
mallGoodsVO
.
getResourcesList
().
stream
().
map
(
d
->
{
MallGoodsResourcesDO
mallGoodsResourcesDO
=
new
MallGoodsResourcesDO
(
d
);
mallGoodsResourcesDO
.
setMallGoodsId
(
id
);
...
...
@@ -107,7 +102,7 @@ public class MallGoodsServiceImpl implements MallGoodsService {
}
@Override
public
ResultBody
<
MallGoodsVO
>
mallGoodsDetails
(
Long
id
)
{
public
ResultBody
<
MallGoodsVO
>
mallGoodsDetails
(
Integer
id
)
{
MallGoodsDO
mallGoodsDO
=
mallGoodsDao
.
getMallGoodsBaseInfo
(
id
);
if
(
mallGoodsDO
==
null
)
{
return
ResultBody
.
error
(
"商品不存在或已删除!"
);
...
...
@@ -230,7 +225,7 @@ public class MallGoodsServiceImpl implements MallGoodsService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResultBody
exchange
(
Long
firstId
,
Long
secondId
)
{
public
ResultBody
exchange
(
Integer
firstId
,
Integer
secondId
)
{
MallGoodsDO
firstMallGoodsBaseInfo
=
mallGoodsDao
.
getMallGoodsBaseInfo
(
firstId
);
MallGoodsDO
secondMallGoodsBaseInfo
=
mallGoodsDao
.
getMallGoodsBaseInfo
(
secondId
);
int
updateCount1
=
mallGoodsDao
.
updateMallGoodsSort
(
firstId
,
firstMallGoodsBaseInfo
.
getSort
());
...
...
@@ -244,13 +239,13 @@ public class MallGoodsServiceImpl implements MallGoodsService {
}
@Override
public
ResultBody
upOrDownShelf
(
Long
id
,
Integer
status
)
{
public
ResultBody
upOrDownShelf
(
Integer
id
,
Integer
status
)
{
mallGoodsDao
.
updateMallGoodsByShelf
(
id
,
status
);
return
ResultBody
.
success
();
}
@Override
public
ResultBody
removeMallGoods
(
Long
id
)
{
public
ResultBody
removeMallGoods
(
Integer
id
)
{
mallGoodsDao
.
removeMallGoods
(
id
);
return
ResultBody
.
success
();
}
...
...
src/main/resources/mapper/mall/MallGoodsDao.xml
浏览文件 @
243e3266
...
...
@@ -3,9 +3,9 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.mmc.pms.dao.mall.MallGoodsDao"
>
<insert
id=
"insertMallGoodsBaseInfo"
>
insert into mall_goods(id,
goods_no,
<insert
id=
"insertMallGoodsBaseInfo"
keyProperty=
"id"
useGeneratedKeys=
"true"
parameterType=
"com.mmc.pms.entity.mall.MallGoodsDO"
>
insert into mall_goods(
goods_no,
trade_name,
description,
category_primary_id,
...
...
@@ -16,7 +16,7 @@
goods_details,
user_account_id,
sort)
values ( #{
id}, #{
goodsNo}, #{tradeName}, #{description}, #{categoryPrimaryId}, #{categorySubId}
values ( #{goodsNo}, #{tradeName}, #{description}, #{categoryPrimaryId}, #{categorySubId}
, #{shelfStatus}, #{goodsLabel}, #{labelShow}, #{goodsDetails}, #{userAccountId}, #{sort})
</insert>
<insert
id=
"insertGoodsSpec"
parameterType=
"com.mmc.pms.entity.mall.GoodsSpecDO"
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论