Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringBoot-kwan
提交
28d3b83a
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看板
提交
28d3b83a
编写于
10月 26, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:整理
上级
b611c2b4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
97 addition
and
0 deletion
+97
-0
src/main/java/com/kwan/springbootkwan/controller/CsdnTripletDayInfoController.java
...ringbootkwan/controller/CsdnTripletDayInfoController.java
+39
-0
src/main/java/com/kwan/springbootkwan/entity/dto/CsdnTripletDayInfoDTO.java
...kwan/springbootkwan/entity/dto/CsdnTripletDayInfoDTO.java
+39
-0
src/main/java/com/kwan/springbootkwan/entity/query/CsdnTripletDayInfoQuery.java
.../springbootkwan/entity/query/CsdnTripletDayInfoQuery.java
+19
-0
未找到文件。
src/main/java/com/kwan/springbootkwan/controller/CsdnTripletDayInfoController.java
浏览文件 @
28d3b83a
package
com.kwan.springbootkwan.controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.kwan.springbootkwan.entity.CsdnTripletDayInfo
;
import
com.kwan.springbootkwan.entity.Result
;
import
com.kwan.springbootkwan.entity.dto.CsdnTripletDayInfoDTO
;
import
com.kwan.springbootkwan.entity.query.CsdnTripletDayInfoQuery
;
import
com.kwan.springbootkwan.service.CsdnTripletDayInfoService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Objects
;
/**
* 每日三连监控(CsdnTripletDayInfo)表控制层
*
...
...
@@ -24,5 +35,33 @@ public class CsdnTripletDayInfoController {
public
Result
autoReply
()
{
return
Result
.
ok
(
csdnTripletDayInfoService
.
todayInfo
());
}
/**
* 分页查询所有数据
*
* @return 所有数据
*/
@PostMapping
(
"/page"
)
public
Result
selectAll
(
@RequestBody
CsdnTripletDayInfoQuery
query
)
{
final
Date
startDate
=
query
.
getStartDate
();
final
Date
endDate
=
query
.
getEndDate
();
Page
<
CsdnTripletDayInfo
>
pageParm
=
new
Page
<>();
pageParm
.
setCurrent
(
query
.
getPage
());
pageParm
.
setSize
(
query
.
getPageSize
());
QueryWrapper
<
CsdnTripletDayInfo
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"is_delete"
,
0
);
if
(
Objects
.
nonNull
(
startDate
))
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
startFormattedDate
=
sdf
.
format
(
startDate
);
wrapper
.
ge
(
"triplet_date"
,
startFormattedDate
);
}
if
(
Objects
.
nonNull
(
endDate
))
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
endFormattedDate
=
sdf
.
format
(
endDate
);
wrapper
.
le
(
"triplet_date"
,
endFormattedDate
);
}
wrapper
.
orderByDesc
(
"create_time"
);
return
Result
.
ok
(
CsdnTripletDayInfoDTO
.
Converter
.
INSTANCE
.
from
(
this
.
csdnTripletDayInfoService
.
page
(
pageParm
,
wrapper
)));
}
}
src/main/java/com/kwan/springbootkwan/entity/dto/CsdnTripletDayInfoDTO.java
0 → 100644
浏览文件 @
28d3b83a
package
com.kwan.springbootkwan.entity.dto
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.kwan.springbootkwan.entity.CsdnTripletDayInfo
;
import
com.kwan.springbootkwan.mapstruct.FromConverter
;
import
lombok.Data
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.ReportingPolicy
;
import
org.mapstruct.factory.Mappers
;
import
java.util.Date
;
@Data
public
class
CsdnTripletDayInfoDTO
extends
Model
<
CsdnTripletDayInfoDTO
>
{
//主键id
private
Integer
id
;
//三连日期
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
tripletDate
;
//点赞数量
private
Integer
likeNum
;
//收藏数量
private
Integer
collectNum
;
//评论数量
private
Integer
commentNum
;
//创建时间
private
Date
createTime
;
//更新时间
private
Date
updateTime
;
//逻辑删除,0未删除,1已删除
private
Integer
isDelete
;
@Mapper
(
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
public
interface
Converter
extends
FromConverter
<
CsdnTripletDayInfoDTO
,
CsdnTripletDayInfo
>
{
Converter
INSTANCE
=
Mappers
.
getMapper
(
Converter
.
class
);
}
}
\ No newline at end of file
src/main/java/com/kwan/springbootkwan/entity/query/CsdnTripletDayInfoQuery.java
0 → 100644
浏览文件 @
28d3b83a
package
com.kwan.springbootkwan.entity.query
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.kwan.springbootkwan.entity.BasePage
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
CsdnTripletDayInfoQuery
extends
BasePage
{
//主键id
private
Integer
id
;
//开始日期
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
startDate
;
//结束日期
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
endDate
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录