Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
2702c809
Commit
2702c809
authored
Sep 11, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 收藏册内收藏
parent
a80a3f65
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
19 deletions
+24
-19
ch-dao/src/main/java/com/wwdz/ch/db/impl/FavoritesItemsRelationDaoImpl.java
...va/com/wwdz/ch/db/impl/FavoritesItemsRelationDaoImpl.java
+6
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
+2
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
...c/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
+10
-10
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
...pi/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
+6
-6
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/impl/FavoritesItemsRelationDaoImpl.java
View file @
2702c809
...
@@ -11,6 +11,7 @@ import com.wwdz.ch.db.mapper.FavoritesItemsRelationMapper;
...
@@ -11,6 +11,7 @@ import com.wwdz.ch.db.mapper.FavoritesItemsRelationMapper;
import
com.xxdxxs.db.component.JdbcHelper
;
import
com.xxdxxs.db.component.JdbcHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.util.CollectionUtils
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -111,8 +112,12 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
...
@@ -111,8 +112,12 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
public
boolean
isCollected
(
Long
userId
,
Long
itemId
,
List
<
Long
>
itemIds
)
{
public
boolean
isCollected
(
Long
userId
,
Long
itemId
,
List
<
Long
>
itemIds
)
{
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
);
JdbcHelper
.
ifPresent
(
itemId
,
criteria:
:
andItemIdEqualTo
);
JdbcHelper
.
ifPresent
(
itemId
,
criteria:
:
andItemIdEqualTo
);
JdbcHelper
.
ifPresent
(
itemIds
,
criteria:
:
andItemIdIn
);
if
(!
CollectionUtils
.
isEmpty
(
itemIds
))
{
criteria
.
andItemIdIn
(
itemIds
);
criteria
.
andFavoritesIdNotEqualTo
(
0L
);
}
return
favoritesItemsRelationMapper
.
countByExample
(
example
)
>
0
;
return
favoritesItemsRelationMapper
.
countByExample
(
example
)
>
0
;
}
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
View file @
2702c809
...
@@ -477,7 +477,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -477,7 +477,7 @@ public class ItemServiceImpl implements ItemService {
try
{
try
{
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
if
(
Objects
.
isNull
(
item
))
{
if
(
Objects
.
isNull
(
item
))
{
return
Result
.
failed
(
"
数据异常,藏品不存在
"
);
return
Result
.
failed
(
"
该藏品已删除,不支持收藏
"
);
}
}
// 判断是否收藏过
// 判断是否收藏过
if
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
dto
.
getId
(),
null
))
{
if
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
dto
.
getId
(),
null
))
{
...
@@ -517,7 +517,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -517,7 +517,7 @@ public class ItemServiceImpl implements ItemService {
try
{
try
{
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
if
(
Objects
.
isNull
(
item
))
{
if
(
Objects
.
isNull
(
item
))
{
return
Result
.
failed
(
"
数据异常,藏品不存在
"
);
return
Result
.
failed
(
"
该藏品已经删除,不支持取消收藏
"
);
}
}
// 更新收藏册操作时间
// 更新收藏册操作时间
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
View file @
2702c809
...
@@ -60,7 +60,7 @@ public class WxFavoritesController {
...
@@ -60,7 +60,7 @@ public class WxFavoritesController {
return
Result
.
failed
(
"用户id不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
dto
.
getTitle
()))
{
if
(
StringUtils
.
isBlank
(
dto
.
getTitle
()))
{
return
Result
.
failed
(
"
标题不能为空
"
);
return
Result
.
failed
(
"
请输入标题
"
);
}
}
if
(
dto
.
getTitle
().
length
()
>
20
)
{
if
(
dto
.
getTitle
().
length
()
>
20
)
{
return
Result
.
failed
(
"标题的字数不能大于20字"
);
return
Result
.
failed
(
"标题的字数不能大于20字"
);
...
@@ -82,7 +82,7 @@ public class WxFavoritesController {
...
@@ -82,7 +82,7 @@ public class WxFavoritesController {
return
Result
.
failed
(
"用户id不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
dto
.
getTitle
()))
{
if
(
StringUtils
.
isBlank
(
dto
.
getTitle
()))
{
return
Result
.
failed
(
"
标题不能为空
"
);
return
Result
.
failed
(
"
请输入标题
"
);
}
}
if
(
dto
.
getTitle
().
length
()
>
20
)
{
if
(
dto
.
getTitle
().
length
()
>
20
)
{
return
Result
.
failed
(
"标题的字数不能大于20字"
);
return
Result
.
failed
(
"标题的字数不能大于20字"
);
...
@@ -98,7 +98,7 @@ public class WxFavoritesController {
...
@@ -98,7 +98,7 @@ public class WxFavoritesController {
public
Result
info
(
@RequestBody
FavoritesRequestDto
dto
)
{
public
Result
info
(
@RequestBody
FavoritesRequestDto
dto
)
{
logger
.
info
(
"【请求开始】收藏册详情查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】收藏册详情查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
return
Result
.
failed
(
"
收藏册id不能为空
"
);
return
Result
.
failed
(
"
请选择收藏册
"
);
}
}
return
favoritesService
.
info
(
dto
);
return
favoritesService
.
info
(
dto
);
}
}
...
@@ -118,7 +118,7 @@ public class WxFavoritesController {
...
@@ -118,7 +118,7 @@ public class WxFavoritesController {
public
Result
itemList
(
@RequestBody
FavoritesRequestDto
dto
)
{
public
Result
itemList
(
@RequestBody
FavoritesRequestDto
dto
)
{
logger
.
info
(
"【请求开始】收藏册下藏品列表分页查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】收藏册下藏品列表分页查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
return
Result
.
failed
(
"
收藏册id不能为空
"
);
return
Result
.
failed
(
"
请选择收藏册
"
);
}
}
if
(
Objects
.
isNull
(
dto
.
getPage
()))
{
if
(
Objects
.
isNull
(
dto
.
getPage
()))
{
return
Result
.
failed
(
"当前页不能为空"
);
return
Result
.
failed
(
"当前页不能为空"
);
...
@@ -134,7 +134,7 @@ public class WxFavoritesController {
...
@@ -134,7 +134,7 @@ public class WxFavoritesController {
public
Result
delete
(
@RequestBody
FavoritesRequestDto
dto
)
{
public
Result
delete
(
@RequestBody
FavoritesRequestDto
dto
)
{
logger
.
info
(
"【请求开始】收藏册单个删除,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】收藏册单个删除,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
return
Result
.
failed
(
"
收藏册id不能为空
"
);
return
Result
.
failed
(
"
请选择收藏册
"
);
}
}
return
favoritesService
.
delete
(
dto
);
return
favoritesService
.
delete
(
dto
);
}
}
...
@@ -144,7 +144,7 @@ public class WxFavoritesController {
...
@@ -144,7 +144,7 @@ public class WxFavoritesController {
public
Result
batchDelete
(
@RequestBody
FavoritesRequestDto
dto
)
{
public
Result
batchDelete
(
@RequestBody
FavoritesRequestDto
dto
)
{
logger
.
info
(
"【请求开始】收藏册批量删除,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】收藏册批量删除,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
CollectionUtils
.
isEmpty
(
dto
.
getIds
()))
{
if
(
CollectionUtils
.
isEmpty
(
dto
.
getIds
()))
{
return
Result
.
failed
(
"
收藏册id不能为空
"
);
return
Result
.
failed
(
"
请选择收藏册
"
);
}
}
return
favoritesService
.
batchDelete
(
dto
);
return
favoritesService
.
batchDelete
(
dto
);
}
}
...
@@ -154,7 +154,7 @@ public class WxFavoritesController {
...
@@ -154,7 +154,7 @@ public class WxFavoritesController {
public
Result
addItem
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
addItem
(
@RequestBody
ItemRequestDto
dto
)
{
logger
.
info
(
"【请求开始】收藏册收藏,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】收藏册收藏,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getFavoritesId
()))
{
if
(
Objects
.
isNull
(
dto
.
getFavoritesId
()))
{
return
Result
.
failed
(
"
收藏册id不能为空
"
);
return
Result
.
failed
(
"
请选择收藏册
"
);
}
}
if
(
CollectionUtils
.
isEmpty
(
dto
.
getItemIds
()))
{
if
(
CollectionUtils
.
isEmpty
(
dto
.
getItemIds
()))
{
return
Result
.
failed
(
"请选择藏品"
);
return
Result
.
failed
(
"请选择藏品"
);
...
@@ -170,7 +170,7 @@ public class WxFavoritesController {
...
@@ -170,7 +170,7 @@ public class WxFavoritesController {
return
Result
.
failed
(
"用户id不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
}
}
if
(
Objects
.
isNull
(
dto
.
getFavoritesId
()))
{
if
(
Objects
.
isNull
(
dto
.
getFavoritesId
()))
{
return
Result
.
failed
(
"
收藏册id不能为空
"
);
return
Result
.
failed
(
"
请选择收藏册
"
);
}
}
if
(
CollectionUtils
.
isEmpty
(
dto
.
getItemIds
()))
{
if
(
CollectionUtils
.
isEmpty
(
dto
.
getItemIds
()))
{
return
Result
.
failed
(
"请选择藏品"
);
return
Result
.
failed
(
"请选择藏品"
);
...
@@ -183,10 +183,10 @@ public class WxFavoritesController {
...
@@ -183,10 +183,10 @@ public class WxFavoritesController {
public
Result
moveItem
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
moveItem
(
@RequestBody
ItemRequestDto
dto
)
{
logger
.
info
(
"【请求开始】收藏册移动藏品,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】收藏册移动藏品,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getBeforeFavoritesId
()))
{
if
(
Objects
.
isNull
(
dto
.
getBeforeFavoritesId
()))
{
return
Result
.
failed
(
"
原收藏册不能为空
"
);
return
Result
.
failed
(
"
请选择原收藏册
"
);
}
}
if
(
Objects
.
isNull
(
dto
.
getAfterFavoritesId
()))
{
if
(
Objects
.
isNull
(
dto
.
getAfterFavoritesId
()))
{
return
Result
.
failed
(
"
现收藏册不能为空
"
);
return
Result
.
failed
(
"
请选择目标收藏册
"
);
}
}
if
(
CollectionUtils
.
isEmpty
(
dto
.
getItemIds
()))
{
if
(
CollectionUtils
.
isEmpty
(
dto
.
getItemIds
()))
{
return
Result
.
failed
(
"请选择藏品"
);
return
Result
.
failed
(
"请选择藏品"
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
View file @
2702c809
...
@@ -93,7 +93,7 @@ public class WxItemController {
...
@@ -93,7 +93,7 @@ public class WxItemController {
return
Result
.
failed
(
"分类id不能为空"
);
return
Result
.
failed
(
"分类id不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
dto
.
getName
()))
{
if
(
StringUtils
.
isBlank
(
dto
.
getName
()))
{
return
Result
.
failed
(
"
标题不能为空
"
);
return
Result
.
failed
(
"
请输入标题
"
);
}
}
if
(
StringUtils
.
isBlank
(
dto
.
getImages
()))
{
if
(
StringUtils
.
isBlank
(
dto
.
getImages
()))
{
return
Result
.
failed
(
"请至少上传一张图片"
);
return
Result
.
failed
(
"请至少上传一张图片"
);
...
@@ -116,7 +116,7 @@ public class WxItemController {
...
@@ -116,7 +116,7 @@ public class WxItemController {
return
Result
.
failed
(
"分类id不能为空"
);
return
Result
.
failed
(
"分类id不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
dto
.
getName
()))
{
if
(
StringUtils
.
isBlank
(
dto
.
getName
()))
{
return
Result
.
failed
(
"
标题不能为空
"
);
return
Result
.
failed
(
"
请输入标题
"
);
}
}
if
(
StringUtils
.
isBlank
(
dto
.
getImages
()))
{
if
(
StringUtils
.
isBlank
(
dto
.
getImages
()))
{
return
Result
.
failed
(
"请至少上传一张图片"
);
return
Result
.
failed
(
"请至少上传一张图片"
);
...
@@ -132,7 +132,7 @@ public class WxItemController {
...
@@ -132,7 +132,7 @@ public class WxItemController {
public
Result
info
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
info
(
@RequestBody
ItemRequestDto
dto
)
{
logger
.
info
(
"【请求开始】藏品详情查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】藏品详情查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
return
Result
.
failed
(
"
藏品id不能为空
"
);
return
Result
.
failed
(
"
请选择藏品
"
);
}
}
return
itemService
.
info
(
dto
);
return
itemService
.
info
(
dto
);
}
}
...
@@ -142,7 +142,7 @@ public class WxItemController {
...
@@ -142,7 +142,7 @@ public class WxItemController {
public
Result
del
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
del
(
@RequestBody
ItemRequestDto
dto
)
{
logger
.
info
(
"【请求开始】藏品详情查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】藏品详情查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
return
Result
.
failed
(
"
藏品id不能为空
"
);
return
Result
.
failed
(
"
请选择藏品
"
);
}
}
return
itemService
.
del
(
dto
);
return
itemService
.
del
(
dto
);
}
}
...
@@ -155,7 +155,7 @@ public class WxItemController {
...
@@ -155,7 +155,7 @@ public class WxItemController {
return
Result
.
failed
(
"您尚未登录,请先登录"
);
return
Result
.
failed
(
"您尚未登录,请先登录"
);
}
}
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
return
Result
.
failed
(
"
藏品id不能为空
"
);
return
Result
.
failed
(
"
请选择藏品
"
);
}
}
return
itemService
.
collect
(
dto
);
return
itemService
.
collect
(
dto
);
}
}
...
@@ -168,7 +168,7 @@ public class WxItemController {
...
@@ -168,7 +168,7 @@ public class WxItemController {
return
Result
.
failed
(
"您尚未登录,请先登录"
);
return
Result
.
failed
(
"您尚未登录,请先登录"
);
}
}
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
return
Result
.
failed
(
"
藏品id不能为空
"
);
return
Result
.
failed
(
"
请选择藏品
"
);
}
}
return
itemService
.
cancel
(
dto
);
return
itemService
.
cancel
(
dto
);
}
}
...
...
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