一、数据准备
1、建立数据库表(字段的名请根据需求自己定义,可以增加需求。)
1)选课表(字段需求:id、学生表id、学期、学年、学号、姓名、课程数、学分数、学时数、选修课数、必修课数)
2)选课清单表(字段需求:id、选课表id、课程表id、课程编号、课程名、课程学时)
3)课程表(字段需求:id、课程编号、课程名、课程性质、开课学期、学时、学分)
4)学生表(字段需求:id、学号、姓名、学院、入学时间)
2、增加数据
二、建立访问MyBatis的对象
3、建立类型ChosenCourseStudent(在po包内,参见BatchCustomer类)
package cn.com.mybatis.po;
import java.util.Date;
import java.util.List;
public class ChosenCourseStudent extends ChosenCourse{
private int id; //id
private int student_id; //学号
private String name; //姓名
private String college; //学院
private Date admission_time;//入学时间
private List<ChosenCourse> chosenCourseList;
public List<ChosenCourse> getChosenCourseList() {
return chosenCourseList;
}
public void setChosenCourseList(List<ChosenCourse> chosenCourseList) {
this.chosenCourseList = chosenCourseList;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getStudent_id() {
return student_id;
}
public void setStudent_id(int student_id) {
this.student_id = student_id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCollege() {
return college;
}
public void setCollege(String college) {
this.college = college;
}
public Date getAdmission_time() {
return admission_time;
}
public void setAdmission_time(Date admission_time) {
this.admission_time = admission_time;
}
}
4、建立类型ChosenCourseItem(在po包内,参见BatchItem类)
package cn.com.mybatis.po;
import java.util.List;
public class ChosenCourseItem {
private int id;//id
private int student_table_id;//选课表id
private int course_table_id;//课程表id
private int course_id;//课程编号
private String course_name;//课程名
private int course_hour;//课程学时
private ChosenCourseStudent chosenCourseStudent;//用户信息
private List<ChosenCourseDetail> chosenCourseDetails;//清单表中包括的选课的信息
public List<ChosenCourseDetail> getChosenCourseDetails() {
return chosenCourseDetails;
}
public void setChosenCourseDetails(List<ChosenCourseDetail> chosenCourseDetails) {
this.chosenCourseDetails = chosenCourseDetails;
}
public ChosenCourseStudent getChosenCourseStudent() {
return chosenCourseStudent;
}
public void setChosenCourseStudent(ChosenCourseStudent chosenCourseStudent) {
this.chosenCourseStudent = chosenCourseStudent;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getStudent_table_id() {
return student_table_id;
}
public void setStudent_table_id(int student_table_id) {
this.student_table_id = student_table_id;
}
public int getCourse_table_id() {
return course_table_id;
}
public void setCourse_table_id(int course_table_id) {
this.course_table_id = course_table_id;
}
public int getCourse_id() {
return course_id;
}
public void setCourse_id(int course_id) {
this.course_id = course_id;
}
public String getCourse_name() {
return course_name;
}
public void setCourse_name(String course_name) {
this.course_name = course_name;
}
public int getCourse_hour() {
return course_hour;
}
public void setCourse_hour(int course_hour) {
this.course_hour = course_hour;
}
}
5、建立类型CourseStudentDetail(在po包内,参见BatchDetail类)
package cn.com.mybatis.po;
public class ChosenCourseDetail {
private int id;//id
private int course_id;//课程编号
private String course_name;//课程名
private String course_nature;//课程性质
private String course_term;//开课学期
private int course_hour;//学时
private int credit;//学分
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getCourse_id() {
return course_id;
}
public void setCourse_id(int course_id) {
this.course_id = course_id;
}
public String getCourse_name() {
return course_name;
}
public void setCourse_name(String course_name) {
this.course_name = course_name;
}
public String getCourse_nature() {
return course_nature;
}
public void setCourse_nature(String course_nature) {
this.course_nature = course_nature;
}
public String getCourse_term() {
return course_term;
}
public void setCourse_term(String course_term) {
this.course_term = course_term;
}
public int getCourse_hour() {
return course_hour;
}
public void setCourse_hour(int course_hour) {
this.course_hour = course_hour;
}
public int getCredit() {
return credit;
}
public void setCredit(int credit) {
this.credit = credit;
}
}
三、配置MyBatis
3、SqlMapConfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--引入DTD,检验xml文件是否符合约定好的某种规范。-->
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<!--配置信息正文-->
<configuration>
<!-- 该标签对中配置日志输出模式logImpl为LOG4J-->
<settings>
<setting name="logImpl" value="LOG4J" />
</settings>
<objectFactory type="cn.com.mybatis.test.CartObjectFactory"/>
<plugins>
<plugin interceptor="cn.com.mybatis.test.QueryPlugin">
<property name="someProperty" value="100"/>
</plugin>
</plugins>
<!-- 和spring整合后 environments配置将废除-->
<!-- enviroment标签中配置Mybatis的环境信息-->
<environments default="development">
<environment id="development">
<!-- 使用jdbc事务管理-->
<transactionManager type="JDBC" />
<!-- 数据库连接池-->
<dataSource type="POOLED">
<property name="driver" value="org.gjt.mm.mysql.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/mybatis_test?characterEncoding=utf-8"/>
<property name="username" value="root"/>
<property name="password" value="lele20011019"/>
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="sqlmap/UserMapper.xml"/>
<mapper resource="sqlmap/CustomerMapper.xml"/>
<mapper resource="sqlmap/UserInfoMapper.xml"/>
</mappers>
</configuration>
4、创建UserInfoMapper.xml(在目录里config/sqlmap/,仿照UserMapper.xml文件)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="test">
<select id="findUserInfoById" parameterType="int" resultType="cn.com.mybatis.po.UserInfo">
SELECT * FROM USER WHERE id=#{id}
</select>
<select id="findChosenCourseStudent" resultType="cn.com.mybatis.po.ChosenCourseStudent">
SELECT
course_selection_table.*,
student.college,
student.admission_time
FROM
course_selection_table,
student
where student.id = course_selection_table.student_table_id
</select>
<resultMap id="ChosenCourseInfoMap" type="cn.com.mybatis.po.ChosenCourseItem">
<id column="id" property="id"/>
<result column="student_table_id" property="student_table_id"/>
<result column="course_table_id" property="course_table_id"/>
<result column="course_id" property="course_id"/>
<result column="course_name" property="course_name"/>
<result column="course_hour" property="course_hour"/>
<association property="chosenCourseStudent" javaType="cn.com.mybatis.po.ChosenCourseStudent">
<id column="id" property="id"/>
<result column="student_id" property="student_id"/>
<result column="name" property="name"/>
<result column="college" property="college"/>
<result column="admission_time" property="admission_time"/>
</association>
</resultMap>
<select id="findChosenCourseStudentToMap" resultMap="ChosenCourseInfoMap">
SELECT
course_selection_table.*,
student.college,
student.admission_time
FROM
course_selection_table,
student
where student.id = course_selection_table.student_table_id
</select>
<resultMap id="ChosenCourseDetailResultMap" type="cn.com.mybatis.po.ChosenCourseItem" extends="ChosenCourseInfoMap">
<collection property="chosenCourseDetails" ofType="cn.com.mybatis.po.ChosenCourseDetail">
<id column="id" property="id"/>
<result column="course_id" property="course_id"/>
<result column="course_name" property="course_name"/>
<result column="course_nature" property="course_nature"/>
<result column="course_term" property="course_term"/>
<result column="course_hour" property="course_hour"/>
<result column="credit" property="credit"/>
</collection>
</resultMap>
<select id="findChosenCourseAndChosenCourseDetail" resultMap="ChosenCourseDetailResultMap">
SELECT
course.course_id,
course.course_name,
course.course_nature,
course.course_term,
course.course_hour,
course.credit
FROM
course,
course_selection_list_table
WHERE
course_selection_list_table.course_table_id = course.id
</select>
<resultMap id="StudentAndCourseResultMap" type="cn.com.mybatis.po.ChosenCourseStudent" >
<!-- 学生信息-->
<result column="student_id" property="student_id"/>
<result column="name" property="name"/>
<result column="college" property="college"/>
<result column="admission_time" property="admission_time"/>
<!-- 批次信息,一个学生对应多个课程-->
<collection property="chosenCourseList" ofType="cn.com.mybatis.po.ChosenCourse">
<id column="id" property="id"/>
<result column="student_table_id" property="student_table_id"/>
<result column="term" property="term"/>
<result column="school_year" property="school_year"/>
<result column="student_id" property="student_id"/>
<result column="name" property="name"/>
<result column="num_course" property="num_course"/>
<result column="num_credits" property="num_credits"/>
<result column="num_hour" property="num_hour"/>
<result column="num_elective_course" property="num_elective_course"/>
<result column="num_required_course" property="num_required_course"/>
<collection property="chosenCourseDetails" ofType="cn.com.mybatis.po.ChosenCourseDetail">
<id column="id" property="id"/>
<result column="course_id" property="course_id"/>
<result column="course_name" property="course_name"/>
<result column="course_nature" property="course_nature"/>
<result column="course_term" property="course_term"/>
<result column="course_hour" property="course_hour"/>
<result column="credit" property="credit"/>
</collection>
</collection>
</resultMap>
<select id="findStudentAndCourse" resultMap="StudentAndCourseResultMap">
SELECT
course_selection_table.*,
student.college,
student.admission_time,
course.course_id,
course.course_name,
course.course_nature,
course.course_term,
course.course_hour,
course.credit
FROM
course,
course_selection_table,
student,
course_selection_list_table
WHERE
course_selection_table.student_table_id = student.id and
course_selection_list_table.course_table_id = course_selection_table.id
</select>
<!-- <select id="findChosenCourseStudent" resultType="cn.com.mybatis.po.demo.CourseStudentItem">-->
<!-- SELECT-->
<!-- STUDENT.*,-->
<!-- course_selection_table.term,-->
<!-- COURSE_SELECTION_TABLE.SCHOOL_YEAR,-->
<!-- COURSE_SELECTION_TABLE.NUM_COURSE,-->
<!-- COURSE_SELECTION_TABLE.NUM_CREDITS,-->
<!-- COURSE_SELECTION_TABLE.NUM_HOUR,-->
<!-- COURSE_SELECTION_TABLE.NUM_ELECTIVE_COURSE,-->
<!-- COURSE_SELECTION_TABLE.NUM_REQUIRED_COURSE-->
<!-- FROM-->
<!-- COURSE_SELECTION_TABLE,-->
<!-- STUDENT-->
<!-- WHERE COURSE_SELECTION_TABLE.STUDENT_TABLE_ID= STUDENT.ID-->
<!-- </select>-->
<!-- <select id="findChosenCourseAndChosenCourseDetail" resultType="cn.com.mybatis.po.demo.CourseStudentDetails">-->
<!-- SELECT-->
<!-- course.*,-->
<!-- course_selection_list_table.course_name,-->
<!-- course_selection_list_table.course_hour-->
<!-- FROM-->
<!-- course,-->
<!-- course_selection_list_table-->
<!-- WHERE course_selection_list_table.course_table_id=course.id-->
<!-- </select>-->
<!-- <resultMap type="cn.com.mybatis.po.demo.CourseStudentItem" id="ChosenCourseItemAndCourseStudentDetailResultMap">-->
<!-- <id column="CSD_id" property="student_id"/>-->
<!-- <result column="term" property="term"/>-->
<!-- <result column="school_year" property="school_year"/>-->
<!-- <result column="student_id" property="student_id"/>-->
<!-- <result column="name" property="name"/>-->
<!-- <result column="num_course" property="num_course"/>-->
<!-- <result column="num_hour" property="num_hour"/>-->
<!-- <result column="num_elective_course" property="num_elective_course"/>-->
<!-- <result column="num_required_course" property="num_required_course"/>-->
<!-- <collection property="courseStudentDetails" ofType="cn.com.mybatis.po.demo.CourseStudentDetails">-->
<!-- <id column="id" property="id"/>-->
<!-- <result column="student_table_id" property="student_table_id"/>-->
<!-- <result column="course_table_id" property="course_table_id"/>-->
<!-- <result column="course_id" property="course_id"/>-->
<!-- <result column="course_name" property="course_name"/>-->
<!-- <result column="course_hour" property="course_hour"/>-->
<!-- </collection>-->
<!-- </resultMap>-->
<!-- <select id="findStudentAndCourse" resultMap="ChosenCourseItemAndCourseStudentDetailResultMap">-->
<!-- SELECT-->
<!-- student.*,-->
<!-- course_selection_table.*,-->
<!-- course_selection_list_table.*-->
<!-- FROM-->
<!-- student,-->
<!-- course_selection_table,-->
<!-- course_selection_list_table-->
<!-- WHERE course_selection_table.id = course_selection_list_table.student_table_id and course_selection_table.student_table_id = student.id-->
<!-- </select>-->
</mapper>
5、仿照UserMapper.xml文件中的<select>元素:“findBatchCustomer”、“findBatchAndBatchDetail”和“findUserAndProducts”,撰写相应的SQL语句。
四、测试
6、创建测试类MyFirstTest(在cn.com.mybatis.test包中,仿照MyBatisTest类)
7、在MyFirstTest类中创建testChosenCourseStudent方法(仿照MyBatisTest的testBatchCustomer方法)
8、在MyFirstTest类中创建testfindChosenCourseAndChosenCourseDetail方法(仿照MyBatisTest的testfindBatchAndBatchDetail方法)
9、在MyFirstTest类中创建testfindStudentAndCourse方法(仿照MyBatisTest的testfindBatchAndBatchDetail方法)
10、成功运行testChosenCourseStudent方法、testfindChosenCourseAndChosenCourseDetail方法和testfindStudentAndCourse方法。将查询到数据输出到控制台,切记获取字段的方式不能直接使用对象的toString函数,而是通过字段的get函数获取(或者在对象内部拼接字符串再输出)。
package cn.com.mybatis.test;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.List;
import cn.com.mybatis.datasource.DataConnection;
import cn.com.mybatis.po.*;
import cn.com.mybatis.po.demo.CourseStudentDetails;
import cn.com.mybatis.po.demo.CourseStudentItem;
import cn.com.mybatis.po.demo.Student;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;
public class MyFirstTest {
public DataConnection dataConn = new DataConnection();
@Test
public void TestSelectUserInfo() throws IOException {
SqlSession sqlSession=dataConn.getSqlSession();
UserInfo userInfo=sqlSession.selectOne("test.findUserInfoById",1);
System.out.println("id:"+userInfo.getId());
System.out.println("name:"+userInfo.getName());
System.out.println("age:"+userInfo.getAge());
sqlSession.close();
}
@Test
public void testChosenCourseStudent() throws Exception{
SqlSession sqlSession = dataConn.getSqlSession();
//调用 userInfoMapper方法
List<ChosenCourseStudent> ccsList = sqlSession.selectList("findChosenCourseStudent");
if (ccsList!=null){
ChosenCourseStudent chosenCourseStudent = null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (int i=0;i<ccsList.size();i++){
chosenCourseStudent=ccsList.get(i);
System.out.println("学号:"+chosenCourseStudent.getStudent_id());
System.out.println("姓名:"+chosenCourseStudent.getName());
System.out.println("学院:"+chosenCourseStudent.getCollege());
System.out.println("入学时间:"+sdf.format(chosenCourseStudent.getAdmission_time()));
System.out.println("学期:"+chosenCourseStudent.getTerm());
System.out.println("学年:"+chosenCourseStudent.getSchool_year());
System.out.println("课程数:"+chosenCourseStudent.getNum_course());
System.out.println("学分数:"+chosenCourseStudent.getNum_credits());
System.out.println("学时数:"+chosenCourseStudent.getNum_hour());
System.out.println("选修课数:"+chosenCourseStudent.getNum_elective_course());
System.out.println("必修课数:"+chosenCourseStudent.getNum_required_course());
System.out.println();
}
}
sqlSession.close();
}
// @Test
// public void testChosenCourseStudentToMap() throws Exception{
// SqlSession sqlSession = dataConn.getSqlSession();
//
// //调用userinfomappr方法
// List<ChosenCourseItem> chosenCourseItems = sqlSession.selectList("findChosenCourseStudentToMap");
// if (chosenCourseItems!=null){
// ChosenCourseItem chosenCourseItem=null;
// ChosenCourseStudent chosenCourseStudent = null;
//
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// for (int i=0;i<chosenCourseItems.size();i++){
// chosenCourseItem=chosenCourseItems.get(i);//取出批次对象
// chosenCourseStudent = chosenCourseItem.getChosenCourseStudent();//取出该批次用户的信息
// System.out.println("学号为:"+chosenCourseStudent.getStudent_id()+"姓名为:"+chosenCourseStudent.getName()
// +"\n于"+sdf.format(chosenCourseStudent.getAdmission_time())+"入学");
// System.out.println("选择了"+chosenCourseItem.getCourse_name()+"学时"+chosenCourseItem.getCourse_hour());
// }
// }
// sqlSession.close();
// }
@Test
public void testfindChosenCourseAndChosenCourseDetail() throws Exception {
SqlSession sqlSession = dataConn.getSqlSession();
List<ChosenCourseItem> chosenCourseItems = sqlSession.selectList("findChosenCourseAndChosenCourseDetail");
if (chosenCourseItems != null) {
for (int j = 0; j< chosenCourseItems.size(); j++) {
ChosenCourseItem chosenCourseItem = chosenCourseItems.get(j);
if (chosenCourseItem != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
ChosenCourseStudent student = chosenCourseItem.getChosenCourseStudent();
List<ChosenCourseDetail> chosenCourseDetails = chosenCourseItem.getChosenCourseDetails();
ChosenCourseDetail chosenCourseDetail = null;
if (chosenCourseDetails != null) {
for (int i = 0; i < chosenCourseDetails.size(); i++) {
chosenCourseDetail = chosenCourseDetails.get(i);
System.out.println("学科名:"+chosenCourseDetail.getCourse_name());
System.out.println("学时:"+chosenCourseDetail.getCourse_hour());
System.out.println("选课id:"+chosenCourseDetail.getCourse_id());
System.out.println("学期:"+chosenCourseDetail.getCourse_term());
System.out.println("选课性质:"+chosenCourseDetail.getCourse_nature());
System.out.println("学分:"+chosenCourseDetail.getCredit());
System.out.println();
}
}
}
}
}
}
@Test
public void testfindStudentAndCourse() throws Exception {
SqlSession sqlSession = dataConn.getSqlSession();
List<ChosenCourseStudent> chosenCourseStudentList = sqlSession.selectList("findStudentAndCourse");
if (chosenCourseStudentList != null) {
ChosenCourseStudent chosenCourseStudent = null;
for (int j = 0; j < chosenCourseStudentList.size(); j++) {
chosenCourseStudent = chosenCourseStudentList.get(j);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//获取用户基本信息
System.out.println("学号为:" + chosenCourseStudent.getStudent_id());
System.out.println("姓名为:" + chosenCourseStudent.getName());
System.out.println("学院" + chosenCourseStudent.getCollege());
System.out.println("入学时间“:" + chosenCourseStudent.getAdmission_time());
System.out.println("选课详细如下:");
// 获取用户下的所有批次的选课信息
List<ChosenCourse> chosenCourseList = chosenCourseStudent.getChosenCourseList();
ChosenCourse chosenCourse =null;
if (chosenCourseList != null) {
for (int i = 0; i < chosenCourseList.size(); i++) {
chosenCourse = chosenCourseList.get(i);
System.out.println("课程数:"+chosenCourse.getNum_course());
System.out.println("学时数"+chosenCourse.getNum_hour());
System.out.println("学分数"+chosenCourse.getNum_credits());
System.out.println("选修课数"+chosenCourse.getNum_elective_course());
System.out.println("必修课数"+chosenCourse.getNum_required_course());
//获取课程明细
List<ChosenCourseDetail> chosenCourseDetails = chosenCourse.getChosenCourseDetails();
ChosenCourseDetail chosenCourseDetail = null;
for (int k=0;k<chosenCourseDetails.size();k++){
chosenCourseDetail = chosenCourseDetails.get(i);
System.out.println("课程名:"+chosenCourseDetail.getCourse_name());
System.out.println("课程性质:"+chosenCourseDetail.getCourse_nature());
System.out.println("学时:"+chosenCourseDetail.getCourse_hour());
System.out.println("学分:"+chosenCourseDetail.getCredit());
}
}
}
}
}
}
// @Test
// public void testChosenCourseStudent() throws IOException{
// SqlSession sqlSession = dataConn.getSqlSession();
//
// //调用userinfoMapper的方法
// List<CourseStudentItem> studentList = sqlSession.selectList("findChosenCourseStudent");
// if (studentList!=null){
// CourseStudentItem CSS = null;
// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
// for (int i=0;i<studentList.size();i++){
// CSS = studentList.get(i);
// System.out.println("学号:"+CSS.getStudent_id());
// System.out.println("姓名:"+CSS.getName());
// System.out.println("学院:"+CSS.getCollege());
// System.out.println("入学时间:"+sdf.format(CSS.getAdmission_time()));
// System.out.println("学期:"+CSS.getTerm());
// System.out.println("学年:"+CSS.getSchool_year());
// System.out.println("课程数:"+CSS.getNum_course());
// System.out.println("学分数:"+CSS.getNum_credits());
// System.out.println("学时数:"+CSS.getNum_hour());
// System.out.println("选修课数:"+CSS.getNum_elective_course());
// System.out.println("必修课数:"+CSS.getNum_required_course());
// }
// }
// sqlSession.close();
// }
// @Test
// public void testfindChosenCourseAndChosenCourseDetail() throws Exception{
// SqlSession sqlSession =dataConn.getSqlSession();
//
// List<CourseStudentDetails> courseStudentDetails = sqlSession.selectList("findChosenCourseAndChosenCourseDetail");
// if (courseStudentDetails !=null){
// CourseStudentDetails courseStudentDetails = null;
// for (int i = 0; i< courseStudentDetails.size(); i++){
// courseStudentDetails = courseStudentDetails.get(i);
// System.out.println("课程名"+ courseStudentDetails.getCourse_name());
// System.out.println("课程编号"+ courseStudentDetails.getCourse_id());
// System.out.println("学时"+ courseStudentDetails.getCourse_hour());
// System.out.println("开课学期"+ courseStudentDetails.getCourse_term());
// System.out.println("学分"+ courseStudentDetails.getCredit());
// System.out.println("课程性质"+ courseStudentDetails.getCourse_nature());
// }
// }
//
// }
// @Test
// public void testfindStudentAndCourse() throws Exception {
//
// SqlSession sqlSession = dataConn.getSqlSession();
// CourseStudentItem courseStudentItem = sqlSession.selectOne("findStudentAndCourse");
// if (courseStudentItem !=null){
// Student student = courseStudentItem.getStudent();
// List<CourseStudentDetails> courseStudentDetails = courseStudentItem.getChosenCourseItems();
//
// System.out.println("学号为:"+student.getStudent_id());
// System.out.println("姓名为:"+student.getName());
// System.out.println("学院"+student.getCollege());
// System.out.println("入学时间“:"+student.getAdmission_time());
// System.out.println("选课详细如下:");
// CourseStudentDetails courseStudentDetails =null;
// if(courseStudentDetails !=null){
// for (int i = 0; i< courseStudentDetails.size(); i++){
// courseStudentDetails = courseStudentDetails.get(i);
// System.out.println(courseStudentDetails.getCourse_name());
// System.out.println(courseStudentDetails.getCourse_hour());
// System.out.println(courseStudentDetails.getCourse_id());
// System.out.println(courseStudentDetails.getCourse_term());
// System.out.println(courseStudentDetails.getCourse_nature());
// System.out.println(courseStudentDetails.getCredit());
// }
// }
// }
// sqlSession.close();
// }
}