课程信息查询功能完成

修复jsp上的错误
修复CourseController上的错误

Signed-off-by: Chenx221 <chenx221@yandex.com>
This commit is contained in:
Chenx221 2023-06-09 22:54:25 +08:00
parent 191c4f3d91
commit 19049f907e
8 changed files with 16 additions and 7 deletions

View File

@ -12,6 +12,7 @@
<mappers>
<mapper resource="mapper/UserMapper.xml"/>
<mapper resource="mapper/StudentMapper.xml"/>
<mapper resource="mapper/CourseMapper.xml"/>
<!-- 可以添加其他的映射器配置 -->
</mappers>
</configuration>

View File

@ -143,9 +143,9 @@
<tbody>
<c:forEach var="course" items="${courses}">
<tr>
<td>${course.CourseID}</td>
<td>${course.CourseName}</td>
<td>${course.Description}</td>
<td>${course.courseID}</td>
<td>${course.courseName}</td>
<td>${course.description}</td>
</tr>
</c:forEach>
</tbody>

View File

@ -2,6 +2,7 @@ package cyou.chenx221.controller;
import cyou.chenx221.pojo.Course;
import cyou.chenx221.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@ -14,6 +15,7 @@ import java.util.List;
public class CourseController {
private final CourseService courseService;
@Autowired
public CourseController(CourseService courseService) {
this.courseService = courseService;
}

View File

@ -1,6 +1,7 @@
package cyou.chenx221.service;
import cyou.chenx221.mapper.CourseDao;
import cyou.chenx221.mapper.StudentDao;
import cyou.chenx221.pojo.Course;
import org.springframework.stereotype.Service;
@ -10,6 +11,11 @@ import java.util.List;
public class CourseService {
private CourseDao courseDao;
public CourseService(CourseDao courseDao) {
this.courseDao = courseDao;
}
public List<Course> getAllCourses() {
return courseDao.getAllCourses();
}

View File

@ -12,7 +12,7 @@
<mappers>
<mapper resource="mapper/UserMapper.xml"/>
<mapper resource="mapper/StudentMapper.xml"/>
<mapper resource="mapper/CourseMapper.xml"
<mapper resource="mapper/CourseMapper.xml"/>
<!-- 可以添加其他的映射器配置 -->
</mappers>
</configuration>

View File

@ -143,9 +143,9 @@
<tbody>
<c:forEach var="course" items="${courses}">
<tr>
<td>${course.CourseID}</td>
<td>${course.CourseName}</td>
<td>${course.Description}</td>
<td>${course.courseID}</td>
<td>${course.courseName}</td>
<td>${course.description}</td>
</tr>
</c:forEach>
</tbody>