You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.2 KiB
35 lines
1.2 KiB
package com.qsd.orange.controller;
|
|
|
|
import com.qsd.orange.global.R;
|
|
import com.qsd.orange.po.SysAnnouncement;
|
|
import com.qsd.orange.service.AnnouncementService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.security.core.Authentication;
|
|
import org.springframework.security.core.userdetails.User;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import javax.validation.Valid;
|
|
|
|
@RestController
|
|
@RequestMapping("system/announcement")
|
|
public class SystemAnnouncementController {
|
|
|
|
@Autowired
|
|
private AnnouncementService announcementService;
|
|
|
|
@PostMapping("add")
|
|
public R add(@Valid SysAnnouncement announcement, Authentication authentication){
|
|
User user = (User)authentication.getPrincipal();
|
|
String username = user.getUsername();
|
|
return R.choose(announcementService.add(announcement, username) > 0);
|
|
}
|
|
|
|
@PostMapping("update")
|
|
public R update(SysAnnouncement announcement){
|
|
return R.choose(announcementService.update(announcement) > 0);
|
|
}
|
|
|
|
}
|