admin
2024-04-24 363457b34e0e4f26ffe51aa80ecb227bf7873308
提交 | 用户 | 时间
363457 1 package com.jcdm.web.controller.system;
A 2
3 import java.util.List;
4 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.security.access.prepost.PreAuthorize;
6 import org.springframework.validation.annotation.Validated;
7 import org.springframework.web.bind.annotation.DeleteMapping;
8 import org.springframework.web.bind.annotation.GetMapping;
9 import org.springframework.web.bind.annotation.PathVariable;
10 import org.springframework.web.bind.annotation.PostMapping;
11 import org.springframework.web.bind.annotation.PutMapping;
12 import org.springframework.web.bind.annotation.RequestBody;
13 import org.springframework.web.bind.annotation.RequestMapping;
14 import org.springframework.web.bind.annotation.RestController;
15 import com.jcdm.common.annotation.Log;
16 import com.jcdm.common.core.controller.BaseController;
17 import com.jcdm.common.core.domain.AjaxResult;
18 import com.jcdm.common.core.page.TableDataInfo;
19 import com.jcdm.common.enums.BusinessType;
20 import com.jcdm.system.domain.SysNotice;
21 import com.jcdm.system.service.ISysNoticeService;
22
23 /**
24  * 公告 信息操作处理
25  * 
26  * @author jc
27  */
28 @RestController
29 @RequestMapping("/system/notice")
30 public class SysNoticeController extends BaseController
31 {
32     @Autowired
33     private ISysNoticeService noticeService;
34
35     /**
36      * 获取通知公告列表
37      */
38     @PreAuthorize("@ss.hasPermi('system:notice:list')")
39     @GetMapping("/list")
40     public TableDataInfo list(SysNotice notice)
41     {
42         startPage();
43         List<SysNotice> list = noticeService.selectNoticeList(notice);
44         return getDataTable(list);
45     }
46
47     /**
48      * 根据通知公告编号获取详细信息
49      */
50     @PreAuthorize("@ss.hasPermi('system:notice:query')")
51     @GetMapping(value = "/{noticeId}")
52     public AjaxResult getInfo(@PathVariable Long noticeId)
53     {
54         return success(noticeService.selectNoticeById(noticeId));
55     }
56
57     /**
58      * 新增通知公告
59      */
60     @PreAuthorize("@ss.hasPermi('system:notice:add')")
61     @Log(title = "通知公告", businessType = BusinessType.INSERT)
62     @PostMapping
63     public AjaxResult add(@Validated @RequestBody SysNotice notice)
64     {
65         notice.setCreateBy(getUsername());
66         return toAjax(noticeService.insertNotice(notice));
67     }
68
69     /**
70      * 修改通知公告
71      */
72     @PreAuthorize("@ss.hasPermi('system:notice:edit')")
73     @Log(title = "通知公告", businessType = BusinessType.UPDATE)
74     @PutMapping
75     public AjaxResult edit(@Validated @RequestBody SysNotice notice)
76     {
77         notice.setUpdateBy(getUsername());
78         return toAjax(noticeService.updateNotice(notice));
79     }
80
81     /**
82      * 删除通知公告
83      */
84     @PreAuthorize("@ss.hasPermi('system:notice:remove')")
85     @Log(title = "通知公告", businessType = BusinessType.DELETE)
86     @DeleteMapping("/{noticeIds}")
87     public AjaxResult remove(@PathVariable Long[] noticeIds)
88     {
89         return toAjax(noticeService.deleteNoticeByIds(noticeIds));
90     }
91 }