- 创建Clazz、Department、Major、Notice、Student等实体类 - 配置MyBatis全局设置和数据库连接信息 - 更新项目模块依赖库和数据源配置 - 修改数据库配置从ssm_farm到ssm_score_sys - 添加完整的数据库表结构定义和测试数据 - 移除旧测试类并创建新的MyBatis测试类 - 配置IDE SQL方言和项目依赖库引用main
parent
d09c2f50fa
commit
e69d324f70
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="@localhost" uuid="2e07ca1c-b2e7-4736-9ec7-91fcd49ea206">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.resource.type" value="Deployment" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,10 @@
|
||||
<component name="libraryTable">
|
||||
<library name="lib (2)">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/grademanagement-SpringMVCProject/web/WEB-INF/lib" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/grademanagement-SpringMVCProject/web/WEB-INF/lib" recursive="false" />
|
||||
</library>
|
||||
</component>
|
||||
@ -0,0 +1,10 @@
|
||||
<component name="libraryTable">
|
||||
<library name="lib (3)">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/grademanagement-MyBatisProject/lib" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/grademanagement-MyBatisProject/lib" recursive="false" />
|
||||
</library>
|
||||
</component>
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/grademanagement-MyBatisProject/src/ssm_score_sys.sql" dialect="GenericSQL" />
|
||||
<file url="PROJECT" dialect="MySQL" />
|
||||
</component>
|
||||
</project>
|
||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,59 @@
|
||||
package com.ssm.entity;
|
||||
|
||||
public class Clazz {
|
||||
private Integer classId;
|
||||
private String className;
|
||||
private Integer majorId; // 关联专业ID
|
||||
private String grade;
|
||||
|
||||
public Clazz() {}
|
||||
|
||||
public Clazz(Integer classId, String className, Integer majorId, String grade) {
|
||||
this.classId = classId;
|
||||
this.className = className;
|
||||
this.majorId = majorId;
|
||||
this.grade = grade;
|
||||
}
|
||||
|
||||
public Integer getClassId() {
|
||||
return classId;
|
||||
}
|
||||
|
||||
public void setClassId(Integer classId) {
|
||||
this.classId = classId;
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
public Integer getMajorId() {
|
||||
return majorId;
|
||||
}
|
||||
|
||||
public void setMajorId(Integer majorId) {
|
||||
this.majorId = majorId;
|
||||
}
|
||||
|
||||
public String getGrade() {
|
||||
return grade;
|
||||
}
|
||||
|
||||
public void setGrade(String grade) {
|
||||
this.grade = grade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Class{" +
|
||||
"classId=" + classId +
|
||||
", className='" + className + '\'' +
|
||||
", majorId=" + majorId +
|
||||
", grade='" + grade + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.ssm.entity;
|
||||
|
||||
public class Department {
|
||||
private Integer deptId;
|
||||
private String deptName;
|
||||
private String deptCode;
|
||||
private String deptPhone;
|
||||
private String deptAddress;
|
||||
|
||||
public Department() {}
|
||||
|
||||
public Department(Integer deptId, String deptName, String deptCode, String deptPhone, String deptAddress) {
|
||||
this.deptId = deptId;
|
||||
this.deptName = deptName;
|
||||
this.deptCode = deptCode;
|
||||
this.deptPhone = deptPhone;
|
||||
this.deptAddress = deptAddress;
|
||||
}
|
||||
|
||||
public Integer getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Integer deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public String getDeptCode() {
|
||||
return deptCode;
|
||||
}
|
||||
|
||||
public void setDeptCode(String deptCode) {
|
||||
this.deptCode = deptCode;
|
||||
}
|
||||
|
||||
public String getDeptPhone() {
|
||||
return deptPhone;
|
||||
}
|
||||
|
||||
public void setDeptPhone(String deptPhone) {
|
||||
this.deptPhone = deptPhone;
|
||||
}
|
||||
|
||||
public String getDeptAddress() {
|
||||
return deptAddress;
|
||||
}
|
||||
|
||||
public void setDeptAddress(String deptAddress) {
|
||||
this.deptAddress = deptAddress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Department{" +
|
||||
"deptId=" + deptId +
|
||||
", deptName='" + deptName + '\'' +
|
||||
", deptCode='" + deptCode + '\'' +
|
||||
", deptPhone='" + deptPhone + '\'' +
|
||||
", deptAddress='" + deptAddress + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.ssm.entity;
|
||||
|
||||
public class Major {
|
||||
private Integer majorId;
|
||||
private String majorName;
|
||||
private String majorCode;
|
||||
private Integer deptId; // 关联院系ID
|
||||
private Integer studyYear;
|
||||
|
||||
public Major() {}
|
||||
|
||||
public Major(Integer majorId, String majorName, String majorCode, Integer deptId, Integer studyYear) {
|
||||
this.majorId = majorId;
|
||||
this.majorName = majorName;
|
||||
this.majorCode = majorCode;
|
||||
this.deptId = deptId;
|
||||
this.studyYear = studyYear;
|
||||
}
|
||||
|
||||
public Integer getMajorId() {
|
||||
return majorId;
|
||||
}
|
||||
|
||||
public void setMajorId(Integer majorId) {
|
||||
this.majorId = majorId;
|
||||
}
|
||||
|
||||
public String getMajorName() {
|
||||
return majorName;
|
||||
}
|
||||
|
||||
public void setMajorName(String majorName) {
|
||||
this.majorName = majorName;
|
||||
}
|
||||
|
||||
public String getMajorCode() {
|
||||
return majorCode;
|
||||
}
|
||||
|
||||
public void setMajorCode(String majorCode) {
|
||||
this.majorCode = majorCode;
|
||||
}
|
||||
|
||||
public Integer getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Integer deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public Integer getStudyYear() {
|
||||
return studyYear;
|
||||
}
|
||||
|
||||
public void setStudyYear(Integer studyYear) {
|
||||
this.studyYear = studyYear;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Major{" +
|
||||
"majorId=" + majorId +
|
||||
", majorName='" + majorName + '\'' +
|
||||
", majorCode='" + majorCode + '\'' +
|
||||
", deptId=" + deptId +
|
||||
", studyYear=" + studyYear +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
package com.ssm.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Notice {
|
||||
private Integer noticeId;
|
||||
private String title;
|
||||
private String content;
|
||||
private Date publishTime;
|
||||
private String publisher;
|
||||
private Integer status;
|
||||
|
||||
public Notice() {}
|
||||
|
||||
public Notice(Integer noticeId, String title, String content, Date publishTime, String publisher, Integer status) {
|
||||
this.noticeId = noticeId;
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
this.publishTime = publishTime;
|
||||
this.publisher = publisher;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getNoticeId() {
|
||||
return noticeId;
|
||||
}
|
||||
|
||||
public void setNoticeId(Integer noticeId) {
|
||||
this.noticeId = noticeId;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Date getPublishTime() {
|
||||
return publishTime;
|
||||
}
|
||||
|
||||
public void setPublishTime(Date publishTime) {
|
||||
this.publishTime = publishTime;
|
||||
}
|
||||
|
||||
public String getPublisher() {
|
||||
return publisher;
|
||||
}
|
||||
|
||||
public void setPublisher(String publisher) {
|
||||
this.publisher = publisher;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Notice{" +
|
||||
"noticeId=" + noticeId +
|
||||
", title='" + title + '\'' +
|
||||
", content='" + content + '\'' +
|
||||
", publishTime=" + publishTime +
|
||||
", publisher='" + publisher + '\'' +
|
||||
", status=" + status +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
package com.ssm.entity;
|
||||
|
||||
public class Student {
|
||||
private Integer studentId;
|
||||
private String studentNo;
|
||||
private String studentName;
|
||||
private String gender;
|
||||
private Integer age;
|
||||
private Integer classId; // 关联班级ID
|
||||
private String phone;
|
||||
|
||||
public Student() {}
|
||||
|
||||
public Student(Integer studentId, String studentNo, String studentName, String gender, Integer age, Integer classId, String phone) {
|
||||
this.studentId = studentId;
|
||||
this.studentNo = studentNo;
|
||||
this.studentName = studentName;
|
||||
this.gender = gender;
|
||||
this.age = age;
|
||||
this.classId = classId;
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public Integer getStudentId() {
|
||||
return studentId;
|
||||
}
|
||||
|
||||
public void setStudentId(Integer studentId) {
|
||||
this.studentId = studentId;
|
||||
}
|
||||
|
||||
public String getStudentNo() {
|
||||
return studentNo;
|
||||
}
|
||||
|
||||
public void setStudentNo(String studentNo) {
|
||||
this.studentNo = studentNo;
|
||||
}
|
||||
|
||||
public String getStudentName() {
|
||||
return studentName;
|
||||
}
|
||||
|
||||
public void setStudentName(String studentName) {
|
||||
this.studentName = studentName;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public Integer getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(Integer age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public Integer getClassId() {
|
||||
return classId;
|
||||
}
|
||||
|
||||
public void setClassId(Integer classId) {
|
||||
this.classId = classId;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Student{" +
|
||||
"studentId=" + studentId +
|
||||
", studentNo='" + studentNo + '\'' +
|
||||
", studentName='" + studentName + '\'' +
|
||||
", gender='" + gender + '\'' +
|
||||
", age=" + age +
|
||||
", classId=" + classId +
|
||||
", phone='" + phone + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
package com.ssm.test;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Test {
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,8 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<!-- mybatis全局配置文件 -->
|
||||
<configuration>
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<!-- 开启驼峰命名映射 -->
|
||||
<settings>
|
||||
<setting name="mapUnderscoreToCamelCase" value="true"/>
|
||||
</settings>
|
||||
|
||||
<environments default="development">
|
||||
<environment id="development">
|
||||
<transactionManager type="JDBC"/>
|
||||
<dataSource type="POOLED">
|
||||
<property name="driver" value="com.mysql.cj.jdbc.Driver"/>
|
||||
<property name="url" value="jdbc:mysql://localhost:3306/ssm_score_sys?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false"/>
|
||||
<property name="username" value="root"/>
|
||||
<property name="password" value="123456"/>
|
||||
</dataSource>
|
||||
</environment>
|
||||
</environments>
|
||||
|
||||
<mappers>
|
||||
<mapper resource="com/ssm/mapper/StudentMapper.xml"/>
|
||||
<mapper resource="com/ssm/mapper/DepartmentMapper.xml"/>
|
||||
<mapper resource="com/ssm/mapper/MajorMapper.xml"/>
|
||||
<mapper resource="com/ssm/mapper/NoticeMapper.xml"/>
|
||||
<mapper resource="com/ssm/mapper/ClassMapper.xml"/>
|
||||
</mappers>
|
||||
</configuration>
|
||||
@ -1,4 +1,4 @@
|
||||
driver=com.mysql.cj.jdbc.Driver
|
||||
url=jdbc:mysql://localhost:3306/ssm_farm?serverTimezone=Asia/Shanghai
|
||||
url=jdbc:mysql://localhost:3306/ssm_score_sys?serverTimezone=Asia/Shanghai
|
||||
user=root
|
||||
password=root
|
||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue