基于javaweb+SSM+Maven教务选课管理系统(管理员、教师、学生)
开发工具:eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
public Criteria andClassroomEqualTo(String value) {
addCriterion("classRoom =", value, "classroom");
return (Criteria) this;
}
public Criteria andClassroomNotEqualTo(String value) {
addCriterion("classRoom <>", value, "classroom");
return (Criteria) this;
}
public Criteria andClassroomGreaterThan(String value) {
addCriterion("classRoom >", value, "classroom");
return (Criteria) this;
public Criteria andCoursetypeNotLike(String value) {
addCriterion("courseType not like", value, "coursetype");
return (Criteria) this;
}
public Criteria andCoursetypeIn(List<String> values) {
addCriterion("courseType in", values, "coursetype");
return (Criteria) this;
}
public Criteria andCoursetypeNotIn(List<String> values) {
addCriterion("courseType not in", values, "coursetype");
return (Criteria) this;
}
public Criteria andCoursetypeBetween(String value1, String value2) {
// 教师页面显示
@RequestMapping("/showTeacher")
public String showTeacher(Model model, Integer page) throws Exception {
List<TeacherCustom> list = null;
//页码对象
PagingVO pagingVO = new PagingVO();
//设置总页数
pagingVO.setTotalCount(teacherService.getCountTeacher());
if (page == null || page == 0) {
pagingVO.setToPageNo(1);
list = teacherService.findByPaging(1);
} else {
pagingVO.setToPageNo(page);
list = teacherService.findByPaging(page);
}
model.addAttribute("teacherList", list);
userlogin.setPassword("123");
userlogin.setRole(1);
userloginService.save(userlogin);
//重定向
return "redirect:/admin/showTeacher";
}
// 修改教师信息页面显示
@RequestMapping(value = "/editTeacher", method = {RequestMethod.GET})
public String editTeacherUI(Integer id, Model model) throws Exception {
if (id == null) {
return "redirect:/admin/showTeacher";
}
TeacherCustom teacherCustom = teacherService.findById(id);
List<College> list = collegeService.finAll();
model.addAttribute("collegeList", list);
return "admin/addTeacher";
}
// 添加教师信息处理
@RequestMapping(value = "/addTeacher", method = {RequestMethod.POST})
public String addTeacher(TeacherCustom teacherCustom, Model model) throws Exception {
Boolean result = teacherService.save(teacherCustom);
if (!result) {
model.addAttribute("message", "工号重复");
return "error";
}
//添加成功后,也添加到登录表
Userlogin userlogin = new Userlogin();
userlogin.setUsername(teacherCustom.getUserid().toString());
userlogin.setPassword("123");
userlogin.setRole(1);
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
userID, userName, sex, birthYear, degree, title, grade, collegeID
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.demo.vo.TeacherExample" >
select
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
// 修改教师信息页面处理
@RequestMapping(value = "/editCourse", method = {RequestMethod.POST})
public String editCourse(CourseCustom courseCustom) throws Exception {
courseService.upadteById(courseCustom.getCourseid(), courseCustom);
//重定向
return "redirect:/admin/showCourse";
}
// 删除课程信息
@RequestMapping("/removeCourse")
public String removeCourse(Integer id) throws Exception {
if (id == null) {
//加入没有带教师id就进来的话就返回教师显示页面
return "admin/showCourse";
}
courseService.removeById(id);
return "redirect:/admin/showCourse";
}
//搜索课程
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
运行环境
Java≥6、Tomcat≥7.0、MySQL≥5.5
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
技术框架
JavaBean MVC JSP SSM(Spring SpringMVC MyBatis) Maven MySQL Bootstrap JavaScript
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
管理员:课程、教师、学生模板的增删改查管理
教师:查看授课、成绩、打分等
学生:查看课程、选课、退课等
管理员
学生
教师