| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.other.api.domain.TNotice; |
| | | import com.ruoyi.other.api.dto.NoticeQueryDto; |
| | | import com.ruoyi.other.mapper.SysNoticeMapper; |
| | | import com.ruoyi.other.service.TNoticeService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RestController |
| | | @RequestMapping("/t-notice") |
| | | public class TNoticeController { |
| | | @Resource |
| | | private TNoticeService noticeService; |
| | | |
| | | @ApiOperation(tags = {"后台-内容设置-公告管理"},value = "新增修改") |
| | | @PostMapping(value = "/saveOrUpdate") |
| | | 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); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-内容设置-公告管理"},value = "查询") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<Page<TNotice>> authPageList(@RequestBody NoticeQueryDto query) { |
| | | if (query.getStatus()==0){ |
| | | return AjaxResult.success(noticeService.lambdaQuery() |
| | | .le(TNotice::getStartTime, LocalDateTime.now()) |
| | | .like(query.getContent()!=null&&query.getContent()!="",TNotice::getContent,query.getContent()) |
| | | .page(Page.of(query.getPageCurr(),query.getPageSize()))); |
| | | }else if (query.getStatus()==1){ |
| | | return AjaxResult.success(noticeService.lambdaQuery() |
| | | .ge(TNotice::getStartTime, LocalDateTime.now()).le(TNotice::getEndTime,LocalDateTime.now()) |
| | | .like(query.getContent()!=null&&query.getContent()!="",TNotice::getContent,query.getContent()) |
| | | .page(Page.of(query.getPageCurr(),query.getPageSize()))); |
| | | }else if (query.getStatus()==2){ |
| | | return AjaxResult.success(noticeService.lambdaQuery() |
| | | .ge(TNotice::getEndTime, LocalDateTime.now()) |
| | | .like(query.getContent()!=null&&query.getContent()!="",TNotice::getContent,query.getContent()) |
| | | .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()))); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | |