Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringBoot-kwan
提交
f2ee01ec
S
SpringBoot-kwan
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
SpringBoot-kwan
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringBoot-kwan
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
f2ee01ec
编写于
10月 25, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:添加分页
上级
e96ed8dd
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
18 deletion
+31
-18
src/main/java/com/kwan/springbootkwan/controller/CsdnUserController.java
...om/kwan/springbootkwan/controller/CsdnUserController.java
+12
-8
src/main/java/com/kwan/springbootkwan/entity/BasePage.java
src/main/java/com/kwan/springbootkwan/entity/BasePage.java
+9
-0
src/main/java/com/kwan/springbootkwan/entity/query/CsdnUserInfoQuery.java
...m/kwan/springbootkwan/entity/query/CsdnUserInfoQuery.java
+2
-1
src/main/java/com/kwan/springbootkwan/service/impl/CsdnServiceImpl.java
...com/kwan/springbootkwan/service/impl/CsdnServiceImpl.java
+8
-9
未找到文件。
src/main/java/com/kwan/springbootkwan/controller/CsdnUserController.java
浏览文件 @
f2ee01ec
...
...
@@ -18,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Objects
;
@Slf4j
@RestController
@RequestMapping
(
"/csdn/user"
)
...
...
@@ -32,27 +34,29 @@ public class CsdnUserController {
*
* @return 所有数据
*/
@
Ge
tMapping
(
"/page"
)
public
Result
selectAll
(
@Request
Param
Integer
page
,
@RequestParam
Integer
pageSize
,
@RequestParam
String
userName
,
@RequestParam
String
nickName
)
{
@
Pos
tMapping
(
"/page"
)
public
Result
selectAll
(
@Request
Body
CsdnUserInfoQuery
query
)
{
final
Integer
userWeight
=
query
.
getUserWeight
();
final
String
nickName
=
query
.
getNickName
();
final
String
userName
=
query
.
getUserName
();
Page
<
CsdnUserInfo
>
pageParm
=
new
Page
<>();
pageParm
.
setCurrent
(
page
);
pageParm
.
setSize
(
pageSize
);
pageParm
.
setCurrent
(
query
.
getPage
()
);
pageParm
.
setSize
(
query
.
getPageSize
()
);
QueryWrapper
<
CsdnUserInfo
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
orderByDesc
(
"user_weight"
);
wrapper
.
eq
(
"is_delete"
,
0
);
if
(
StringUtils
.
isNotEmpty
(
userName
))
{
wrapper
.
eq
(
"user_name"
,
userName
);
}
if
(
Objects
.
nonNull
(
userWeight
))
{
wrapper
.
eq
(
"user_weight"
,
userWeight
);
}
if
(
StringUtils
.
isNotEmpty
(
nickName
))
{
wrapper
.
like
(
"nick_name"
,
nickName
);
}
return
Result
.
ok
(
CsdnUserInfoDTO
.
Converter
.
INSTANCE
.
from
(
this
.
csdnUserInfoService
.
page
(
pageParm
,
wrapper
)));
}
/**
* 新增用户
*
...
...
src/main/java/com/kwan/springbootkwan/entity/BasePage.java
0 → 100644
浏览文件 @
f2ee01ec
package
com.kwan.springbootkwan.entity
;
import
lombok.Data
;
@Data
public
class
BasePage
{
private
Integer
page
;
private
Integer
pageSize
;
}
src/main/java/com/kwan/springbootkwan/entity/query/CsdnUserInfoQuery.java
浏览文件 @
f2ee01ec
package
com.kwan.springbootkwan.entity.query
;
import
com.kwan.springbootkwan.entity.BasePage
;
import
lombok.Data
;
@Data
public
class
CsdnUserInfoQuery
{
public
class
CsdnUserInfoQuery
extends
BasePage
{
/**
* 主键id
*/
...
...
src/main/java/com/kwan/springbootkwan/service/impl/CsdnServiceImpl.java
浏览文件 @
f2ee01ec
...
...
@@ -68,17 +68,16 @@ public class CsdnServiceImpl implements CsdnService {
wrapper
.
eq
(
"is_delete"
,
0
);
wrapper
.
eq
(
"comment_status"
,
9
);
final
List
<
CsdnUserInfo
>
comments
=
csdnUserInfoService
.
list
(
wrapper
);
if
(
CollectionUtil
.
isNotEmpty
(
comments
))
{
if
(
comments
.
size
()
>=
49
)
{
csdnUserInfo
.
setCommentStatus
(
CommentStatus
.
COMMENT_NUM_49
.
getCode
());
}
else
{
//评论
final
Boolean
comment
=
csdnCommentService
.
isComment
(
article
,
csdnUserInfo
);
if
(!
comment
)
{
csdnCommentService
.
comment
(
articleId
,
csdnUserInfo
);
}
if
(
CollectionUtil
.
isEmpty
(
comments
)
||
comments
.
size
()
<
49
)
{
//评论
final
Boolean
comment
=
csdnCommentService
.
isComment
(
article
,
csdnUserInfo
);
if
(!
comment
)
{
csdnCommentService
.
comment
(
articleId
,
csdnUserInfo
);
}
}
if
(
CollectionUtil
.
isNotEmpty
(
comments
)
&&
comments
.
size
()
>=
49
)
{
csdnUserInfo
.
setCommentStatus
(
CommentStatus
.
COMMENT_NUM_49
.
getCode
());
}
//收藏
final
Boolean
collect
=
csdnCollectService
.
isCollect
(
articleId
,
csdnUserInfo
);
if
(!
collect
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录