81 lines
2.5 KiB
Java
81 lines
2.5 KiB
Java
package com.muyu.system.controller;
|
|
|
|
import com.muyu.common.core.web.controller.BaseController;
|
|
import com.muyu.common.core.domain.Result;
|
|
import com.muyu.common.core.web.page.TableDataInfo;
|
|
import com.muyu.common.log.annotation.Log;
|
|
import com.muyu.common.log.enums.BusinessType;
|
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
|
import com.muyu.common.security.utils.SecurityUtils;
|
|
import com.muyu.system.domain.SysNotice;
|
|
import com.muyu.system.service.SysNoticeService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 公告 信息操作处理
|
|
*
|
|
* @author muyu
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/notice")
|
|
public class SysNoticeController extends BaseController {
|
|
@Autowired
|
|
private SysNoticeService noticeService;
|
|
|
|
/**
|
|
* 获取通知公告列表
|
|
*/
|
|
@RequiresPermissions("system:notice:list")
|
|
@GetMapping("/list")
|
|
public Result<TableDataInfo<SysNotice>> list (SysNotice notice) {
|
|
startPage();
|
|
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
|
return getDataTable(list);
|
|
}
|
|
|
|
/**
|
|
* 根据通知公告编号获取详细信息
|
|
*/
|
|
@RequiresPermissions("system:notice:query")
|
|
@GetMapping(value = "/{noticeId}")
|
|
public Result getInfo (@PathVariable("noticeId") Long noticeId) {
|
|
return success(noticeService.selectNoticeById(noticeId));
|
|
}
|
|
|
|
/**
|
|
* 新增通知公告
|
|
*/
|
|
@RequiresPermissions("system:notice:add")
|
|
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
|
@PostMapping
|
|
public Result add (@Validated @RequestBody SysNotice notice) {
|
|
notice.setCreateBy(SecurityUtils.getUsername());
|
|
return toAjax(noticeService.insertNotice(notice));
|
|
}
|
|
|
|
/**
|
|
* 修改通知公告
|
|
*/
|
|
@RequiresPermissions("system:notice:edit")
|
|
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
|
@PutMapping
|
|
public Result edit (@Validated @RequestBody SysNotice notice) {
|
|
notice.setUpdateBy(SecurityUtils.getUsername());
|
|
return toAjax(noticeService.updateNotice(notice));
|
|
}
|
|
|
|
/**
|
|
* 删除通知公告
|
|
*/
|
|
@RequiresPermissions("system:notice:remove")
|
|
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{noticeIds}")
|
|
public Result remove (@PathVariable("noticeIds") Long[] noticeIds) {
|
|
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
|
}
|
|
}
|