|
|
@ -55,48 +55,12 @@ public class NoticeController { |
|
|
|
@Autowired |
|
|
|
private NoticeService noticeService; |
|
|
|
|
|
|
|
@GetMapping("page") |
|
|
|
public Result<PageData<NoticeDTO>> page(@RequestParam Map<String, Object> params){ |
|
|
|
PageData<NoticeDTO> page = noticeService.page(params); |
|
|
|
return new Result<PageData<NoticeDTO>>().ok(page); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("{id}") |
|
|
|
public Result<NoticeDTO> get(@PathVariable("id") String id){ |
|
|
|
NoticeDTO data = noticeService.get(id); |
|
|
|
return new Result<NoticeDTO>().ok(data); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping |
|
|
|
public Result save(@RequestBody NoticeDTO dto){ |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|
|
|
noticeService.save(dto); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping |
|
|
|
public Result update(@RequestBody NoticeDTO dto){ |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|
|
|
noticeService.update(dto); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@DeleteMapping |
|
|
|
public Result delete(@RequestBody String[] ids){ |
|
|
|
//效验数据
|
|
|
|
AssertUtils.isArrayEmpty(ids, "id"); |
|
|
|
noticeService.delete(ids); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("export") |
|
|
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|
|
|
List<NoticeDTO> list = noticeService.list(params); |
|
|
|
ExcelUtils.exportExcelToTarget(response, null, list, NoticeExcel.class); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
@ -105,7 +69,7 @@ public class NoticeController { |
|
|
|
**/ |
|
|
|
@PostMapping(value = "add") |
|
|
|
public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddNoticeFormDTO formDTO){ |
|
|
|
ValidatorUtils.validateEntity(formDTO, AddNoticeFormDTO.Add.class); |
|
|
|
ValidatorUtils.validateEntity(formDTO, AddNoticeFormDTO.Add.class, AddNoticeFormDTO.AddUserShow.class); |
|
|
|
noticeService.add(tokenDto, formDTO); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
@ -118,7 +82,7 @@ public class NoticeController { |
|
|
|
**/ |
|
|
|
@PostMapping(value = "edit") |
|
|
|
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditNoticeFormDTO formDTO){ |
|
|
|
ValidatorUtils.validateEntity(formDTO, EditNoticeFormDTO.Edit.class); |
|
|
|
ValidatorUtils.validateEntity(formDTO, EditNoticeFormDTO.Edit.class, EditNoticeFormDTO.EditUserShow.class); |
|
|
|
noticeService.edit(tokenDto, formDTO); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|