From 7ea5eece501c98a91555a5358931367e78e9d23b Mon Sep 17 00:00:00 2001
From: baizonghao <1719256278@qq.com>
Date: 星期四, 25 五月 2023 15:40:09 +0800
Subject: [PATCH] 11
---
src/main/java/com/example/jz/controller/PublicityController.java | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/example/jz/controller/PublicityController.java b/src/main/java/com/example/jz/controller/PublicityController.java
index 7a24eb8..6256a0e 100644
--- a/src/main/java/com/example/jz/controller/PublicityController.java
+++ b/src/main/java/com/example/jz/controller/PublicityController.java
@@ -22,6 +22,8 @@
import javax.annotation.Resource;
import java.io.Serializable;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -56,9 +58,15 @@
ArrayList<PublicityVo> publicityVos = new ArrayList<>();
PageParam<Publicity> publicityPageParam ;
if (publicity.getStatus()!=null ){
- publicityPageParam = publicityService.page(page, new QueryWrapper<Publicity>().like(StringUtils.isNotBlank(publicity.getPublicityTitle()),"publicity_title",publicity.getPublicityTitle()).eq("status",publicity.getStatus()).orderByDesc("ctime"));
+ publicityPageParam = publicityService.page(page,
+ new QueryWrapper<Publicity>().like(StringUtils.isNotBlank(publicity.getPublicityTitle()),
+ "publicity_title",
+ publicity.getPublicityTitle()).eq("status",publicity.getStatus()).orderByDesc("ctime"));
}else {
- publicityPageParam = publicityService.page(page, new QueryWrapper<Publicity>().like(StringUtils.isNotBlank(publicity.getPublicityTitle()),"publicity_title",publicity.getPublicityTitle()).orderByDesc("ctime"));
+ publicityPageParam = publicityService.page(page,
+ new QueryWrapper<Publicity>().like(StringUtils.isNotBlank(publicity.getPublicityTitle()),
+ "publicity_title",
+ publicity.getPublicityTitle()).orderByDesc("ctime"));
}
publicityPageParam.getRecords().forEach(item->{
PublicityVo publicityVo = new PublicityVo();
@@ -72,6 +80,20 @@
return R.ok(publicityVoPageParam);
}
+ @GetMapping("changTime")
+ @ApiOperation("淇敼鏃堕棿")
+ public R changeTime(@RequestParam Integer id, @RequestParam String time){
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ Publicity publicity = publicityService.getById(id);
+ try {
+ publicity.setReleaseTime(sdf.parse(time));
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ boolean b = publicityService.updateById(publicity);
+ return b ? R.ok("淇敼鎴愬姛") : R.failed("淇敼澶辫触");
+ }
+
/**
* 閫氳繃涓婚敭鏌ヨ鍗曟潯鏁版嵁
*
--
Gitblit v1.8.0