From 95f5396e8abd09f51efda53ce0a4a2658e9235c8 Mon Sep 17 00:00:00 2001 From: tamguo Date: Tue, 10 Jul 2018 18:46:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/tamguo/dao/CourseMapper.java | 12 ++ .../java/com/tamguo/model/ChapterEntity.java | 93 +++++++++++++ .../java/com/tamguo/model/CourseEntity.java | 129 ++++++++++++++++++ .../java/com/tamguo/model/SubjectEntity.java | 55 ++++++++ .../com/tamguo/service/ISubjectService.java | 10 ++ .../tamguo/service/impl/SubjectService.java | 23 ++++ .../com/tamguo/web/ChapterController.java | 13 +- .../java/com/tamguo/web/MenuController.java | 4 +- .../main/resources/mappers/CourseMapper.xml | 20 +++ .../src/main/resources/templates/chapter.html | 41 +++--- .../src/main/resources/templates/index.html | 2 +- 11 files changed, 377 insertions(+), 25 deletions(-) create mode 100644 tamguo-mobile/src/main/java/com/tamguo/dao/CourseMapper.java create mode 100644 tamguo-mobile/src/main/java/com/tamguo/model/ChapterEntity.java create mode 100644 tamguo-mobile/src/main/java/com/tamguo/model/CourseEntity.java create mode 100644 tamguo-mobile/src/main/java/com/tamguo/model/SubjectEntity.java create mode 100644 tamguo-mobile/src/main/java/com/tamguo/service/ISubjectService.java create mode 100644 tamguo-mobile/src/main/java/com/tamguo/service/impl/SubjectService.java create mode 100644 tamguo-mobile/src/main/resources/mappers/CourseMapper.xml diff --git a/tamguo-mobile/src/main/java/com/tamguo/dao/CourseMapper.java b/tamguo-mobile/src/main/java/com/tamguo/dao/CourseMapper.java new file mode 100644 index 0000000..37674d3 --- /dev/null +++ b/tamguo-mobile/src/main/java/com/tamguo/dao/CourseMapper.java @@ -0,0 +1,12 @@ +package com.tamguo.dao; + +import java.util.List; + +import com.tamguo.config.dao.SuperMapper; +import com.tamguo.model.CourseEntity; + +public interface CourseMapper extends SuperMapper{ + + List findBySubjectId(String uid); + +} diff --git a/tamguo-mobile/src/main/java/com/tamguo/model/ChapterEntity.java b/tamguo-mobile/src/main/java/com/tamguo/model/ChapterEntity.java new file mode 100644 index 0000000..7b271f7 --- /dev/null +++ b/tamguo-mobile/src/main/java/com/tamguo/model/ChapterEntity.java @@ -0,0 +1,93 @@ +package com.tamguo.model; + +import java.io.Serializable; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableName; +import com.tamguo.config.dao.SuperEntity; + +import java.util.List; + + +/** + * The persistent class for the tiku_chapter database table. + * + */ +@TableName(value="tiku_chapter") +public class ChapterEntity extends SuperEntity implements Serializable { + private static final long serialVersionUID = 1L; + + private String courseId; + + private String name; + + private String parentId; + + private Integer questionNum; + + private Integer pointNum; + + private Integer orders; + + @TableField(exist=false) + private List childChapterList; + + public ChapterEntity() { + } + + public String getCourseId() { + return this.courseId; + } + + public void setCourseId(String courseId) { + this.courseId = courseId; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getParentId() { + return this.parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public List getChildChapterList() { + return childChapterList; + } + + public void setChildChapterList(List childChapterList) { + this.childChapterList = childChapterList; + } + + public Integer getQuestionNum() { + return questionNum; + } + + public void setQuestionNum(Integer questionNum) { + this.questionNum = questionNum; + } + + public Integer getPointNum() { + return pointNum; + } + + public void setPointNum(Integer pointNum) { + this.pointNum = pointNum; + } + + public Integer getOrders() { + return orders; + } + + public void setOrders(Integer orders) { + this.orders = orders; + } + +} \ No newline at end of file diff --git a/tamguo-mobile/src/main/java/com/tamguo/model/CourseEntity.java b/tamguo-mobile/src/main/java/com/tamguo/model/CourseEntity.java new file mode 100644 index 0000000..e43097b --- /dev/null +++ b/tamguo-mobile/src/main/java/com/tamguo/model/CourseEntity.java @@ -0,0 +1,129 @@ +package com.tamguo.model; + +import java.io.Serializable; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableName; +import com.tamguo.config.dao.SuperEntity; + +import java.math.BigInteger; +import java.util.List; + + +/** + * The persistent class for the tiku_course database table. + * + */ +@TableName(value="tiku_course") +public class CourseEntity extends SuperEntity implements Serializable { + private static final long serialVersionUID = 1L; + + private String name; + + private BigInteger subjectId; + + private BigInteger pointNum; + + private BigInteger questionNum; + + private Integer orders; + + private String seoTitle; + + private String seoKeywords; + + private String seoDescription; + + @TableField(exist=false) + private String subjectName; + + @TableField(exist=false) + private List chapterList; + + public CourseEntity() { + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public BigInteger getSubjectId() { + return this.subjectId; + } + + public void setSubjectId(BigInteger subjectId) { + this.subjectId = subjectId; + } + + public BigInteger getQuestionNum() { + return questionNum; + } + + public void setQuestionNum(BigInteger questionNum) { + this.questionNum = questionNum; + } + + public BigInteger getPointNum() { + return pointNum; + } + + public void setPointNum(BigInteger pointNum) { + this.pointNum = pointNum; + } + + public Integer getOrders() { + return orders; + } + + public void setOrders(Integer orders) { + this.orders = orders; + } + + public List getChapterList() { + return chapterList; + } + + public void setChapterList(List chapterList) { + this.chapterList = chapterList; + } + + public String getSeoTitle() { + return seoTitle; + } + + public void setSeoTitle(String seoTitle) { + this.seoTitle = seoTitle; + } + + public String getSeoKeywords() { + return seoKeywords; + } + + public void setSeoKeywords(String seoKeywords) { + this.seoKeywords = seoKeywords; + } + + public String getSeoDescription() { + return seoDescription; + } + + public void setSeoDescription(String seoDescription) { + this.seoDescription = seoDescription; + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public String getSubjectName() { + return subjectName; + } + + public void setSubjectName(String subjectName) { + this.subjectName = subjectName; + } + +} \ No newline at end of file diff --git a/tamguo-mobile/src/main/java/com/tamguo/model/SubjectEntity.java b/tamguo-mobile/src/main/java/com/tamguo/model/SubjectEntity.java new file mode 100644 index 0000000..7c06e88 --- /dev/null +++ b/tamguo-mobile/src/main/java/com/tamguo/model/SubjectEntity.java @@ -0,0 +1,55 @@ +package com.tamguo.model; + +import java.io.Serializable; +import java.util.List; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableName; +import com.tamguo.config.dao.SuperEntity; + +@TableName(value="tiku_subject") +public class SubjectEntity extends SuperEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + private String name; + + private String courseId; + + private String courseName; + + @TableField(exist=false) + private List courseList; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCourseId() { + return courseId; + } + + public void setCourseId(String courseId) { + this.courseId = courseId; + } + + public String getCourseName() { + return courseName; + } + + public void setCourseName(String courseName) { + this.courseName = courseName; + } + + public List getCourseList() { + return courseList; + } + + public void setCourseList(List courseList) { + this.courseList = courseList; + } +} diff --git a/tamguo-mobile/src/main/java/com/tamguo/service/ISubjectService.java b/tamguo-mobile/src/main/java/com/tamguo/service/ISubjectService.java new file mode 100644 index 0000000..0cb03dc --- /dev/null +++ b/tamguo-mobile/src/main/java/com/tamguo/service/ISubjectService.java @@ -0,0 +1,10 @@ +package com.tamguo.service; + +import java.util.List; +import com.tamguo.model.CourseEntity; + +public interface ISubjectService { + + public List findCourseList(String subjectId); + +} diff --git a/tamguo-mobile/src/main/java/com/tamguo/service/impl/SubjectService.java b/tamguo-mobile/src/main/java/com/tamguo/service/impl/SubjectService.java new file mode 100644 index 0000000..89fd2a9 --- /dev/null +++ b/tamguo-mobile/src/main/java/com/tamguo/service/impl/SubjectService.java @@ -0,0 +1,23 @@ +package com.tamguo.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.tamguo.dao.CourseMapper; +import com.tamguo.model.CourseEntity; +import com.tamguo.service.ISubjectService; + +@Service +public class SubjectService implements ISubjectService{ + + @Autowired + CourseMapper courseMapper; + + @Override + public List findCourseList(String subjectId) { + return courseMapper.findBySubjectId(subjectId); + } + +} diff --git a/tamguo-mobile/src/main/java/com/tamguo/web/ChapterController.java b/tamguo-mobile/src/main/java/com/tamguo/web/ChapterController.java index 9917e9e..bb57234 100644 --- a/tamguo-mobile/src/main/java/com/tamguo/web/ChapterController.java +++ b/tamguo-mobile/src/main/java/com/tamguo/web/ChapterController.java @@ -1,13 +1,22 @@ package com.tamguo.web; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +import com.tamguo.service.ISubjectService; @Controller public class ChapterController { + + @Autowired + private ISubjectService iSubjectService; - @RequestMapping(path= {"chapter"}) - public String index() { + @RequestMapping(path= {"chapter/{subjectId}/{courseId}"}) + public String chapter(@PathVariable String subjectId , @PathVariable String courseId , ModelAndView model) { + model.addObject("courseList", iSubjectService.findCourseList(subjectId)); return "chapter"; } diff --git a/tamguo-mobile/src/main/java/com/tamguo/web/MenuController.java b/tamguo-mobile/src/main/java/com/tamguo/web/MenuController.java index 7e0fe58..7651a32 100644 --- a/tamguo-mobile/src/main/java/com/tamguo/web/MenuController.java +++ b/tamguo-mobile/src/main/java/com/tamguo/web/MenuController.java @@ -18,14 +18,14 @@ import com.tamguo.util.Result; public class MenuController { @Resource - private IMenuService iSubjectService; + private IMenuService iMenuService; @RequestMapping(path="menu/findAllMenus",method=RequestMethod.POST) @ResponseBody public Result findAllMenus() { // 获取全部菜单 try { - List allMenuList = iSubjectService.findAllMenus(); + List allMenuList = iMenuService.findAllMenus(); return Result.successResult(allMenuList); } catch (Exception e) { return ExceptionSupport.resolverResult("查询所有菜单", this.getClass(), e); diff --git a/tamguo-mobile/src/main/resources/mappers/CourseMapper.xml b/tamguo-mobile/src/main/resources/mappers/CourseMapper.xml new file mode 100644 index 0000000..84bfdc4 --- /dev/null +++ b/tamguo-mobile/src/main/resources/mappers/CourseMapper.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/tamguo-mobile/src/main/resources/templates/chapter.html b/tamguo-mobile/src/main/resources/templates/chapter.html index 7e71f81..6daab54 100644 --- a/tamguo-mobile/src/main/resources/templates/chapter.html +++ b/tamguo-mobile/src/main/resources/templates/chapter.html @@ -33,6 +33,7 @@ +
第一章 社会工作概述 @@ -50,21 +51,11 @@ - - - - 1.2 社区工作的含义及特点 - - - 1 社会工作的含义、目标与功能 - - - - - +
+
第一章 社会工作概述 - + 1.1 社区的含义、要素及功能 @@ -79,17 +70,24 @@ - - + - 1.2 社区工作的含义及特点 - - + 1.1 社区的含义、要素及功能 + 1 社会工作的含义、目标与功能 - + + + + + + + + - +
+
+ @@ -113,6 +111,9 @@ +