package com.action;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.struts2.ServletActionContext;
import com.dao.TBanjiDAO;
import com.dao.TChengjiDAO;
import com.dao.TKechengDAO;
import com.dao.TLaoshiDAO;
import com.dao.TXueshengDAO;
import com.dao.TZhuanyeDAO;
import com.model.TBanji;
import com.model.TChengji;
import com.model.TXuesheng;
import com.model.TLaoshi;
import com.model.TZhuanye;
import com.opensymphony.xwork2.ActionSupport;
import com.util.Pagination;
public class chengjiAction extends ActionSupport {
private int zhuanyeId;
private int banjiId;
private int xueshengId;
private int kechengId;
private int chengjiId;
private String kaoshifenshu;
private String kaoshishijian;
private String kaoshileixing;
private String message;
private String path;
private TLaoshiDAO laoshiDAO;
private TZhuanyeDAO zhuanyeDAO;
private TBanjiDAO banjiDAO;
private TXueshengDAO xueshengDAO;
private TChengjiDAO chengjiDAO;
private TKechengDAO kechengDAO;
private String key = "";
/*
* 没用 public String selectZhuanye() { String sql =
* "from TZhuanye where zhuanyeDel='no' "; List zhuanyeList =
* zhuanyeDAO.getHibernateTemplate().find(sql); Map request = (Map)
* ServletActionContext.getContext().get("request");
* request.put("zhuanyeList", zhuanyeList); return ActionSupport.SUCCESS; }
*/
// 教师管理成绩 时 按班级显示学生
public String selectBanji() {
String sql = "from TBanji where banjiDel='no' ";
// 这里是Session判断,获取当前登录的教师的专业ID,然后只选择属于此专业的班级
Map session = ServletActionContext.getContext().getSession();
TLaoshi laoshi = (TLaoshi) session.get("laoshi");// 只显示当前登录教师的
if (laoshi != null) {
sql+=" and zhuanyeId='" + laoshi.getZhuanyeId() + "'";
}
List banjiList = banjiDAO.getHibernateTemplate().find(sql);
Map request = (Map) ServletActionContext.getContext().get("request");
request.put("banjiList", banjiList);
return ActionSupport.SUCCESS;
}
// 教师管理成绩 时 先选择学生
public String selectXuesheng() {
String sql = "from TXuesheng where xueshengDel='no' and banjiId=" + banjiId;
List xueshengList = xueshengDAO.getHibernateTemplate().find(sql);
Map request = (Map) ServletActionContext.getContext().get("request");
request.put("xueshengList", xueshengList);
return ActionSupport.SUCCESS;
}
// 根据所选的学生和教师的课程ID管理成绩
public String chengjiMana() {
Map session = ServletActionContext.getContext().getSession();
TLaoshi laoshi = (TLaoshi) session.get("laoshi");// 只显示当前登录教师的课程的学生
String sql = "from TChengji where xueshengId=? and kechengId=?";
Object[] con = { xueshengId, laoshi.getKechengId() };
List chengjiList = chengjiDAO.getHibernateTemplate().find(sql, con);
for (int i = 0; i < chengjiList.size(); i++) {
TChengji chengji = (TChengji) chengjiList.get(i);
int kechengId = chengji.getKechengId();
chengji.setChengjiOne1(kechengDAO.findById(kechengId).getKechengName());// 用于显示课程名称
chengji.setChengjiOne2(xueshengDAO.findById(chengji.getXueshengId()).getXueshengRealname());// 用于显示学生姓名
}
Map request = (Map) ServletActionContext.getContext().get("request");
request.put("chengjiList", chengjiList);
return ActionSupport.SUCCESS;
}
// 管理员删除
public String chengjiDel() {
TChengji chengji = chengjiDAO.findById(chengjiId);
chengjiDAO.delete(chengji);
this.setMessage("删除成功");
this.setPath("chengjiChakan.action");
return "succeed";
}
// 教师删除
public String chengjiDelQian() {
TChengji chengji = chengjiDAO.findById(chengjiId);
chengjiDAO.delete(chengji);
this.setMessage("删除成功");
this.setPath("chengjiMana.action?xueshengId=" + xueshengId + "&kechengId=" + kechengId);
return "succeed";
}
// 教师发布成绩
public String chengjiAdd() {
TChengji chengji = new TChengji();
chengji.setXueshengId(xueshengId);
chengji.setKechengId(kechengId);
chengji.setKaoshifenshu(kaoshifenshu );
chengji.setKaoshishijian(kaoshishijian);
chengji.setKaoshileixing(kaoshileixing);
Map session = ServletActionContext.getContext().getSession();
TLaoshi laoshi = (TLaoshi) session.get("laoshi");
chengji.setChengjiAddUser(laoshi.getLaoshiId().toString());
chengjiDAO.save(chengji);
this.setMessage("成绩录入成功");
this.setPath("chengjiMana.action?xueshengId=" + xueshengId + "&kechengId=" + laoshi.getKechengId());
return "succeed";
}
// 学生查看成绩
public String chengjiMine() {
String sql = "from TChengji where xueshengId=? order by kechengId";
Map session = ServletActionContext.getContext().getSession();
TXuesheng xuesheng = (TXuesheng) session.get("xuesheng");
Object[] con = { xuesheng.getXueshengId() };
List chengjiList = chengjiDAO.getHibernateTemplate().find(sql, con);
for (int i = 0; i < chengjiList.size(); i++) {
TChengji chengji = (TChengji) chengjiList.get(i);
int kechengId = chengji.getKechengId();
chengji.setChengjiOne1(kechengDAO.findById(kechengId).getKechengName());//课程名称
chengji.setChengjiOne2(laoshiDAO.findById( Integer.parseInt(chengji.getChengjiAddUser())).getLaoshiRealname());// 用于显示学生姓名
}
Map request = (Map) ServletActionContext.getContext().get("request");
request.put("chengjiList", chengjiList);
return ActionSupport.SUCCESS;
}
// 管理员成绩查看
public String chengjiChakan() throws UnsupportedEncodingException {
System.out.println("^^" + zhuanyeId + "^^^^" + banjiId);
StringBuffer sql = new StringBuffer("from TXuesheng where xueshengDel='no' ");
if (zhuanyeId != 0) {
sql.append(" and zhuanyeId=" + zhuanyeId);
}
if (banjiId != 0) {
sql.append(" and banjiId=" + banjiId);
}
System.out.println(sql.toString());
if (key != null) {
// key = new String(key.getBytes("iso8859-1"), "UTF-8");
sql.append(" and xueshengRealname like '%" + key.trim() + "%'");
}
sql.append(" order by xueshengId");
List xueshengList = xueshengDAO.getHibernateTemplate().find(sql.toString());// 先检索出学生
List chengjiList = new ArrayList();
for (int i = 0; i < xueshengList.size(); i++) {
TXuesheng xuesheng = (TXuesheng) xueshengList.get(i);
int xueshengId = xuesheng.getXueshengId();
String SQL2 = "from TChengji where xueshengId=" + xueshengId;
if (kechengId != 0) {
SQL2 += (" and kechengId=" + kechengId);
}
List list1 = chengjiDAO.getHibernateTemplate().find(SQL2);// 学生和课程检索成绩
for (int j = 0; j < list1.size(); j++) {
chengjiList.add(list1.get(j));
}
}
for (int i = 0; i < chengjiList.size(); i++) {
TChengji chengji = (TChengji) chengjiList.get(i);
int kechengId = chengji.getKechengId();
int xueshengId = chengji.getXueshengId();
chengji.setChengjiOne1(kechengDAO.findById(kechengId).getKechengName());// 绑定课程名称
chengji.setChengjiOne2(xueshengDAO.findById(xueshengId).getXueshengRealname());// 绑定学生姓名
TXuesheng xuesheng = xueshengDAO.findById(xueshengId);
chengji.setChengjiOne3(zhuanyeDAO.findById(xuesheng.getZhuanyeId()).getZhuanyeName());// 关联专业显示
chengji.setChengjiOne4(banjiDAO.findById(xuesheng.getBanjiId()).getBanjiName());// 关联班级显示
}
// 分页信息
int pageSize = 10;
int fromIndex = (index - 1) * pageSize;
int toIndex = Math.min(fromIndex + pageSize, chengjiList.size());
List chengjiListFenye = chengjiList.subList(fromIndex, toIndex);
Pagination p = new Pagination();// 创建 分页对象
p.setIndex(index);// 设置当前页数
p.setPageSize(pageSize);
p.setTotle(chengjiList.size());// 设置总共的条数
p.setData(chengjiListFenye);// 设置数据
p.setPath("chengjiChakan.action?");// 跳转的路径
Map request = (Map) ServletActionContext.getContext().get("request
没有合适的资源?快使用搜索试试~ 我知道了~
SSH框架javaweb学生成绩管理系统源码
共561个文件
js:108个
png:100个
gif:65个
4 下载量 35 浏览量
2023-01-08
15:21:59
上传
评论
收藏 16.67MB ZIP 举报
温馨提示
学生成绩管理系统SSH框架javaweb学生成绩管理系统源码 ,MYSQL数据库+源码 SSH+MYSQL 02源码\teachWEB\WebRoot\WEB-INF\applicationContext.xml中修改数据库root对应的登录密码 管理员用户名 admin 密码1111111 学生用户名xs密码 111111 老师用户名ls密码111111 学生 老师 管理员 实体描述: (1) 管理员信息(说明、编号、用户名、密码) (2) 班级信息(说明、编号、班级编号、名称、入学时间、所属年级) (3) 成绩信息表(说明、编号、学生ID、课程ID、分数、时间、类型、教师ID) (4) 公告信息(编号、名称、标题、内容、日期、发布人) (5) 课程信息(说明、编号、课程、姓名、学时、介绍信息、是否删除) (6) 年级信息(说明、编号、年级、名称、简介、是否删除) (7) 学生信息(说明、编号、学生、姓名、性别、年龄、电话、所属班级、所属年级、登录名、密码)
资源推荐
资源详情
资源评论
收起资源包目录
SSH框架javaweb学生成绩管理系统源码 (561个子文件)
chengjiAction.class 13KB
laoshiAction.class 9KB
xueshengAction.class 9KB
TLaoshiDAO.class 7KB
TXueshengDAO.class 7KB
TChengjiDAO.class 7KB
TBanjiDAO.class 6KB
TZhuanyeDAO.class 6KB
TGonggaoDAO.class 6KB
TLaoshi.class 6KB
gonggaoAction.class 6KB
TXuesheng.class 5KB
TGuanliyuanDAO.class 5KB
TLiuyanDAO.class 5KB
banjiAction.class 5KB
TKechengDAO.class 5KB
loginService.class 5KB
liuyanAction.class 4KB
zhuanyeAction.class 4KB
kechengAction.class 4KB
TChengji.class 4KB
TKecheng.class 4KB
TBanji.class 4KB
TGonggao.class 4KB
TZhuanye.class 4KB
Pagination.class 3KB
Util.class 3KB
tongyongService.class 2KB
TLiuyan.class 2KB
kechengService.class 1KB
TGuanliyuan.class 1KB
.classpath 4KB
org.eclipse.wst.common.component 549B
org.eclipse.wst.jsdt.ui.superType.container 49B
bootstrap.min.css 150KB
style.min.css 129KB
ueditor.css 45KB
ueditor.min.css 34KB
font-awesome.min.css 26KB
video-js.css 22KB
image.css 19KB
video.css 15KB
attachment.css 15KB
video-js.min.css 11KB
layer.css 11KB
layim.css 10KB
shCoreDefault.css 7KB
datepicker.css 5KB
datepicker.css 5KB
bootstrap-table.min.css 4KB
datepicker.css 4KB
scrawl.css 4KB
datepicker.css 4KB
style.css 3KB
codemirror.css 3KB
layer.ext.css 3KB
charts.css 3KB
background.css 2KB
login.min.css 2KB
emotion.css 2KB
dialogbase.css 2KB
music.css 2KB
edittable.css 1KB
template.css 1KB
webuploader.css 543B
help.css 395B
WdatePicker.css 158B
WdatePicker.css 158B
iframe.css 42B
glyphicons-halflings-regular.eot 20KB
vjs.eot 3KB
fontawesome-webfont.eot_ 67KB
glyphicons-halflings-regular.eot_ 20KB
wface.gif 49KB
jxface2.gif 40KB
yface.gif 28KB
bface.gif 27KB
icons.gif 20KB
file-icons.gif 20KB
file-icons.gif 20KB
tface.gif 19KB
fface.gif 18KB
cface.gif 8KB
loading-0.gif 6KB
icons-all.gif 4KB
loading-2.gif 2KB
loading-upload.gif 2KB
img.gif 2KB
img.gif 2KB
videologo.gif 2KB
img.gif 2KB
img.gif 2KB
cancelbutton.gif 1KB
button-bg.gif 1KB
lock.gif 1KB
alignicon.gif 1KB
datePicker.gif 1KB
datePicker.gif 1KB
word.gif 1019B
icon_doc.gif 1012B
共 561 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
QQ1978519681计算机程序
- 粉丝: 1551
- 资源: 303
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功