package com.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.ui.Model;
import com.entity.Student;
import com.service.StudentService;
import com.entity.Banji;
import com.service.BanjiService;
import com.util.Page;
import com.util.Pagesize;
import com.util.Pagination;
//告诉spring mvc这是一个控制器类
@Controller
//RequestMapping注解会将 HTTP 请求映射到 MVC 和 REST 控制器的处理方法上。
@RequestMapping("")
public class StudentController {
//它可以对类成员变量,方法及构造函数进行标注,完成自动装配的工作,通过 @Autowired的使用来消除 set,get方法
@Autowired
StudentService studentService;
@Autowired
BanjiService banjiService;
@Autowired
HttpServletRequest request;
//学生列表管理页面
@RequestMapping("studentlist")
public String listStudent(Model model){
String w="";
if (!"".equals(request.getParameter("name")) && request.getParameter("name") !=null)
w=w+ " and name like '%"+request.getParameter("name")+"%'";
if (!"".equals(request.getParameter("banji")) && request.getParameter("banji") !=null)
w=w+ " and banji = '"+request.getParameter("banji")+"'";
List<Student> cs= studentService.list(w);
for(int i=0;i<cs.size();i++)
{
Student student=(Student)cs.get(i);
}
List<Banji> banji= banjiService.list("");
// 放入转发参数
model.addAttribute("banji", banji);
int index=0;
if(request.getParameter("index")==null)
{index=1;}
else
{index=Integer.parseInt(request.getParameter("index"));}
int fromIndex = (index - 1) * Pagesize.size;
int toIndex = Math.min(fromIndex + Pagesize.size, cs.size());
List<Student> cs1 = cs.subList(fromIndex, toIndex);
Pagination p = new Pagination();//创建 分页对象
p.setIndex(index);//设置页数
p.setPageSize(Pagesize.size);
p.setTotle(cs.size());//设置总共的条数
p.setData(cs1);//设置数据
// 放入转发参数
model.addAttribute("cs", p);
model.addAttribute("page", p);
model.addAttribute("dlist", cs);
// 放入转发参数
return "pages/student/studentlist";
}
@RequestMapping("studentadd")
public String addstudent(Model model){
List<Banji> banji= banjiService.list("");
// 放入转发参数
model.addAttribute("banji", banji);
return "pages/student/studentadd";
}
//添加学生数据
@RequestMapping("studentinsert")
public String insertStudent(Student student,Model model){
String forword=request.getParameter("forword");
studentService.insert(student);
model.addAttribute("msg","成功");
model.addAttribute("path",forword);
return "success"; }
//删除学生数据
@RequestMapping("studentdel")
public String deleteStudent(Student student,Model model){
String forword=request.getParameter("forword");
studentService.delete(student);
model.addAttribute("msg","删除成功");
model.addAttribute("path",forword);
return "success";
}//提取要修改的学生数据
@RequestMapping("studentedit")
public String editStudent(Model model,Student student){
Student c= studentService.get(student.getId());
List<Banji> banji= banjiService.list("");
// 放入转发参数
model.addAttribute("banji", banji);
model.addAttribute("c", c);
return "pages/student/studentedit";
}
//修改的学生数据
@RequestMapping("studentupdate")
public String updateStudent(Student student,Model model){
String forword=request.getParameter("forword");
studentService.update(student);
model.addAttribute("msg","操作成功");
model.addAttribute("path",forword);
return "success";
}
@RequestMapping("studentAll1")
public String listStudentAll1(Model model){
HttpSession session=request.getSession();
String uname= (String) session.getAttribute("loginbanji");
String w=" and banji='"+uname+"'";
if (!"".equals(request.getParameter("name")) && request.getParameter("name") !=null)
w=w+ " and name like '%"+request.getParameter("name")+"%'";
if (!"".equals(request.getParameter("banji")) && request.getParameter("banji") !=null)
w=w+ " and banji = '"+request.getParameter("banji")+"'";
List<Student> cs= studentService.list(w);
for(int i=0;i<cs.size();i++)
{
Student student=(Student)cs.get(i);
}
List<Banji> banji= banjiService.list("");
// 放入转发参数
model.addAttribute("banji", banji);
int index=0;
if(request.getParameter("index")==null)
{index=1;}
else
{index=Integer.parseInt(request.getParameter("index"));}
int fromIndex = (index - 1) * Pagesize.size;
int toIndex = Math.min(fromIndex + Pagesize.size, cs.size());
List<Student> cs1 = cs.subList(fromIndex, toIndex);
Pagination p = new Pagination();//创建 分页对象
p.setIndex(index);//设置页数
p.setPageSize(Pagesize.size);
p.setTotle(cs.size());//设置总共的条数
p.setData(cs1);//设置数据
// 放入转发参数
model.addAttribute("cs", p);
model.addAttribute("page", p);
model.addAttribute("dlist", cs);
// 放入转发参数
return "pages/student/studentAll1";
}
//学生所有列表页
@RequestMapping("studentAll")
public String listStudentAll(Model model){
String w="";
if (!"".equals(request.getParameter("name")) && request.getParameter("name") !=null)
w=w+ " and name like '%"+request.getParameter("name")+"%'";
if (!"".equals(request.getParameter("banji")) && request.getParameter("banji") !=null)
w=w+ " and banji = '"+request.getParameter("banji")+"'";
List<Student> cs= studentService.list(w);
for(int i=0;i<cs.size();i++)
{
Student student=(Student)cs.get(i);
}
List<Banji> banji= banjiService.list("");
// 放入转发参数
model.addAttribute("banji", banji);
int index=0;
if(request.getParameter("index")==null)
{index=1;}
else
{index=Integer.parseInt(request.getParameter("index"));}
int fromIndex = (index - 1) * Pagesize.size;
int toIndex = Math.min(fromIndex + Pagesize.size, cs.size());
List<Student> cs1 = cs.subList(fromIndex, toIndex);
Pagination p = new Pagination();//创建 分页对象
p.setIndex(index);//设置页数
p.setPageSize(Pagesize.size);
p.setTotle(cs.size());//设置总共的条数
p.setData(cs1);//设置数据
// 放入转发参数
model.addAttribute("cs", p);
model.addAttribute("page", p);
model.addAttribute("dlist", cs);
// 放入转发参数
return "pages/student/studentAll";
}
//注册
@RequestMapping("studentreg")
public String insertreg(Student student,Model model){
String forword=request.getParameter("forword");
String w=" and username='"+request.getParameter("username")+"'";
List<Student> cs= studentService.list(w);
if (cs.size()>0)
{
model.addAttribute("msg","用户名重复!请重试");
model.addAttribute("path",forword);
}
else{
studentService.insert(student);
model.addAttribute("msg","成功");
model.addAttribute("path",forword);
}
return "success";
}
//修改个人资料
@RequestMapping("studentinfo")
public String editStudentinfo(Model model,Student student){
Student c= studentService.get(student.getId());
List<Banji> banji= banjiService.list("");
// 放入转发参数
model.addAttribute("banji", banji);
model.addAttribute("c", c);
return "pages/student/studentinfo";
}
//保存修改个人资料数据
@RequestMapping("studentinfosave")
public String Studentinfosave(Student student,Model model){
String forword=request.getParameter("f
没有合适的资源?快使用搜索试试~ 我知道了~
基于ssm高校贫困生管理系统(java毕业设计).zip
共562个文件
png:96个
js:89个
class:62个
1星 需积分: 50 24 下载量 185 浏览量
2020-11-06
13:35:33
上传
评论 3
收藏 17.21MB ZIP 举报
温馨提示
B/S结构和java中流行的ssm框架和eclipse编辑器、MySQL数据库设计并实现的 。配套论文等资料,适合计算机毕业设计。
资源推荐
资源详情
资源评论
收起资源包目录
基于ssm高校贫困生管理系统(java毕业设计).zip (562个子文件)
JzuoyeController.class 8KB
StudentController.class 7KB
ZuoyeController.class 7KB
JiaofeiController.class 7KB
ChengjiController.class 7KB
BmController.class 7KB
TeacherController.class 6KB
JiazhangController.class 6KB
LiuyanController.class 6KB
KebiaoController.class 6KB
AdminController.class 5KB
loginController.class 5KB
KechengController.class 5KB
NoticeController.class 5KB
BanjiController.class 5KB
Jzuoye.class 3KB
Pagination.class 3KB
Bm.class 3KB
Student.class 3KB
Teacher.class 3KB
Page.class 2KB
UploadUtil.class 2KB
Chengji.class 2KB
Zuoye.class 2KB
Jiaofei.class 2KB
Jiazhang.class 2KB
JiazhangService.class 2KB
ChengjiService.class 2KB
KechengService.class 2KB
TeacherService.class 2KB
StudentService.class 2KB
JiaofeiService.class 2KB
JzuoyeService.class 2KB
KebiaoService.class 2KB
ZuoyeService.class 2KB
Kebiao.class 2KB
BmService.class 2KB
Liuyan.class 2KB
LiuyanService.class 2KB
NoticeService.class 2KB
AdminService.class 2KB
BanjiService.class 2KB
Notice.class 2KB
Kecheng.class 1KB
Result.class 1KB
Admin.class 1KB
Banji.class 1KB
JiazhangMapper.class 774B
ChengjiMapper.class 768B
KechengMapper.class 768B
StudentMapper.class 768B
JiaofeiMapper.class 768B
TeacherMapper.class 768B
JzuoyeMapper.class 762B
KebiaoMapper.class 762B
ZuoyeMapper.class 756B
BmMapper.class 738B
NoticeMapper.class 649B
LiuyanMapper.class 649B
AdminMapper.class 644B
BanjiMapper.class 644B
Pagesize.class 358B
.classpath 529B
org.eclipse.wst.common.component 456B
org.eclipse.wst.jsdt.ui.superType.container 49B
bootstrap.css 143KB
bootstrap.min.css 118KB
ueditor.css 44KB
ueditor.min.css 34KB
bootstrap-theme.css 26KB
bootstrap-theme.min.css 23KB
video-js.css 21KB
image.css 19KB
video.css 15KB
attachment.css 15KB
layer.css 14KB
video-js.min.css 11KB
fileinput.min.css 8KB
laydate.css 8KB
shCoreDefault.css 7KB
laydate.css 6KB
css.css 5KB
layer.css 5KB
scrawl.css 4KB
bootstrap-table.min.css 4KB
laydate.css 3KB
laydate.css 3KB
laydate.css 3KB
laydate.css 3KB
laydate.css 3KB
laydate.css 3KB
laydate.css 3KB
codemirror.css 3KB
charts.css 3KB
background.css 2KB
emotion.css 2KB
dialogbase.css 2KB
music.css 2KB
edittable.css 1KB
template.css 1KB
共 562 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- 我想要两颗西柚��2021-03-18花钱 不全 11
- vues2023-01-02非常不好,真的很不好,没法使用。
weixin_37971904
- 粉丝: 3163
- 资源: 36
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功