SSM整合开发的小Demo----毕业设计管理系统之教师模块

该模块的主要功能如下:

                  SSM整合开发的小Demo----毕业设计管理系统之教师模块_第1张图片

先看看结果怎样,一睹为快

SSM整合开发的小Demo----毕业设计管理系统之教师模块_第2张图片


SSM整合开发的小Demo----毕业设计管理系统之教师模块_第3张图片


SSM整合开发的小Demo----毕业设计管理系统之教师模块_第4张图片



SSM整合开发的小Demo----毕业设计管理系统之教师模块_第5张图片


SSM整合开发的小Demo----毕业设计管理系统之教师模块_第6张图片


SSM整合开发的小Demo----毕业设计管理系统之教师模块_第7张图片


SSM整合开发的小Demo----毕业设计管理系统之教师模块_第8张图片


SSM整合开发的小Demo----毕业设计管理系统之教师模块_第9张图片


示例程序(教师出题)代码:

#数据模型层

package com.east.entity;

import java.io.Serializable;

public class Subject implements Serializable {
  private Integer subject_id;               //课题ID
  private String  subject_title;            //课题名称
  private String  subject_condition;        //课题要求
  private String  tea_name;                 //导师名称
  private String  degree;                   //导师职称
  private String  stu_name;                 //选课学生
  private String  status;                   //论文状态
  private String  audit;                    //编辑状态
  private String  AuditSituation;           //审核情况
public Integer getSubject_id() {
	return subject_id;
}
public void setSubject_id(Integer subject_id) {
	this.subject_id = subject_id;
}
public String getSubject_title() {
	return subject_title;
}
public void setSubject_title(String subject_title) {
	this.subject_title = subject_title;
}

public String getSubject_condition() {
	return subject_condition;
}
public void setSubject_condition(String subject_condition) {
	this.subject_condition = subject_condition;
}
public String getTea_name() {
	return tea_name;
}
public void setTea_name(String tea_name) {
	this.tea_name = tea_name;
}
public String getDegree() {
	return degree;
}
public void setDegree(String degree) {
	this.degree = degree;
}
public String getStu_name() {
	return stu_name;
}
public void setStu_name(String stu_name) {
	this.stu_name = stu_name;
}
public String getStatus() {
	return status;
}
public void setStatus(String status) {
	this.status = status;
}
public String getAudit() {
	return audit;
}
public void setAudit(String audit) {
	this.audit = audit;
}

public String getAuditSituation() {
	return AuditSituation;
}
public void setAuditSituation(String auditSituation) {
	AuditSituation = auditSituation;
}
@Override
public String toString() {
	return "Subject [subject_id=" + subject_id + ", subject_title=" + subject_title + ", subject_condition="
			+ subject_condition + ", tea_name=" + tea_name + ", degree=" + degree + ", stu_name=" + stu_name
			+ ", status=" + status + ", audit=" + audit + ", AuditSituation=" + AuditSituation + "]";
}
  
}

#数据访问层

package com.east.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.east.entity.Subject;

public interface SubjectDao {
   /*
    * 查询所有课题
    */
	@Select("select * from subject where status = #{status}")
	List findByStatus(Subject subject);
	
	/*
	 * 教师出题
	 */
	@Insert("insert into subject(subject_title,subject_condition,tea_name,degree) "
			+ " values(#{subject_title},#{subject_condition},#{tea_name},#{degree})")
	@Options(useGeneratedKeys = true,keyProperty="subject_id")
    void AddSubjet(Subject subject);
	
	/*
	 * 查询某个老师出的题
	 */
	@Select("select * from subject where tea_name = #{tea_name}")
	Subject findByTeaName(String tea_name);
	
	/*
	 * 删除某个教师的课题
	 */
	@Delete("delete from subject where tea_name = #{tea_name}")
	void DeleteSub(Subject subject);
	
	/*
	 * 获取所有课题
	 */
	@Select("select * from subject")
	List findAll();
}

#业务逻辑层

package com.east.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.east.dao.SubjectDao;
import com.east.entity.Subject;

@Transactional(propagation=Propagation.REQUIRED,isolation=Isolation.DEFAULT)
@Service("subjectBiz")
public class SubjectBiz {
    /*
     * 自动注入SubjectBiz
     */
	@Autowired
	private SubjectDao subjectDao;
	
	/*
	 * 查询所有课题
	 */
	public List findByStatus(Subject subject){
		return subjectDao.findByStatus(subject);
	}
	
	/*
	 * 查询某个学生的课题
	 */
	public Subject findByStuName(String stu_name){
		return subjectDao.findByStuName(stu_name);
	}
	
	/*
	 * 学生选题
	 */
	public void UpdateSub(Subject subject){
		subjectDao.UpdateSub(subject);
	}
	
	/*
	 * 教师出题
	 */
	public void AddSubjet(Subject subject){
		subjectDao.AddSubjet(subject);
	}
	
	/*
	 * 查询某个老师出的题
	 */
	public Subject findByTeaName(String tea_name){
		return subjectDao.findByTeaName(tea_name);
	}
	
	/*
	 * 删除某个教师的课题
	 */
	public void DeleteSub(Subject subject){
		subjectDao.DeleteSub(subject);
	}
	
	/*
	 * 获取所有课题
	 */
	public List findAll(){
		return subjectDao.findAll();
	}
}

#控制层

package com.east.action;

import java.io.IOException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.servlet.ServletUtilities;
import org.jfree.data.general.DefaultPieDataset;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.east.entity.Student;
import com.east.entity.Subject;
import com.east.entity.Teacher;
import com.east.service.SubjectBiz;
//import com.east.util.JFreeUtil;
import com.east.util.JFreeUtil;

/*
 * 处理用户请求的控制器
 */
@Controller
public class SubjectAction {
    //自动注入UserService
	@Autowired
	@Qualifier("subjectBiz")
	private SubjectBiz subjectBiz;
	
	/*
	 * 教师出题
	 */
	@RequestMapping(value="/Drawing")
	public ModelAndView Drawing(String subject_title,String subject_condition,ModelAndView mv,HttpSession session){
        Teacher tea = (Teacher) session.getAttribute("user");
		String tea_name = tea.getTea_name();
		String degree = tea.getDegree();
		
		Subject sub = new Subject();
		sub.setSubject_title(subject_title);
		sub.setSubject_condition(subject_condition);
		sub.setTea_name(tea_name);
		sub.setDegree(degree);
		
		subjectBiz.AddSubjet(sub);
        
		mv.setViewName("/teacher/Drawing");
		return mv;     
	}
	
	/*
	 * 删除某个教师的课题
	 */
	@RequestMapping(value="/DeleteSub")
	public ModelAndView DeleteSub(ModelAndView mv,HttpSession session){
        Teacher tea = (Teacher) session.getAttribute("user");
		String tea_name = tea.getTea_name();
		
		Subject sub = new Subject();
		sub.setTea_name(tea_name);
		subjectBiz.DeleteSub(sub);       //删除信息
        
		mv.setViewName("/teacher/MySubject");
		return mv;     
	}
	
}

#视图层

<%@page import="com.east.entity.Subject"%>
<%@page import="com.east.entity.Teacher"%>
<%@page import="com.east.service.SubjectBiz"%>
<%@page import="org.springframework.context.support.ClassPathXmlApplicationContext"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>




我要出题
  
  
    
  
 
 
 


<%
    ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
    SubjectBiz subjectBiz = (SubjectBiz) ctx.getBean("subjectBiz");
    Teacher tea = (Teacher) session.getAttribute("user");
    String tea_name = tea.getTea_name();
    Subject sub = subjectBiz.findByTeaName(tea_name);
%>
<%
    if(sub==null){
%>
我要出题
<% }else{ %>
我要出题
<% } %>



你可能感兴趣的:(Spring,MVC,框架学习笔记,MyBatis,框架学习笔记)