diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/IBookService.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/IBookService.java index 6d2db50..554799f 100644 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/IBookService.java +++ b/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/IBookService.java @@ -13,4 +13,10 @@ public interface IBookService extends IService{ void update(BookEntity book); + void delete(String id); + + void enable(String id); + + void disabled(String id); + } diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/impl/BookServiceImpl.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/impl/BookServiceImpl.java index edb99c9..3c7dd14 100644 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/impl/BookServiceImpl.java +++ b/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/impl/BookServiceImpl.java @@ -56,4 +56,28 @@ public class BookServiceImpl extends ServiceImpl impleme bookMapper.updateById(entity); } + @Transactional(readOnly=false) + @Override + public void delete(String id) { + BookEntity book = bookMapper.selectById(id); + book.setStatus(BookStatusEnum.DELETE); + bookMapper.updateById(book); + } + + @Transactional(readOnly=false) + @Override + public void enable(String id) { + BookEntity book = bookMapper.selectById(id); + book.setStatus(BookStatusEnum.NORMAL); + bookMapper.updateById(book); + } + + @Transactional(readOnly=false) + @Override + public void disabled(String id) { + BookEntity book = bookMapper.selectById(id); + book.setStatus(BookStatusEnum.DISABLED); + bookMapper.updateById(book); + } + } diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/tiku/web/BookController.java b/tamguo-oms/src/main/java/com/tamguo/modules/tiku/web/BookController.java index 4785921..b4809ca 100644 --- a/tamguo-oms/src/main/java/com/tamguo/modules/tiku/web/BookController.java +++ b/tamguo-oms/src/main/java/com/tamguo/modules/tiku/web/BookController.java @@ -75,4 +75,37 @@ public class BookController { return ExceptionSupport.resolverResult("修改书籍", this.getClass(), e); } } + + @RequestMapping(path="delete",method=RequestMethod.POST) + @ResponseBody + public Result delete(String id) { + try { + iBookService.delete(id); + return Result.result(0, null, "删除书籍成功"); + } catch (Exception e) { + return ExceptionSupport.resolverResult("删除书籍", this.getClass(), e); + } + } + + @RequestMapping(path="enable",method=RequestMethod.POST) + @ResponseBody + public Result enable(String id) { + try { + iBookService.enable(id); + return Result.result(0, null, "激活书籍成功"); + } catch (Exception e) { + return ExceptionSupport.resolverResult("激活书籍", this.getClass(), e); + } + } + + @RequestMapping(path="disabled",method=RequestMethod.POST) + @ResponseBody + public Result disabled(String id) { + try { + iBookService.disabled(id); + return Result.result(0, null, "停用书籍成功"); + } catch (Exception e) { + return ExceptionSupport.resolverResult("停用书籍", this.getClass(), e); + } + } } diff --git a/tamguo-oms/src/main/resources/templates/modules/tiku/book/list.html b/tamguo-oms/src/main/resources/templates/modules/tiku/book/list.html index b221e63..49c848c 100644 --- a/tamguo-oms/src/main/resources/templates/modules/tiku/book/list.html +++ b/tamguo-oms/src/main/resources/templates/modules/tiku/book/list.html @@ -170,44 +170,33 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/> $('#dataGrid').dataGrid({ searchForm: $("#searchForm"), columnModel: [ - {header:'书籍编号', name:'id', index:'u.id', width:200, align:"center", frozen:true, formatter: function(val, obj, row, act){ + {header:'书籍编号', name:'id', index:'u.id', width:300, align:"center", frozen:true, formatter: function(val, obj, row, act){ return ''+(val||row.id)+''; }}, - {header:'分类', name:'subjectName', index:'u.courseName', width:200, align:"center"}, - {header:'科目', name:'courseName', index:'u.courseName', width:200, align:"center"}, - {header:'书籍名称', name:'name', index:'u.user_name', width:200, align:"center"}, + {header:'分类', name:'subjectName', index:'u.courseName', width:100, align:"center"}, + {header:'科目', name:'courseName', index:'u.courseName', width:100, align:"center"}, + {header:'书籍名称', name:'name', index:'u.user_name', width:400, align:"center"}, {header:'出版社', name:'publishingHouse', index:'u.ref_name', width:200, align:"center"}, - {header:'归属机构', name:'officeName', index:'u.office_name', width:200, align:"center"}, {header:'更新时间', name:'updateDate', index:'u.update_date', width:200, align:"center"}, - {header:'状态', name:'status', index:'u.status', width:140, align:"center", formatter: function(val, obj, row, act){ + {header:'状态', name:'status', index:'b.status', width:80, align:"center", formatter: function(val, obj, row, act){ if(val == "normal"){ - return "正常"; - }else if(val == "delete"){ - return "删除"; + return '正常'; }else if(val == "disabled"){ - return "禁用"; - }else if(val == "locked"){ - return "锁定"; + return '停用'; }else{ - return "未知"; + return '未知'; } }}, - {header:'操作', name:'actions', width:260, sortable:false, title:false, formatter: function(val, obj, row, act){ + {header:'操作', name:'actions', width:160, sortable:false, title:false, formatter: function(val, obj, row, act){ var actions = []; actions.push(' '); - if (row.status == Global.STATUS_NORMAL){ - actions.push(' '); + if (row.status == "normal"){ + actions.push(' '); } - if (row.status == Global.STATUS_DISABLE){ - actions.push(' '); + if (row.status == "disabled"){ + actions.push(' '); } - actions.push(' '); - actions.push(' '); - actions.push('
'); - actions.push(' 分配角色 '); - actions.push(' 数据权限 '); - actions.push(' 重置密码 '); - actions.push('
'); + actions.push(' '); return actions.join(''); }} ],