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