Commit 48054424 by fsn

修改通知的业务编写

parent aaa6c3d1
......@@ -59,6 +59,8 @@ public class NoticeController extends BaseController {
*/
@RequestMapping("/notice_update/{noticeId}")
public String noticeUpdate(@PathVariable Integer noticeId, Model model) {
Notice notice = this.noticeMapper.selectById(noticeId);
model.addAttribute("notice",notice);
return PREFIX + "notice_edit.html";
}
......@@ -78,7 +80,7 @@ public class NoticeController extends BaseController {
@RequestMapping(value = "/add")
@ResponseBody
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);
}
notice.setCreater(ShiroKit.getUser().getId());
......@@ -97,13 +99,19 @@ public class NoticeController extends BaseController {
return SUCCESS_TIP;
}
/**
* 修改通知
*/
@RequestMapping(value = "/update")
@ResponseBody
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;
}
......
......@@ -6,12 +6,20 @@
<input type="hidden" id="id" value="${notice.id}">
<div class="row">
<div class="col-sm-6 b-r">
<div class="col-sm-12">
<div class="form-group">
<label class="col-sm-1 control-label">标题</label>
<div class="col-sm-11">
<input class="form-control" id="title" type="text" value="${notice.title}">
</div>
<div class="col-sm-6">
</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>
......
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