Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fzm-joying
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
lei
fzm-joying
Commits
198ea7f3
Commit
198ea7f3
authored
Aug 05, 2021
by
tangtuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化我的nft列表接口
parent
69a2cd26
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
39 additions
and
32 deletions
+39
-32
NftMapper.java
...common/src/main/java/com/fzm/common/mapper/NftMapper.java
+2
-0
CategoryService.java
...src/main/java/com/fzm/common/service/CategoryService.java
+0
-3
NftService.java
...mmon/src/main/java/com/fzm/common/service/NftService.java
+1
-1
CategoryServiceImpl.java
...java/com/fzm/common/service/impl/CategoryServiceImpl.java
+0
-11
NftServiceImpl.java
...main/java/com/fzm/common/service/impl/NftServiceImpl.java
+2
-9
NftMapper.xml
joying-common/src/main/resources/mapper/NftMapper.xml
+17
-0
NftController.java
...rc/main/java/com/fzm/portal/controller/NftController.java
+5
-8
Test.java
joying-portal/src/test/java/com/fzm/portal/Test.java
+12
-0
No files found.
joying-common/src/main/java/com/fzm/common/mapper/NftMapper.java
View file @
198ea7f3
...
...
@@ -42,4 +42,6 @@ public interface NftMapper extends BaseMapper<Nft> {
* @return
*/
List
<
NftListVo
>
page
(
@Param
(
"categoryId"
)
Integer
categoryId
,
@Param
(
"name"
)
String
name
,
@Param
(
"telephone"
)
String
telephone
,
@Param
(
"theme"
)
String
theme
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"startDate"
)
DateTime
startDate
,
@Param
(
"endDate"
)
DateTime
endDate
);
List
<
CollectionNftVo
>
listCurrent
(
@Param
(
"categoryId"
)
Integer
categoryId
,
@Param
(
"userId"
)
Integer
userId
);
}
joying-common/src/main/java/com/fzm/common/service/CategoryService.java
View file @
198ea7f3
...
...
@@ -11,8 +11,5 @@ import java.util.List;
*/
public
interface
CategoryService
extends
IService
<
Category
>
{
Category
getCategoryById
(
Integer
categoryId
);
List
<
Category
>
listAll
();
}
joying-common/src/main/java/com/fzm/common/service/NftService.java
View file @
198ea7f3
...
...
@@ -56,7 +56,7 @@ public interface NftService extends IService<Nft> {
* @param userId
* @return
*/
List
<
Nft
>
listCurrent
(
Integer
categoryId
,
Integer
userId
);
List
<
CollectionNftVo
>
listCurrent
(
Integer
categoryId
,
Integer
userId
);
/**
* 生成nft编号
...
...
joying-common/src/main/java/com/fzm/common/service/impl/CategoryServiceImpl.java
View file @
198ea7f3
...
...
@@ -17,17 +17,6 @@ import java.util.List;
public
class
CategoryServiceImpl
extends
ServiceImpl
<
CategoryMapper
,
Category
>
implements
CategoryService
{
@Override
public
Category
getCategoryById
(
Integer
categoryId
)
{
List
<
Category
>
list
=
list
();
for
(
Category
category
:
list
)
{
if
(
categoryId
.
equals
(
category
.
getId
()))
{
return
category
;
}
}
return
null
;
}
@Override
@Cacheable
(
value
=
"category"
,
key
=
"'list'"
)
public
List
<
Category
>
listAll
()
{
return
list
();
...
...
joying-common/src/main/java/com/fzm/common/service/impl/NftServiceImpl.java
View file @
198ea7f3
...
...
@@ -270,15 +270,8 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
}
@Override
public
List
<
Nft
>
listCurrent
(
Integer
categoryId
,
Integer
userId
)
{
QueryWrapper
<
Nft
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"user_id"
,
userId
);
queryWrapper
.
ne
(
"nft_hash"
,
""
);
if
(
categoryId
!=
null
)
{
queryWrapper
.
eq
(
"category_id"
,
categoryId
);
}
queryWrapper
.
orderByDesc
(
"publish_time"
);
return
nftMapper
.
selectList
(
queryWrapper
);
public
List
<
CollectionNftVo
>
listCurrent
(
Integer
categoryId
,
Integer
userId
)
{
return
nftMapper
.
listCurrent
(
categoryId
,
userId
);
}
@Override
...
...
joying-common/src/main/resources/mapper/NftMapper.xml
View file @
198ea7f3
...
...
@@ -76,4 +76,20 @@
publish_time DESC
</select>
<select
id=
"listCurrent"
resultType=
"com.fzm.common.entity.vo.CollectionNftVo"
>
select a.id,
a.name,
a.cover,
a.theme,
a.nft_id,
a.is_commemorate,
b.category_name as category
from tb_nft a left join tb_category b on a.category_id = b.id
where a.user_id = #{userId} and a.nft_hash != ''
<if
test=
"categoryId != null"
>
and a.category_id = #{categoryId}
</if>
order by a.publish_time desc
</select>
</mapper>
\ No newline at end of file
joying-portal/src/main/java/com/fzm/portal/controller/NftController.java
View file @
198ea7f3
...
...
@@ -93,8 +93,8 @@ public class NftController {
@GetMapping
(
"/list"
)
@ApiOperation
(
value
=
"获取nft列表"
)
public
ResponseModel
<
List
<
Nft
>>
list
(
@ApiParam
(
value
=
"当前页码"
)
@RequestParam
Integer
pageNum
,
@ApiParam
(
value
=
"每页记录数"
)
@RequestParam
Integer
pageSize
,
@ApiParam
(
value
=
"类目id,查询所有的时候传null"
)
@RequestParam
(
required
=
false
)
Integer
categoryId
)
{
@ApiParam
(
value
=
"每页记录数"
)
@RequestParam
Integer
pageSize
,
@ApiParam
(
value
=
"类目id,查询所有的时候传null"
)
@RequestParam
(
required
=
false
)
Integer
categoryId
)
{
pageNum
=
(
pageNum
-
1
)
*
pageSize
;
List
<
Nft
>
list
=
nftService
.
list
(
pageNum
,
pageSize
,
categoryId
);
...
...
@@ -130,10 +130,7 @@ public class NftController {
@ApiOperation
(
value
=
"获取我的nft列表"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
listCurrent
(
@ApiParam
(
value
=
"类目id,查询全部的时候传null"
)
@RequestParam
(
required
=
false
)
Integer
categoryId
)
throws
Exception
{
Integer
userId
=
JwtUtil
.
getUserIdFromToken
(
request
.
getHeader
(
"Authorization"
));
List
<
Nft
>
list
=
nftService
.
listCurrent
(
categoryId
,
userId
);
List
<
CollectionNftVo
>
nftVoList
=
list
.
stream
()
.
map
(
nft
->
new
CollectionNftVo
(
nft
,
categoryService
.
getCategoryById
(
nft
.
getCategoryId
())))
.
collect
(
Collectors
.
toList
());
List
<
CollectionNftVo
>
list
=
nftService
.
listCurrent
(
categoryId
,
userId
);
User
user
=
userService
.
getById
(
userId
);
// 生成二维码
HashMap
<
String
,
Object
>
qrCodeMap
=
new
HashMap
<>();
...
...
@@ -142,8 +139,8 @@ public class NftController {
qrCodeMap
.
put
(
"wallet"
,
user
.
getWallet
());
String
qrCode
=
QRCodeUtil
.
encode
(
JsonUtil
.
toJson
(
qrCodeMap
),
null
,
false
);
HashMap
<
String
,
Object
>
result
=
new
HashMap
<>(
8
);
result
.
put
(
"list"
,
nftVoL
ist
);
result
.
put
(
"size"
,
nftVoL
ist
.
size
());
result
.
put
(
"list"
,
l
ist
);
result
.
put
(
"size"
,
l
ist
.
size
());
result
.
put
(
"qrCode"
,
qrCode
);
return
ResponseModel
.
success
(
result
);
}
...
...
joying-portal/src/test/java/com/fzm/portal/Test.java
0 → 100644
View file @
198ea7f3
package
com
.
fzm
.
portal
;
/**
* @author tangtuo
* @date 2021/8/5 14:21
*/
public
class
Test
{
public
static
void
main
(
String
[]
args
)
{
}
}
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