package schoolhome.core.controller;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import schoolhome.core.po.ClassBean;
import schoolhome.core.po.Commodity;
import schoolhome.core.po.Homework;
import schoolhome.core.po.Student;
import schoolhome.core.po.StudentGrade;
import schoolhome.core.po.StudentWithHomework;
import schoolhome.core.po.Teacher;
import schoolhome.core.po.TeacherCommodityHomework;
import schoolhome.core.service.ClassBeanWithCommodityService;
import schoolhome.core.service.HomeworkService;
import schoolhome.core.service.StudentGradeService;
import schoolhome.core.service.StudentService;
import schoolhome.core.service.StudentWithHomeworkService;
import schoolhome.core.service.TeacherCommodityHomeworkService;
import schoolhome.core.service.TeacherService;
@Controller
public class TeacherController {
@Autowired
private TeacherService teacherService;
@Autowired
private StudentGradeService studentGradeService;
@Autowired
private ClassBeanWithCommodityService classBeanWithCommodityService;
@Autowired
private StudentService studentService;
@Autowired
private HomeworkService homeworkService;
@Autowired
private TeacherCommodityHomeworkService teacherCommodityHomeworkService;
@Autowired
private StudentWithHomeworkService studentWithHomeworkService;
/**
* 分页显示老师信息列表
* */
@RequestMapping(value="/teacherInformation.action")
public String queryAllOrderPage(Model model,HttpSession session,HttpServletRequest request){
session.removeAttribute("page_count");
session.removeAttribute("teacherList");
session.removeAttribute("p");
int page_count;//总页数
int p;//当前页数
int size = 15;//每页记录数
int result_count = teacherService.queryCountOfRows();//总记录数
int begin;//当前页第一条记录索引号
page_count = (result_count+size-1)/size;
String page_s = request.getParameter("page");
if(page_s==null) page_s="1";
p=Integer.parseInt(page_s);
begin = (p-1)*size;
ArrayList<Teacher> beans = teacherService.queryAllOrderPage(begin, size);
session.setAttribute("teacherList", beans);
session.setAttribute("page_count", page_count);
session.setAttribute("p", p);
return "/admin/teacherInformation";
}
/**
* 添加老师
* */
@RequestMapping(value="/addTeacher.action")
public void addUser(Teacher teacher,HttpServletResponse response){
response.setHeader("content-type", "text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
PrintWriter out = null;
try {
out = response.getWriter();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (teacherService.selectTeacherByTeacherUserName(teacher.getUserName())==null) {
teacherService.addTeacher(teacher);
out.print("<script>alert('添加成功');window.location='/test5/teacherInformation.action'</script>");
out.flush();
out.close();
}else {
out.print("<script>alert('userName用户名已存在');window.location='/test5/teacherInformation.action'</script>");
out.flush();
out.close();
}
}
/**
* 修改老师信息
* */
@RequestMapping("/teacherInformationUpdate.action")
public void updateTeacherInformation(int teacherId,String userName,String password,String teacherName,int age,String telephone,String gender,HttpServletResponse response){
Teacher teacher = new Teacher(teacherId, userName, password, teacherName, age, telephone, gender);
response.setHeader("content-type", "text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
PrintWriter out=null;
try {
out = response.getWriter();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (teacherService.selectTeacherByTeacherUserName(teacher.getUserName())!=null && teacherService.selectTeacherByTeacherUserName(teacher.getUserName()).getId()!=teacher.getId()) {
out.print("<script>alert('userName用户名已存在');window.location='/test5/teacherInformation.action'</script>");
out.flush();
out.close();
}else {
teacherService.updateTeacherInformation(teacher);
out.print("<script>alert('修改成功');window.location='/test5/teacherInformation.action'</script>");
out.flush();
out.close();
}
}
/**
* 删除老师通过id
* */
@RequestMapping("/deleteTeacherById.action")
public void deleteTeacherrById(int id,HttpServletResponse response){
response.setHeader("content-type", "text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
PrintWriter out=null;
try {
out = response.getWriter();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(teacherService.queryTeacherById(id)==null){
out.print("<script>alert('用户不存在');window.location='/test5/teacherInformation.action'</script>");
out.flush();
out.close();
}else {
teacherService.deleteTeacherById(id);
out.print("<script>alert('删除成功');window.location='/test5/teacherInformation.action'</script>");
out.flush();
out.close();
}
}
/**
* 老师修改学生成绩
* */
@RequestMapping("/teacherUpdateStudentGrade.action")
public void teacherUpdateStudentGrade(int classBean_id,int student_id,int commodity_id,double grade,HttpServletResponse response,HttpSession session,HttpServletRequest request){
response.setHeader("content-type", "text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
Teacher teacher = (Teacher)session.getAttribute("userinfor");
session.removeAttribute("userinfor");
PrintWriter out=null;
try {
out = response.getWriter();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
StudentGrade studentGrade=studentGradeService.queryStudentGradeByStudentIdAndCommodityId(student_id, commodity_id);
if(studentGrade!=null){
studentGrade.setGrade(grade);
studentGradeService.updateStudentGradeInformation(studentGrade);
for(ClassBean classBean:teacher.getClassBeanList()){
if(classBean.getId()==classBean_id){
for(Student studentBean:classBean.getStudentList()){
if(studentBean.getId()==student_id){
//studentBean=studentService.queryStudentById(student_id);
for(Commodity studentCommodity:studentBean.getCommodityList()){
if(studentCommodity.getId()==commodity_id){
studentCommodity.setGrade(grade);
break;
}
}
break;
}
}
break;
}
}
session.setAttribute("userinfor", teacher);
out.print("<script>alert('成绩修改成功');window.location='/test5/teacherQueryStudentGradeInformation.action?id="+classBean_id+"'</script>");
out.flush();
out.close();
}else {
studentGrade = new StudentGrade();
studentGrade.setStudent_id(student_id);
studentGrade.setCommodity_id(commodity_id);
studentGrade.setGrade(grade);
studentGradeService.addStudentGrade(studentGrade);
for(ClassBean classBean:teacher.getClassBeanList()){
if(classBean.getId()==classBean_id){
for(Student studentBean:classBean.getStudentList()){
if(studentBean.getId()==student_id){
classBean.getStudentList().remove(studentBean);
Student newStudentBean=studentService.queryStudentById(student_id);
for(Commodity studentCommodity:newStudentBean.getCommodityList())
studentCommodity.setClassBeanTeacher(classBeanWithCommodityService.queryT
没有合适的资源?快使用搜索试试~ 我知道了~
本科毕业设计-课程设计作业-基于SSM框架+mysql开发的家校通项目.zip
共755个文件
png:181个
jpg:101个
js:80个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 86 浏览量
2023-06-27
09:50:03
上传
评论
收藏 39.3MB ZIP 举报
温馨提示
本资源中的源码都是经过本地编译过可运行的,下载后按照文档配置好环境就可以运行。资源项目的难度比较适中,内容都是经过助教老师审定过的,应该能够满足学习、使用需求,如果有需要的话可以放心下载使用。有任何问题也可以随时私信博主,博主会第一时间给您解答!!! 本资源中的源码都是经过本地编译过可运行的,下载后按照文档配置好环境就可以运行。资源项目的难度比较适中,内容都是经过助教老师审定过的,应该能够满足学习、使用需求,如果有需要的话可以放心下载使用。有任何问题也可以随时私信博主,博主会第一时间给您解答!!! 本资源中的源码都是经过本地编译过可运行的,下载后按照文档配置好环境就可以运行。资源项目的难度比较适中,内容都是经过助教老师审定过的,应该能够满足学习、使用需求,如果有需要的话可以放心下载使用。有任何问题也可以随时私信博主,博主会第一时间给您解答!!!
资源推荐
资源详情
资源评论
收起资源包目录
本科毕业设计-课程设计作业-基于SSM框架+mysql开发的家校通项目.zip (755个子文件)
TeacherController.class 19KB
UserController.class 14KB
StudentController.class 13KB
ParentController.class 10KB
CommodityController.class 8KB
StudentGradeController.class 6KB
ClassBeanWithCommodityController.class 6KB
ClassBeanController.class 6KB
Student.class 5KB
CategoryController.class 5KB
Commodity.class 4KB
ClassScheduleController.class 4KB
Teacher.class 3KB
ClassBean.class 3KB
Parent.class 3KB
ClassBeanWithCommodity.class 3KB
StudentWithHomeworkServiceImpl.class 3KB
User.class 3KB
ClassBeanWithCommodityServiceImpl.class 3KB
StudentGradeServiceImpl.class 3KB
TeacherCommodityHomeworkServiceImpl.class 3KB
StudentWithHomework.class 3KB
Homework.class 2KB
ClassScheduleServiceImpl.class 2KB
TeacherCommodityHomework.class 2KB
ClassSchedule.class 2KB
TeacherServiceImpl.class 2KB
StudentServiceImpl.class 2KB
ParentServiceImpl.class 2KB
HomeworkServiceImpl.class 2KB
CommodityServiceImpl.class 2KB
CategoryServiceImpl.class 2KB
ClassBeanServiceImpl.class 2KB
UserServiceImpl.class 2KB
StudentGrade.class 2KB
HomeworkController.class 1KB
Category.class 1KB
StudentWithHomeworkDao.class 1KB
ClassBeanWithCommodityDao.class 1KB
StudentGradeDao.class 1KB
TeacherCommodityHomeworkDao.class 1KB
ClassScheduleDao.class 1KB
StudentWithHomeworkService.class 1KB
ClassBeanWithCommodityService.class 1KB
TeacherCommodityHomeworkService.class 975B
StudentGradeService.class 962B
TeacherDao.class 943B
StudentDao.class 939B
HomeworkDao.class 929B
ParentDao.class 927B
CommodityDao.class 901B
CategoryDao.class 887B
ClassScheduleService.class 881B
ClassBeanDao.class 848B
UserDao.class 831B
TeacherService.class 724B
StudentService.class 722B
HomeworkService.class 719B
CommodityService.class 709B
ParentService.class 709B
CategoryService.class 696B
ClassBeanService.class 656B
UserService.class 644B
.classpath 4KB
org.eclipse.wst.common.component 459B
amazeui.flat.css 324KB
amazeui.flat.css 324KB
amazeui.css 323KB
amazeui.css 323KB
amazeui.min.css 253KB
amazeui.min.css 253KB
amazeui.flat.min.css 250KB
amazeui.flat.min.css 250KB
amazeui.mineeeee.css 248KB
amazeui.mineeeee.css 248KB
style.css 43KB
shop.css 34KB
shop.css 34KB
skeleton.css 17KB
admin.css 16KB
admin.css 16KB
fullcalendar.min.css 15KB
fullcalendar.min.css 15KB
fullcalendar.css 12KB
player.css 12KB
style.css 11KB
base.css 10KB
amazeui.datatables.min.css 9KB
amazeui.datatables.min.css 9KB
fancybox.css 8KB
templatemo_style.css 8KB
app.css 7KB
app.css 7KB
echartsHome.css 7KB
echartsHome.css 7KB
fullcalendar.print.css 5KB
fullcalendar.print.css 5KB
main.css 4KB
main.css 4KB
main.css 4KB
共 755 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
白话机器学习
- 粉丝: 9127
- 资源: 7681
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功