Commit 48054424 by fsn

修改通知的业务编写

parent aaa6c3d1
...@@ -59,6 +59,8 @@ public class NoticeController extends BaseController { ...@@ -59,6 +59,8 @@ public class NoticeController extends BaseController {
*/ */
@RequestMapping("/notice_update/{noticeId}") @RequestMapping("/notice_update/{noticeId}")
public String noticeUpdate(@PathVariable Integer noticeId, Model model) { public String noticeUpdate(@PathVariable Integer noticeId, Model model) {
Notice notice = this.noticeMapper.selectById(noticeId);
model.addAttribute("notice",notice);
return PREFIX + "notice_edit.html"; return PREFIX + "notice_edit.html";
} }
...@@ -78,7 +80,7 @@ public class NoticeController extends BaseController { ...@@ -78,7 +80,7 @@ public class NoticeController extends BaseController {
@RequestMapping(value = "/add") @RequestMapping(value = "/add")
@ResponseBody @ResponseBody
public Object add(Notice notice) { public Object add(Notice notice) {
if(ToolUtil.isOneEmpty(notice,notice.getTitle(),notice.getContent())){ if (ToolUtil.isOneEmpty(notice, notice.getTitle(), notice.getContent())) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL); throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
} }
notice.setCreater(ShiroKit.getUser().getId()); notice.setCreater(ShiroKit.getUser().getId());
...@@ -97,13 +99,19 @@ public class NoticeController extends BaseController { ...@@ -97,13 +99,19 @@ public class NoticeController extends BaseController {
return SUCCESS_TIP; return SUCCESS_TIP;
} }
/** /**
* 修改通知 * 修改通知
*/ */
@RequestMapping(value = "/update") @RequestMapping(value = "/update")
@ResponseBody @ResponseBody
public Object update(Notice notice) { public Object update(Notice notice) {
if (ToolUtil.isOneEmpty(notice, notice.getId(), notice.getTitle(), notice.getContent())) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
}
Notice old = this.noticeMapper.selectById(notice.getId());
old.setTitle(notice.getTitle());
old.setContent(notice.getContent());
old.updateById();
return super.SUCCESS_TIP; return super.SUCCESS_TIP;
} }
......
...@@ -6,12 +6,20 @@ ...@@ -6,12 +6,20 @@
<input type="hidden" id="id" value="${notice.id}"> <input type="hidden" id="id" value="${notice.id}">
<div class="row"> <div class="row">
<div class="col-sm-6 b-r"> <div class="col-sm-12">
<div class="form-group">
</div> <label class="col-sm-1 control-label">标题</label>
<div class="col-sm-11">
<div class="col-sm-6"> <input class="form-control" id="title" type="text" value="${notice.title}">
</div>
</div>
<div class="form-group">
<label class="col-sm-1 control-label">内容</label>
<div class="col-sm-11">
<textarea class="form-control" id="content" type="text">${notice.content}</textarea>
</div>
</div>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment