From aa8836a65e97e297340fff3a42615f0a36f314e7 Mon Sep 17 00:00:00 2001 From: baizonghao <1719256278@qq.com> Date: 星期一, 22 五月 2023 16:10:10 +0800 Subject: [PATCH] 后台管理端删除聊天记录,新增新增头像,用户管理删选条件等 --- 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