From a75bb5cc48daa9eaf6e40933e96bb0b8ff144ddc Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期四, 12 九月 2024 09:18:55 +0800 Subject: [PATCH] 代码提交 --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java | 38 +++++++++++++++++++++++++++++++++----- 1 files changed, 33 insertions(+), 5 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java index 5fdd48e..ff18893 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java @@ -1,8 +1,11 @@ package com.ruoyi.other.controller; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.other.api.domain.TNotice; import com.ruoyi.other.api.dto.NoticeQueryDto; import com.ruoyi.other.mapper.SysNoticeMapper; @@ -11,7 +14,9 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.List; /** * <p> @@ -29,21 +34,35 @@ @ApiOperation(tags = {"后台-内容设置-公告管理"},value = "新增修改") @PostMapping(value = "/saveOrUpdate") + @Log(title = "【公告管理】新增修改公告", businessType = BusinessType.INSERT) public AjaxResult saveOrUpdate(@RequestBody TNotice notice) { noticeService.saveOrUpdate(notice); return AjaxResult.success(); } @ApiOperation(tags = {"后台-内容设置-公告管理"},value = "删除") - @PostMapping(value = "/deleteById/{id}") - public AjaxResult deleteById(@PathVariable Integer id) { - noticeService.removeById(id); + @DeleteMapping(value = "/deleteById") + @Log(title = "【公告管理】删除公告", businessType = BusinessType.DELETE) + public AjaxResult deleteById(String ids) { + String[] split = ids.split(","); + for (String id : split) { + noticeService.removeById(id); + } + return AjaxResult.success(); } @ApiOperation(tags = {"后台-内容设置-公告管理"},value = "查询") @PostMapping(value = "/pageList") public AjaxResult<Page<TNotice>> authPageList(@RequestBody NoticeQueryDto query) { + if (query.getStatus()==null){ + + return AjaxResult.success(noticeService.lambdaQuery() + .like(query.getContent()!=null&&query.getContent()!="",TNotice::getContent,query.getContent()) + .page(Page.of(query.getPageCurr(),query.getPageSize()))); + + } + if (query.getStatus()==0){ return AjaxResult.success(noticeService.lambdaQuery() .le(TNotice::getStartTime, LocalDateTime.now()) @@ -61,12 +80,21 @@ .page(Page.of(query.getPageCurr(),query.getPageSize()))); }else{ return AjaxResult.success(noticeService.lambdaQuery() - .like(query.getContent() != null && query.getContent() != "", TNotice::getContent, query.getContent()) - .page(Page.of(query.getPageCurr(), query.getPageSize()))); + .like(query.getContent()!=null&&query.getContent()!="",TNotice::getContent,query.getContent()) + .page(Page.of(query.getPageCurr(),query.getPageSize()))); } } + @ApiOperation(tags = {"小程序-首页-公告管理"},value = "查询") + @GetMapping(value = "/list") + public AjaxResult<List<TNotice>> list() { + return AjaxResult.success(noticeService.list(Wrappers.lambdaQuery(TNotice.class) + .le(TNotice::getStartTime, LocalDate.now()) + .ge(TNotice::getEndTime,LocalDate.now()))); + + } + } -- Gitblit v1.7.1