package com.example.mapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface UserMapper {
@Select("select count(*) from choice.user where UserName = #{username} and Password = #{password} and Position like concat('%', #{position}, '%')")
int getByUser(@Param("username") String username, @Param("password") String password, @Param("position") String position);
@Insert("insert into user(UserName, Password, Position) VALUES (#{username}, #{password}, #{position})")
void add(String username, String password, String position);
@Insert("insert into teacher(TeacherID,TeacherName,TeacherSex,TeacherCollege,Position) VALUES (#{teacherID},#{teacherName},#{teacherSex},#{teacherCollege},#{position})")
void addTea(String teacherID, String teacherName, String teacherSex, String teacherCollege, String position);
@Insert("INSERT INTO student(StudentID, StudentName, StudentSex, StudentClass, StudentMajor) VALUES (#{studentID},#{studentName},#{studentSex},#{studentClass},#{studentMajor})")
void addStu(String studentID, String studentName, String studentSex, String studentClass, String studentMajor);
}
TeacherMapper
package com.example.mapper;
import com.example.pojo.Course;
import com.example.pojo.Information;
import com.example.pojo.Teacher;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@Mapper
public interface TeacherMapper {
@Select("select * from teacher where TeacherID=#{username}")
Teacher getName(String username);
@Insert("insert into course(CourseID, CourseName, CourseCount, Courseteacher,Count) VALUES (#{courseID},#{courseName},#{courseCount},#{courseTeacher},#{count})")
void addCourse(String courseID, String courseName, int courseCount, String courseTeacher, int count);
@Update("update teacher set TeacherName=#{teacherName},TeacherSex=#{teacherSex},TeacherCollege=#{teacherCollege},Position=#{position} where TeacherID=#{teacherID}")
void updateTea(String teacherID, String teacherName, String teacherSex, String teacherCollege, String position);
@Select("select * from teacher where TeacherName=#{name}")
Teacher getByName(String name);
@Select("select * from teacher where TeacherID=#{username}")
Teacher getAll(String username);
@Select("select * from course where CourseTeacher=#{name}")
List<Course> getCourse(String name);
}
StudentMapper
package com.example.mapper;
import com.example.pojo.Course;
import com.example.pojo.Information;
import com.example.pojo.Student;
import com.example.pojo.Teacher;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@Mapper
public interface StudentMapper {
@Select("select * from choice.student where StudentID=#{username}")
Student getName(String username);
@Update("update choice.student set StudentName=#{studentName},StudentSex=#{studentSex},StudentClass=#{studentClass},StudentMajor=#{studentMajor} where StudentID=#{studentID}")
void update(String studentID, String studentName, String studentSex, String studentClass, String studentMajor);
@Select("select * from choice.course where CourseID=#{name}")
Course selectCourse(String name);
@Select("select * from choice.teacher where TeacherName=#{name}")
Teacher selectAll(String name);
@Select("SELECT * from choice.course")
List<Course> select();
@Insert("insert into choice.information(CourseID, TeacherID, StudentID) VALUES (#{courseID},#{teacherID},#{studentID})")
void choose1(String courseID, String teacherID, String studentID);
@Update("update choice.course set Count=#{count} where CourseID=#{id}")
void updateCourse(String id, String count);
@Select("select * from choice.course where CourseID=#{id}")
Course cc(String id);
@Select("select * from choice.information where CourseID=#{id}")
List<Information> getInformation(String name);
}

浙公网安备 33010602011771号