| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.model.TNotice; |
| | | import com.ruoyi.system.query.TNoticeQuery; |
| | | import com.ruoyi.system.service.TNoticeService; |
| | | import com.ruoyi.system.vo.TNoticeVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2025-11-06 |
| | | */ |
| | | @Api(tags = "社区公告管理") |
| | | @RestController |
| | | @RequestMapping("/t-notice") |
| | | public class TNoticeController { |
| | | |
| | | private final TNoticeService noticeService; |
| | | @Autowired |
| | | public TNoticeController(TNoticeService noticeService) { |
| | | this.noticeService = noticeService; |
| | | } |
| | | |
| | | /** |
| | | * 获取社区公告管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取社区公告管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TNoticeVO>> pageList(@RequestBody TNoticeQuery query) { |
| | | return R.ok(noticeService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 获取社区公告管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取社区公告管理列表") |
| | | @PostMapping(value = "/list") |
| | | public R<List<TNotice>> list() { |
| | | return R.ok(noticeService.list(Wrappers.lambdaQuery(TNotice.class).orderByDesc(TNotice::getCreateTime))); |
| | | } |
| | | |
| | | /** |
| | | * 添加社区公告管理管理 |
| | | */ |
| | | @Log(title = "社区公告管理信息-新增社区公告管理", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加社区公告管理") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TNotice dto) { |
| | | if (noticeService.isExit(dto)) { |
| | | return R.fail("社区公告管理标题已存在"); |
| | | } |
| | | return R.ok(noticeService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改社区公告管理 |
| | | */ |
| | | @Log(title = "社区公告管理信息-修改社区公告管理", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改社区公告管理") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TNotice dto) { |
| | | if (noticeService.isExit(dto)) { |
| | | return R.fail("社区公告管理标题已存在"); |
| | | } |
| | | return R.ok(noticeService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看社区公告管理详情 |
| | | */ |
| | | @ApiOperation(value = "查看社区公告管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TNotice> getDetailById(@RequestParam String id) { |
| | | return R.ok(noticeService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除社区公告管理 |
| | | */ |
| | | @Log(title = "社区公告管理信息-删除社区公告管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除社区公告管理") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(noticeService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除社区公告管理 |
| | | */ |
| | | @Log(title = "社区公告管理信息-删除社区公告管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除社区公告管理") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(noticeService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | | |