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
289005df
Commit
289005df
authored
Jul 19, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 收藏册
parent
512a3cb7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
47 deletions
+48
-47
ch-dao/src/main/java/com/wwdz/ch/db/manager/FavoritesCoinsRelationDao.java
...ava/com/wwdz/ch/db/manager/FavoritesCoinsRelationDao.java
+1
-1
ch-dao/src/main/java/com/wwdz/ch/db/manager/FavoritesDao.java
...ao/src/main/java/com/wwdz/ch/db/manager/FavoritesDao.java
+1
-1
ch-dao/src/main/java/com/wwdz/ch/db/manager/impl/FavoritesCoinsRelationDaoImpl.java
...wdz/ch/db/manager/impl/FavoritesCoinsRelationDaoImpl.java
+2
-2
ch-dao/src/main/java/com/wwdz/ch/db/manager/impl/FavoritesDaoImpl.java
...in/java/com/wwdz/ch/db/manager/impl/FavoritesDaoImpl.java
+2
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FavoritesService.java
...rc/main/java/com/wwdz/ch/wx/service/FavoritesService.java
+7
-6
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/impl/FavoritesServiceImpl.java
...ava/com/wwdz/ch/wx/service/impl/FavoritesServiceImpl.java
+26
-26
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
...c/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
+9
-9
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/
service
/FavoritesCoinsRelationDao.java
→
ch-dao/src/main/java/com/wwdz/ch/db/
manager
/FavoritesCoinsRelationDao.java
View file @
289005df
package
com.wwdz.ch.db.
service
;
package
com.wwdz.ch.db.
manager
;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.db.domain.FavoritesCoinsRelation
;
...
...
ch-dao/src/main/java/com/wwdz/ch/db/
service
/FavoritesDao.java
→
ch-dao/src/main/java/com/wwdz/ch/db/
manager
/FavoritesDao.java
View file @
289005df
package
com.wwdz.ch.db.
service
;
package
com.wwdz.ch.db.
manager
;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.db.domain.Favorites
;
...
...
ch-dao/src/main/java/com/wwdz/ch/db/
service
/impl/FavoritesCoinsRelationDaoImpl.java
→
ch-dao/src/main/java/com/wwdz/ch/db/
manager
/impl/FavoritesCoinsRelationDaoImpl.java
View file @
289005df
package
com.wwdz.ch.db.
service
.impl
;
package
com.wwdz.ch.db.
manager
.impl
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.db.dao.FavoritesCoinsRelationMapper
;
import
com.wwdz.ch.db.domain.FavoritesCoinsRelation
;
import
com.wwdz.ch.db.domain.FavoritesCoinsRelationExample
;
import
com.wwdz.ch.db.
service
.FavoritesCoinsRelationDao
;
import
com.wwdz.ch.db.
manager
.FavoritesCoinsRelationDao
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.util.CollectionUtils
;
...
...
ch-dao/src/main/java/com/wwdz/ch/db/
service
/impl/FavoritesDaoImpl.java
→
ch-dao/src/main/java/com/wwdz/ch/db/
manager
/impl/FavoritesDaoImpl.java
View file @
289005df
package
com.wwdz.ch.db.
service
.impl
;
package
com.wwdz.ch.db.
manager
.impl
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.db.dao.FavoritesMapper
;
import
com.wwdz.ch.db.domain.Favorites
;
import
com.wwdz.ch.db.domain.FavoritesExample
;
import
com.wwdz.ch.db.
service
.FavoritesDao
;
import
com.wwdz.ch.db.
manager
.FavoritesDao
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.util.CollectionUtils
;
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FavoritesService.java
View file @
289005df
package
com.wwdz.ch.wx.service
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.wx.entity.request.FavoritesRequestDto
;
public
interface
FavoritesService
{
Objec
t
page
(
FavoritesRequestDto
dto
);
Resul
t
page
(
FavoritesRequestDto
dto
);
Objec
t
add
(
FavoritesRequestDto
dto
);
Resul
t
add
(
FavoritesRequestDto
dto
);
Objec
t
update
(
FavoritesRequestDto
dto
);
Resul
t
update
(
FavoritesRequestDto
dto
);
Objec
t
info
(
FavoritesRequestDto
dto
);
Resul
t
info
(
FavoritesRequestDto
dto
);
Objec
t
delete
(
FavoritesRequestDto
dto
);
Resul
t
delete
(
FavoritesRequestDto
dto
);
Objec
t
batchDelete
(
FavoritesRequestDto
dto
);
Resul
t
batchDelete
(
FavoritesRequestDto
dto
);
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/impl/FavoritesServiceImpl.java
View file @
289005df
package
com.wwdz.ch.wx.service.impl
;
import
com.wwdz.ch.core.
util.ResponseUtil
;
import
com.wwdz.ch.core.
type.Result
;
import
com.wwdz.ch.db.domain.Favorites
;
import
com.wwdz.ch.db.domain.FavoritesCoinsRelation
;
import
com.wwdz.ch.db.
service
.FavoritesCoinsRelationDao
;
import
com.wwdz.ch.db.
service
.FavoritesDao
;
import
com.wwdz.ch.db.
manager
.FavoritesCoinsRelationDao
;
import
com.wwdz.ch.db.
manager
.FavoritesDao
;
import
com.wwdz.ch.wx.entity.request.FavoritesRequestDto
;
import
com.wwdz.ch.wx.service.FavoritesService
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -29,22 +29,22 @@ public class FavoritesServiceImpl implements FavoritesService {
private
FavoritesCoinsRelationDao
favoritesCoinsRelationDao
;
@Override
public
Objec
t
page
(
FavoritesRequestDto
dto
)
{
public
Resul
t
page
(
FavoritesRequestDto
dto
)
{
try
{
return
Res
ponseUtil
.
ok
(
favoritesDao
.
pageByUid
(
dto
.
getUid
(),
dto
.
getPage
(),
dto
.
getSize
()));
return
Res
ult
.
success
(
favoritesDao
.
pageByUid
(
dto
.
getUid
(),
dto
.
getPage
(),
dto
.
getSize
()));
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询收藏册列表失败,原因:"
+
e
.
getMessage
(),
e
);
return
Res
ponseUtil
.
fail
(-
1
,
"查询收藏册列表失败"
);
return
Res
ult
.
failed
(-
1
,
"查询收藏册列表失败"
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
Objec
t
add
(
FavoritesRequestDto
dto
)
{
public
Resul
t
add
(
FavoritesRequestDto
dto
)
{
try
{
// 判断收藏册标题是否已存在
if
(
favoritesDao
.
isExisted
(
null
,
dto
.
getUid
(),
dto
.
getTitle
()))
{
return
Res
ponseUtil
.
fail
(-
1
,
"收藏册的标题不能重复"
);
return
Res
ult
.
failed
(-
1
,
"收藏册的标题不能重复"
);
}
Favorites
favorites
=
new
Favorites
();
...
...
@@ -57,25 +57,25 @@ public class FavoritesServiceImpl implements FavoritesService {
favorites
.
setUpdateTime
(
date
);
favorites
.
setDeleted
(
false
);
favoritesDao
.
add
(
favorites
);
return
Res
ponseUtil
.
ok
();
return
Res
ult
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"新增收藏册失败,原因:"
+
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
Res
ponseUtil
.
fail
(-
1
,
"新增收藏册失败"
);
return
Res
ult
.
failed
(-
1
,
"新增收藏册失败"
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
Objec
t
update
(
FavoritesRequestDto
dto
)
{
public
Resul
t
update
(
FavoritesRequestDto
dto
)
{
try
{
Favorites
favorites
=
favoritesDao
.
info
(
dto
.
getId
());
if
(
Objects
.
isNull
(
favorites
))
{
return
Res
ponseUtil
.
fail
(-
1
,
"数据异常,记录不存在"
);
return
Res
ult
.
failed
(
"数据异常,记录不存在"
);
}
// 判断收藏册标题是否已存在
if
(
favoritesDao
.
isExisted
(
dto
.
getId
(),
dto
.
getUid
(),
dto
.
getTitle
()))
{
return
Res
ponseUtil
.
fail
(-
1
,
"收藏册的标题不能重复"
);
return
Res
ult
.
failed
(
"收藏册的标题不能重复"
);
}
favorites
.
setTitle
(
dto
.
getTitle
());
...
...
@@ -83,35 +83,35 @@ public class FavoritesServiceImpl implements FavoritesService {
favorites
.
setImages
(
dto
.
getImages
());
favorites
.
setUpdateTime
(
new
Date
());
favoritesDao
.
update
(
favorites
);
return
Res
ponseUtil
.
ok
();
return
Res
ult
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"新增收藏册失败,原因:"
+
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
Res
ponseUtil
.
fail
(-
1
,
"新增收藏册失败"
);
return
Res
ult
.
failed
(
"新增收藏册失败"
);
}
}
@Override
public
Objec
t
info
(
FavoritesRequestDto
dto
)
{
public
Resul
t
info
(
FavoritesRequestDto
dto
)
{
try
{
Favorites
favorites
=
favoritesDao
.
info
(
dto
.
getId
());
if
(
Objects
.
isNull
(
favorites
))
{
return
Res
ponseUtil
.
fail
(-
1
,
"数据异常,记录不存在"
);
return
Res
ult
.
failed
(
"数据异常,记录不存在"
);
}
return
Res
ponseUtil
.
ok
(
favorites
);
return
Res
ult
.
success
(
favorites
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"查看收藏册详情失败,原因:"
+
e
.
getMessage
(),
e
);
return
Res
ponseUtil
.
fail
(-
1
,
"查看收藏册详情失败"
);
return
Res
ult
.
failed
(
"查看收藏册详情失败"
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
Objec
t
delete
(
FavoritesRequestDto
dto
)
{
public
Resul
t
delete
(
FavoritesRequestDto
dto
)
{
try
{
List
<
FavoritesCoinsRelation
>
list
=
favoritesCoinsRelationDao
.
listByFavoritesId
(
dto
.
getId
(),
null
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
return
Res
ponseUtil
.
fail
(-
1
,
"收藏册内有藏品,清先移除藏品"
);
return
Res
ult
.
failed
(
"收藏册内有藏品,清先移除藏品"
);
}
//TODO 删除该收藏册下用户创建的钱币
...
...
@@ -121,17 +121,17 @@ public class FavoritesServiceImpl implements FavoritesService {
// 删除收藏册
favoritesDao
.
delete
(
dto
.
getId
(),
null
);
return
Res
ponseUtil
.
ok
();
return
Res
ult
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"批量删除收藏册失败,原因:"
+
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
Res
ponseUtil
.
fail
(-
1
,
"批量删除收藏册失败"
);
return
Res
ult
.
failed
(
"批量删除收藏册失败"
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
Objec
t
batchDelete
(
FavoritesRequestDto
dto
)
{
public
Resul
t
batchDelete
(
FavoritesRequestDto
dto
)
{
try
{
List
<
FavoritesCoinsRelation
>
list
=
favoritesCoinsRelationDao
.
listByFavoritesId
(
null
,
dto
.
getIds
());
//TODO 删除该收藏册下用户创建的钱币
...
...
@@ -141,11 +141,11 @@ public class FavoritesServiceImpl implements FavoritesService {
// 删除收藏册
favoritesDao
.
delete
(
null
,
dto
.
getIds
());
return
Res
ponseUtil
.
ok
();
return
Res
ult
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"批量删除收藏册失败,原因:"
+
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
Res
ponseUtil
.
fail
(-
1
,
"批量删除收藏册失败"
);
return
Res
ult
.
failed
(
"批量删除收藏册失败"
);
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
View file @
289005df
package
com.wwdz.ch.wx.web
;
import
com.github.pagehelper.Page
;
import
com.wwdz.ch.core.
util.ResponseUtil
;
import
com.wwdz.ch.core.
type.Result
;
import
com.wwdz.ch.wx.entity.request.FavoritesRequestDto
;
import
com.wwdz.ch.wx.service.FavoritesService
;
import
com.xxdxxs.support.Delete
;
...
...
@@ -29,37 +29,37 @@ public class WxFavoritesController {
private
FavoritesService
favoritesService
;
@PostMapping
(
"/page"
)
public
Objec
t
page
(
@RequestBody
@Validated
(
Page
.
class
)
FavoritesRequestDto
dto
)
{
public
Resul
t
page
(
@RequestBody
@Validated
(
Page
.
class
)
FavoritesRequestDto
dto
)
{
return
favoritesService
.
page
(
dto
);
}
@PostMapping
(
"/add"
)
public
Objec
t
add
(
@RequestBody
@Validated
(
Insert
.
class
)
FavoritesRequestDto
dto
)
{
public
Resul
t
add
(
@RequestBody
@Validated
(
Insert
.
class
)
FavoritesRequestDto
dto
)
{
return
favoritesService
.
add
(
dto
);
}
@PostMapping
(
"/update"
)
public
Objec
t
update
(
@RequestBody
@Validated
(
Update
.
class
)
FavoritesRequestDto
dto
)
{
public
Resul
t
update
(
@RequestBody
@Validated
(
Update
.
class
)
FavoritesRequestDto
dto
)
{
return
favoritesService
.
update
(
dto
);
}
@PostMapping
(
"/info"
)
public
Objec
t
info
(
@RequestBody
@Validated
(
Select
.
class
)
FavoritesRequestDto
dto
)
{
public
Resul
t
info
(
@RequestBody
@Validated
(
Select
.
class
)
FavoritesRequestDto
dto
)
{
return
favoritesService
.
info
(
dto
);
}
@PostMapping
(
"/delete"
)
public
Objec
t
delete
(
@RequestBody
@Validated
(
Delete
.
class
)
FavoritesRequestDto
dto
)
{
public
Resul
t
delete
(
@RequestBody
@Validated
(
Delete
.
class
)
FavoritesRequestDto
dto
)
{
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
return
Res
ponseUtil
.
fail
(-
1
,
"id不能为空"
);
return
Res
ult
.
failed
(
"id不能为空"
);
}
return
favoritesService
.
delete
(
dto
);
}
@PostMapping
(
"/batchDelete"
)
public
Objec
t
batchDelete
(
@RequestBody
@Validated
(
Delete
.
class
)
FavoritesRequestDto
dto
)
{
public
Resul
t
batchDelete
(
@RequestBody
@Validated
(
Delete
.
class
)
FavoritesRequestDto
dto
)
{
if
(
CollectionUtils
.
isEmpty
(
dto
.
getIds
()))
{
return
Res
ponseUtil
.
fail
(-
1
,
"请选择收藏册"
);
return
Res
ult
.
failed
(
"请选择收藏册"
);
}
return
favoritesService
.
batchDelete
(
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