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 07dd78d..6d2db50 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 @@ -11,4 +11,6 @@ public interface IBookService extends IService{ void save(BookEntity book); + void update(BookEntity book); + } 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 818dcd4..edb99c9 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 @@ -39,4 +39,21 @@ public class BookServiceImpl extends ServiceImpl impleme bookMapper.insert(book); } + @Transactional(readOnly=false) + @Override + public void update(BookEntity book) { + CourseEntity course = courseMapper.selectById(book.getCourseId()); + BookEntity entity = bookMapper.selectById(book.getId()); + + entity.setName(book.getName()); + entity.setPointNum(book.getPointNum()); + entity.setQuestionNum(book.getQuestionNum()); + entity.setRemarks(book.getRemarks()); + entity.setPublishingHouse(book.getPublishingHouse()); + entity.setSort(book.getSort()); + entity.setCourseId(course.getId()); + + bookMapper.updateById(entity); + } + } 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 1fe5d42..4785921 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 @@ -8,15 +8,14 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; -import com.baomidou.mybatisplus.mapper.Condition; import com.baomidou.mybatisplus.plugins.Page; import com.tamguo.common.utils.ExceptionSupport; import com.tamguo.common.utils.Result; import com.tamguo.modules.tiku.model.BookEntity; +import com.tamguo.modules.tiku.model.CourseEntity; import com.tamguo.modules.tiku.model.condition.BookCondition; -import com.tamguo.modules.tiku.model.enums.SubjectStatusEnum; import com.tamguo.modules.tiku.service.IBookService; -import com.tamguo.modules.tiku.service.ISubjectService; +import com.tamguo.modules.tiku.service.ICourseService; @Controller @RequestMapping(path="tiku/book") @@ -24,17 +23,27 @@ public class BookController { /** 书籍*/ private final String BOOK_LIST_PAGE = "modules/tiku/book/list"; + private final String BOOK_UPDATE_PAGE = "modules/tiku/book/update"; @Autowired private IBookService iBookService; @Autowired - private ISubjectService iSubjectService; + private ICourseService iCourseService; + - @SuppressWarnings("unchecked") @RequestMapping(path="list") public ModelAndView index(ModelAndView model) { model.setViewName(BOOK_LIST_PAGE); - model.addObject("subjectList", iSubjectService.selectList(Condition.create().eq("status", SubjectStatusEnum.NORMAL.getValue()))); + return model; + } + + @RequestMapping(path="update") + public ModelAndView update(String id, ModelAndView model) { + model.setViewName(BOOK_UPDATE_PAGE); + BookEntity book = iBookService.selectById(id); + CourseEntity course = iCourseService.selectById(book.getCourseId()); + model.addObject("book", book); + model.addObject("course", course); return model; } @@ -55,4 +64,15 @@ public class BookController { return ExceptionSupport.resolverResult("保存书籍", this.getClass(), e); } } + + @RequestMapping(path="update",method=RequestMethod.POST) + @ResponseBody + public Result update(BookEntity book) { + try { + iBookService.update(book); + return Result.result(0, null, "修改书籍【"+book.getName()+"】成功"); + } catch (Exception e) { + return ExceptionSupport.resolverResult("修改书籍", this.getClass(), e); + } + } } diff --git a/tamguo-oms/src/main/resources/templates/modules/tiku/book/add.html b/tamguo-oms/src/main/resources/templates/modules/tiku/book/add.html index de8255e..cf76249 100644 --- a/tamguo-oms/src/main/resources/templates/modules/tiku/book/add.html +++ b/tamguo-oms/src/main/resources/templates/modules/tiku/book/add.html @@ -14,7 +14,7 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/> - +
@@ -143,6 +143,15 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
+
+
+ +
+ +
+
+
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 51a6c6d..b221e63 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,8 +170,8 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/> $('#dataGrid').dataGrid({ searchForm: $("#searchForm"), columnModel: [ - {header:'书籍编号', name:'uid', index:'u.login_code', width:200, align:"center", frozen:true, formatter: function(val, obj, row, act){ - return ''+(val||row.id)+''; + {header:'书籍编号', name:'id', index:'u.id', width:200, 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"}, @@ -194,7 +194,7 @@ $('#dataGrid').dataGrid({ }}, {header:'操作', name:'actions', width:260, sortable:false, title:false, formatter: function(val, obj, row, act){ var actions = []; - actions.push(' '); + actions.push(' '); if (row.status == Global.STATUS_NORMAL){ actions.push(' '); } diff --git a/tamguo-oms/src/main/resources/templates/modules/tiku/book/update.html b/tamguo-oms/src/main/resources/templates/modules/tiku/book/update.html new file mode 100644 index 0000000..8c9cbf0 --- /dev/null +++ b/tamguo-oms/src/main/resources/templates/modules/tiku/book/update.html @@ -0,0 +1,227 @@ + +书籍管理 - JeeSite Demo + + + + + + + + + + + + +
+
+
+
+ 新增书籍 +
+
+ +
+
+
+ +
+
基本信息
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+
+ + + +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/tamguo-oms/src/main/resources/templates/modules/tiku/course/add.html b/tamguo-oms/src/main/resources/templates/modules/tiku/course/add.html index c6858ee..393c041 100644 --- a/tamguo-oms/src/main/resources/templates/modules/tiku/course/add.html +++ b/tamguo-oms/src/main/resources/templates/modules/tiku/course/add.html @@ -14,7 +14,7 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/> - +
diff --git a/tamguo-oms/src/main/resources/templates/modules/tiku/subject/add.html b/tamguo-oms/src/main/resources/templates/modules/tiku/subject/add.html index ec729c7..5d65962 100644 --- a/tamguo-oms/src/main/resources/templates/modules/tiku/subject/add.html +++ b/tamguo-oms/src/main/resources/templates/modules/tiku/subject/add.html @@ -14,7 +14,7 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/> - +