添加默认创建时间和修改时间
This commit is contained in:
parent
648d999a7c
commit
e08dfc92f5
|
@ -103,7 +103,6 @@ public class ApiNoticeController extends ApiBaseController {
|
|||
@PostMapping("/save")
|
||||
public void ApiNoticeSave(String title, String content, String noticeDate, Integer top, String coverNames, String coverPaths, String fileNames, String filePaths, String type, String obj) {
|
||||
Notice bean = new Notice();
|
||||
bean.setCreatedAt(LocalDateTime.now());
|
||||
bean.setTitle(title);
|
||||
bean.setContent(content);
|
||||
bean.setNoticeDate(noticeDate);
|
||||
|
@ -112,6 +111,8 @@ public class ApiNoticeController extends ApiBaseController {
|
|||
bean.setCreatedId(getApiUserId());
|
||||
bean.setType(type);
|
||||
bean.setObj(obj);
|
||||
bean.setUpdatedAt(LocalDateTime.now());
|
||||
bean.setCreatedAt(LocalDateTime.now());
|
||||
boolean flag = noticeService.apiSave(bean, coverNames, coverPaths,fileNames,filePaths, getApiUser());
|
||||
render(!flag ? Ret.fail("操作失败") : Ret.ok());
|
||||
}
|
||||
|
|
|
@ -88,8 +88,6 @@ public class NoticeController extends BaseAdminController {
|
|||
@PreAuth("rddb:policy:save")
|
||||
@PostMapping("/save")
|
||||
public void save(@Validated NoticeBo noticeBo) {
|
||||
if (noticeBo.getId()!=null) noticeBo.setCreatedAt(LocalDateTime.now());
|
||||
else noticeBo.setUpdatedAt(LocalDateTime.now());
|
||||
boolean flag = noticeService.saveOrUpdate(noticeBo, getLoginUser());
|
||||
render(flag ? Ret.ok() : Ret.fail("操作失败"));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue