Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lingxi-lxy-yanshou
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
后端-黄柯铭
lingxi-lxy-yanshou
Commits
243f5ac2
Commit
243f5ac2
authored
Aug 06, 2021
by
fhj
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/v2' into v2
parents
dfb105ae
52bf6631
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
114 additions
and
1 deletion
+114
-1
CommodityCollectChannelController.java
.../search/controller/CommodityCollectChannelController.java
+13
-0
CommodityCollectController.java
.../lingxi/search/controller/CommodityCollectController.java
+26
-1
CommodityCollectBatchRequest.java
...xi/search/model/request/CommodityCollectBatchRequest.java
+24
-0
ICommodityCollectChannelService.java
...ingxi/search/service/ICommodityCollectChannelService.java
+6
-0
ICommodityCollectService.java
...m/ssy/lingxi/search/service/ICommodityCollectService.java
+7
-0
CommodityCollectChannelServiceImpl.java
...earch/serviceImpl/CommodityCollectChannelServiceImpl.java
+19
-0
CommodityCollectServiceImpl.java
...ingxi/search/serviceImpl/CommodityCollectServiceImpl.java
+19
-0
No files found.
search-service/src/main/java/com/ssy/lingxi/search/controller/CommodityCollectChannelController.java
View file @
243f5ac2
...
...
@@ -5,6 +5,7 @@ import com.ssy.lingxi.common.constant.manage.ShopTypeEnum;
import
com.ssy.lingxi.common.controller.BaseController
;
import
com.ssy.lingxi.common.model.dto.UserLoginCacheDTO
;
import
com.ssy.lingxi.common.response.Wrapper
;
import
com.ssy.lingxi.product.api.model.request.SimpleIdRequest
;
import
com.ssy.lingxi.search.entity.CommodityCollectChannel
;
import
com.ssy.lingxi.search.entity.channelCommodity.ChannelCommodityMember
;
import
com.ssy.lingxi.search.entity.commodity.Commodity
;
...
...
@@ -139,4 +140,16 @@ public class CommodityCollectChannelController extends BaseController {
return
Wrapper
.
success
(
commodityCollectChannelService
.
deleteCommodityCollectChannel
(
sysUser
,
shopId
,
commodityCollectChannelRequest
));
}
/**
* 删除商品收藏通过id
* @param simpleIdRequest
* @return
*/
@RequestMapping
(
value
=
"deleteCommodityCollectById"
,
method
=
RequestMethod
.
POST
)
public
Wrapper
<
String
>
deleteCommodityCollectById
(
@RequestBody
SimpleIdRequest
simpleIdRequest
){
UserLoginCacheDTO
sysUser
=
this
.
getSysUser
();
Long
id
=
simpleIdRequest
.
getId
();
return
Wrapper
.
success
(
commodityCollectChannelService
.
deleteCommodityCollectChannelById
(
sysUser
,
id
));
}
}
search-service/src/main/java/com/ssy/lingxi/search/controller/CommodityCollectController.java
View file @
243f5ac2
...
...
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import
com.ssy.lingxi.common.controller.BaseController
;
import
com.ssy.lingxi.common.model.dto.UserLoginCacheDTO
;
import
com.ssy.lingxi.common.response.Wrapper
;
import
com.ssy.lingxi.product.api.model.request.SimpleIdRequest
;
import
com.ssy.lingxi.search.entity.CommodityCollect
;
import
com.ssy.lingxi.search.entity.commodity.Commodity
;
import
com.ssy.lingxi.search.entity.commodity.CommodityShop
;
...
...
@@ -104,15 +105,39 @@ public class CommodityCollectController extends BaseController {
}
/**
* 批量新增商品收藏
* @param commodityCollectRequestList 商品收藏实体
* @return
*/
@RequestMapping
(
value
=
"/saveCommodityCollectBatch"
,
method
=
RequestMethod
.
POST
)
public
Wrapper
<
Boolean
>
saveCommodityCollectBatch
(
@RequestBody
List
<
CommodityCollectRequest
>
commodityCollectRequestList
){
UserLoginCacheDTO
sysUser
=
this
.
getSysUser
();
Long
shopId
=
Long
.
parseLong
(
request
.
getHeader
(
"shopId"
));
return
Wrapper
.
success
(
commodityCollectService
.
saveBatchCommodityCollect
(
sysUser
,
shopId
,
commodityCollectRequestList
));
}
/**
* 删除商品收藏
* @param commodityCollectRequest
* @return
*/
@RequestMapping
(
value
=
"deleteCommodityCollect"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"
/
deleteCommodityCollect"
,
method
=
RequestMethod
.
POST
)
public
Wrapper
<
String
>
deleteCommodityCollect
(
@RequestBody
CommodityCollectRequest
commodityCollectRequest
){
UserLoginCacheDTO
sysUser
=
this
.
getSysUser
();
Long
shopId
=
Long
.
parseLong
(
request
.
getHeader
(
"shopId"
));
return
Wrapper
.
success
(
commodityCollectService
.
deleteCommodityCollect
(
sysUser
,
shopId
,
commodityCollectRequest
));
}
/**
* 删除商品收藏通过id
* @param simpleIdRequest 商品收藏id
* @return
*/
@RequestMapping
(
value
=
"/deleteCommodityCollectById"
,
method
=
RequestMethod
.
POST
)
public
Wrapper
<
String
>
deleteCommodityCollectById
(
@RequestBody
SimpleIdRequest
simpleIdRequest
){
UserLoginCacheDTO
sysUser
=
this
.
getSysUser
();
Long
id
=
simpleIdRequest
.
getId
();
return
Wrapper
.
success
(
commodityCollectService
.
deleteCommodityCollectById
(
sysUser
,
id
));
}
}
search-service/src/main/java/com/ssy/lingxi/search/model/request/CommodityCollectBatchRequest.java
0 → 100644
View file @
243f5ac2
package
com
.
ssy
.
lingxi
.
search
.
model
.
request
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* 商城的商品收藏
* @author jw.chen
* @version 2.0.0
* @date 2020/9/25
*/
@Getter
@Setter
public
class
CommodityCollectBatchRequest
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
7209358219603948888L
;
/**
* 商品id
*/
private
List
<
Long
>
commodityIdList
;
}
search-service/src/main/java/com/ssy/lingxi/search/service/ICommodityCollectChannelService.java
View file @
243f5ac2
...
...
@@ -50,4 +50,10 @@ public interface ICommodityCollectChannelService {
*/
String
deleteCommodityCollectChannel
(
UserLoginCacheDTO
sysUser
,
Long
shopId
,
CommodityCollectChannelRequest
commodityCollectChannelRequest
);
/**
* 删除商品收藏通过id
* @param id
* @return
*/
String
deleteCommodityCollectChannelById
(
UserLoginCacheDTO
sysUser
,
Long
id
);
}
search-service/src/main/java/com/ssy/lingxi/search/service/ICommodityCollectService.java
View file @
243f5ac2
...
...
@@ -57,4 +57,11 @@ public interface ICommodityCollectService {
*/
String
deleteCommodityCollect
(
UserLoginCacheDTO
sysUser
,
Long
shopId
,
CommodityCollectRequest
commodityCollectRequest
);
/**
* 删除商品收藏通过id
* @param id
* @return
*/
String
deleteCommodityCollectById
(
UserLoginCacheDTO
sysUser
,
Long
id
);
}
search-service/src/main/java/com/ssy/lingxi/search/serviceImpl/CommodityCollectChannelServiceImpl.java
View file @
243f5ac2
...
...
@@ -196,5 +196,24 @@ public class CommodityCollectChannelServiceImpl implements ICommodityCollectChan
}
}
/**
* 删除商品收藏通过id
* @param id
* @return
*/
@Override
public
String
deleteCommodityCollectChannelById
(
UserLoginCacheDTO
sysUser
,
Long
id
)
{
Long
userId
=
sysUser
.
getUserId
();
CommodityCollectChannel
commodityCollectChannel
=
commodityCollectChannelRepository
.
findById
(
id
).
orElse
(
null
);
if
(
commodityCollectChannel
!=
null
){
Long
commodityCollectChannelUserId
=
commodityCollectChannel
.
getUserId
();
if
(
commodityCollectChannelUserId
.
longValue
()
==
userId
.
longValue
()){
commodityCollectChannelRepository
.
deleteById
(
id
);
return
"删除成功"
;
}
}
throw
new
BusinessException
(
ResponseCode
.
PRODUCT_COMMODITY_COLLECT_NOT_EXIST
);
}
}
search-service/src/main/java/com/ssy/lingxi/search/serviceImpl/CommodityCollectServiceImpl.java
View file @
243f5ac2
...
...
@@ -203,5 +203,24 @@ public class CommodityCollectServiceImpl implements ICommodityCollectService {
}
}
/**
* 删除商品收藏通过id
* @param id
* @return
*/
@Override
public
String
deleteCommodityCollectById
(
UserLoginCacheDTO
sysUser
,
Long
id
)
{
Long
userId
=
sysUser
.
getUserId
();
CommodityCollect
commodityCollect
=
commodityCollectRepository
.
findById
(
id
).
orElse
(
null
);
if
(
commodityCollect
!=
null
){
Long
commodityCollectUserId
=
commodityCollect
.
getUserId
();
if
(
commodityCollectUserId
.
longValue
()
==
userId
.
longValue
()){
commodityCollectRepository
.
deleteById
(
id
);
return
"删除成功"
;
}
}
throw
new
BusinessException
(
ResponseCode
.
PRODUCT_COMMODITY_COLLECT_NOT_EXIST
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment