diff --git a/WebRoot/WEB-INF/jsp/sunvote/student/student_edit.jsp b/WebRoot/WEB-INF/jsp/sunvote/student/student_edit.jsp new file mode 100644 index 0000000..7f97285 --- /dev/null +++ b/WebRoot/WEB-INF/jsp/sunvote/student/student_edit.jsp @@ -0,0 +1,226 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<% + String path = request.getContextPath(); + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; +%> + + + + + + + + <%@ include file="../../system/index/top.jsp"%> + + + + + +
+ +
+
+
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
学生姓名:
学籍号:
学号:
性别: + <%--
组号:
签到码:
家长姓名:
家长手机号:
键盘ID:
备注:
+ 保存 + 取消 +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ + + + + <%@ include file="../../system/index/foot.jsp"%> + + + + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/jsp/sunvote/student/student_list.jsp b/WebRoot/WEB-INF/jsp/sunvote/student/student_list.jsp new file mode 100644 index 0000000..dea248e --- /dev/null +++ b/WebRoot/WEB-INF/jsp/sunvote/student/student_list.jsp @@ -0,0 +1,382 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> +<% + String path = request.getContextPath(); + String basePath = request.getScheme() + "://" + + request.getServerName() + ":" + request.getServerPort() + + path + "/"; +%> + + + + + + + +<%@ include file="../../system/index/top.jsp"%> + + + + + + +
+ +
+
+
+
+
+ + +
+ + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 序号学生姓名学籍号学号性别组号签到码家长姓名家长手机号键盘ID备注操作
+ + ${vs.index+1}${var.NAME}${var.SNO}${var.NUMBER}${var.SEX == 1 ? "男":"女"}${var.GROUPID}${var.SIGN_NO}${var.PARENT_NAME}${var.PARENT_PHONE}${var.KEYPAD_ID}${var.REMARK} + + + + + +
您无权查看
没有相关数据
+ +
+ +
+ +
+ +
+ +
+
+ + + + + + + +
+ + + + + <%@ include file="../../system/index/foot.jsp"%> + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/tld/elfun.tld b/WebRoot/WEB-INF/tld/elfun.tld new file mode 100644 index 0000000..e9680a4 --- /dev/null +++ b/WebRoot/WEB-INF/tld/elfun.tld @@ -0,0 +1,84 @@ + + + + 1.0 + myelfun + + + + 根据ID 获取学校名称 + findSchoolName + com.fh.controller.sunvote.Myelfun + java.lang.String findSchoolName(int) + ${myelfun:findSchoolName(obj1)} + + + + + 根据ID获取年级名称 + findGradeName + com.fh.controller.sunvote.Myelfun + java.lang.String findGradeName(int) + ${myelfun:findGradeName(obj1)} + + + + 根据ID获取班级类型名称 + findClassTypeName + com.fh.controller.sunvote.Myelfun + java.lang.String findClassTypeName(int) + ${myelfun:findClassTypeName(obj1)} + + + + 获取科目英文名称 + findSubjectEName + com.fh.controller.sunvote.Myelfun + java.lang.String findSubjectEName(int) + ${myelfun:findSubjectEName(obj1)} + + + + 根据ID获取科目中文名称 + findSubjectCName + com.fh.controller.sunvote.Myelfun + java.lang.String findSubjectCName(int) + ${myelfun:findSubjectCName(obj1)} + + + + 根据ID查找基站名称 + findBasestationName + com.fh.controller.sunvote.Myelfun + java.lang.String findBasestationName(int) + ${myelfun:findBasestationName(obj1)} + + + + 根据ID查找老师姓名 + findTeacherName + com.fh.controller.sunvote.Myelfun + java.lang.String findTeacherName(int) + ${myelfun:findTeacherName(obj1)} + + + + 根据ID查找班级姓名 + findClassName + com.fh.controller.sunvote.Myelfun + java.lang.String findClassName(int) + ${myelfun:findClassName(obj1)} + + + + 根据ID查找教材名称 + findTeachingmaterialName + com.fh.controller.sunvote.Myelfun + java.lang.String findTeachingmaterialName(int) + ${myelfun:findTeachingmaterialName(obj1)} + + + + diff --git a/resources/mybatis1/sunvote/StudentMapper.xml b/resources/mybatis1/sunvote/StudentMapper.xml new file mode 100644 index 0000000..da4f162 --- /dev/null +++ b/resources/mybatis1/sunvote/StudentMapper.xml @@ -0,0 +1,146 @@ + + + + + + + SV_STUDENT + + + + + NAME, + SNO, + NUMBER, + SEX, + GROUPID, + SIGN_NO, + PARENT_NAME, + PARENT_PHONE, + KEYPAD_ID, + REMARK, + ID + + + + + #{NAME}, + #{SNO}, + #{NUMBER}, + #{SEX}, + #{GROUPID}, + #{SIGN_NO}, + #{PARENT_NAME}, + #{PARENT_PHONE}, + #{KEYPAD_ID}, + #{REMARK}, + #{ID} + + + + + insert into + + ( + NAME, + SNO, + NUMBER, + SEX, + GROUPID, + SIGN_NO, + PARENT_NAME, + PARENT_PHONE, + KEYPAD_ID, + REMARK + ) values ( + #{NAME}, + #{SNO}, + #{NUMBER}, + #{SEX}, + #{GROUPID}, + #{SIGN_NO}, + #{PARENT_NAME}, + #{PARENT_PHONE}, + #{KEYPAD_ID}, + #{REMARK} + ) + + + + + delete from + + where + ID = #{ID} + + + + + update + + set + NAME = #{NAME}, + SNO = #{SNO}, + NUMBER = #{NUMBER}, + SEX = #{SEX}, + GROUPID = #{GROUPID}, + SIGN_NO = #{SIGN_NO}, + PARENT_NAME = #{PARENT_NAME}, + PARENT_PHONE = #{PARENT_PHONE}, + KEYPAD_ID = #{KEYPAD_ID}, + REMARK = #{REMARK}, + ID = #{ID} + where + ID = #{ID} + + + + + + + + + + + + + + delete from + + where + ID in + + #{item} + + + + + \ No newline at end of file diff --git a/src/com/fh/controller/sunvote/Myelfun.java b/src/com/fh/controller/sunvote/Myelfun.java new file mode 100644 index 0000000..1bf583d --- /dev/null +++ b/src/com/fh/controller/sunvote/Myelfun.java @@ -0,0 +1,181 @@ +package com.fh.controller.sunvote; + +import org.springframework.stereotype.Service; + +import com.fh.service.sunvote.basestation.impl.BasestationService; +import com.fh.service.sunvote.classtype.impl.ClassTypeService; +import com.fh.service.sunvote.grade.impl.GradeService; +import com.fh.service.sunvote.school.impl.SchoolService; +import com.fh.service.sunvote.sclass.impl.SClassService; +import com.fh.service.sunvote.subject.impl.SubjectService; +import com.fh.service.sunvote.teacher.impl.TeacherService; +import com.fh.service.sunvote.teachingmaterial.impl.TeachingMaterialService; +import com.fh.util.PageData; +import com.fh.util.SpringBeanFactoryUtils; + +@Service +public class Myelfun { + + /** + * 根据ID 获取学校名称 + * @param type + * @return + * @throws Exception + */ + public static String findSchoolName(int type) throws Exception{ + SchoolService schoolService = (SchoolService)SpringBeanFactoryUtils.getBean("schoolService"); + PageData pageData = new PageData(); + pageData.put("ID", type); + pageData = schoolService.findById(pageData); + if(pageData != null){ + return pageData.getString("NAME"); + }else{ + return "" ; + } + } + + /** + * 根据ID获取年级名称 + * @param type + * @return + * @throws Exception + */ + public static String findGradeName(int type) throws Exception{ + GradeService gradeService = (GradeService)SpringBeanFactoryUtils.getBean("gradeService"); + PageData pageData = new PageData(); + pageData.put("ID", type); + pageData = gradeService.findById(pageData); + if(pageData != null){ + return pageData.getString("NAME"); + }else{ + return "" ; + } + } + + /** + * 根据ID或者班级类型名称 + * @param type + * @return + * @throws Exception + */ + public static String findClassTypeName(int type) throws Exception{ + ClassTypeService classTypeService = (ClassTypeService)SpringBeanFactoryUtils.getBean("classtypeService"); + PageData pageData = new PageData(); + pageData.put("ID", type); + pageData = classTypeService.findById(pageData); + if(pageData != null){ + return pageData.getString("NAME"); + }else{ + return "" ; + } + } + + /** + * 根据ID,获取科目中文名称 + * @param type + * @return + * @throws Exception + */ + public static String findSubjectEName(int type) throws Exception{ + SubjectService subjectService = (SubjectService)SpringBeanFactoryUtils.getBean("subjectService"); + PageData pageData = new PageData(); + pageData.put("ID", type); + pageData = subjectService.findById(pageData); + if(pageData != null){ + return pageData.getString("ENAME"); + }else{ + return "" ; + } + } + + /** + * 根据ID或者科目英文名称 + * @param type + * @return + * @throws Exception + */ + public static String findSubjectCName(int type) throws Exception{ + SubjectService subjectService = (SubjectService)SpringBeanFactoryUtils.getBean("subjectService"); + PageData pageData = new PageData(); + pageData.put("ID", type); + pageData = subjectService.findById(pageData); + if(pageData != null){ + return pageData.getString("CNAME"); + }else{ + return "" ; + } + } + + /** + * 根据ID查找基站名称 + * @param type + * @return + * @throws Exception + */ + public static String findBasestationName(int type) throws Exception{ + BasestationService basestationService = (BasestationService)SpringBeanFactoryUtils.getBean("basestationService"); + PageData pageData = new PageData(); + pageData.put("ID", type); + pageData = basestationService.findById(pageData); + if(pageData != null){ + return pageData.getString("NAME"); + }else{ + return "" ; + } + } + + /** + * 根据ID 老师姓名 + * @param id + * @return + * @throws Exception + */ + public static String findTeacherName(int id) throws Exception { + TeacherService teacherService = (TeacherService)SpringBeanFactoryUtils.getBean("teacherService"); + PageData pageData = new PageData(); + pageData.put("ID", id); + pageData = teacherService.findById(pageData); + if(pageData != null){ + return pageData.getString("NAME"); + }else{ + return "" ; + } + } + + /** + * 根据ID班级名称 + * @param id + * @return + * @throws Exception + */ + public static String findClassName(int id) throws Exception { + SClassService sclassService = (SClassService)SpringBeanFactoryUtils.getBean("sclassService"); + PageData pageData = new PageData(); + pageData.put("ID", id); + pageData = sclassService.findById(pageData); + if(pageData != null){ + return pageData.getString("CLASS_NAME"); + }else{ + return "" ; + } + } + + /** + * 根据ID班级名称 + * @param id + * @return + * @throws Exception + */ + public static String findTeachingmaterialName(int id) throws Exception { + TeachingMaterialService teachingmaterialService = (TeachingMaterialService)SpringBeanFactoryUtils.getBean("teachingmaterialService"); + PageData pageData = new PageData(); + pageData.put("ID", id); + pageData = teachingmaterialService.findById(pageData); + if(pageData != null){ + return pageData.getString("NAME"); + }else{ + return "" ; + } + } + +} diff --git a/src/com/fh/controller/sunvote/student/StudentController.java b/src/com/fh/controller/sunvote/student/StudentController.java new file mode 100644 index 0000000..c125a97 --- /dev/null +++ b/src/com/fh/controller/sunvote/student/StudentController.java @@ -0,0 +1,222 @@ +package com.fh.controller.sunvote.student; + +import java.io.PrintWriter; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Resource; +import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; +import com.fh.controller.base.BaseController; +import com.fh.entity.Page; +import com.fh.util.AppUtil; +import com.fh.util.ObjectExcelView; +import com.fh.util.PageData; +import com.fh.util.Jurisdiction; +import com.fh.util.Tools; +import com.fh.service.sunvote.student.StudentManager; + +/** + * 说明:学生管理 + * 创建人:Elvis + * 创建时间:2018-04-28 + */ +@Controller +@RequestMapping(value="/student") +public class StudentController extends BaseController { + + String menuUrl = "student/list.do"; //菜单地址(权限用) + @Resource(name="studentService") + private StudentManager studentService; + + /**保存 + * @param + * @throws Exception + */ + @RequestMapping(value="/save") + public ModelAndView save() throws Exception{ + logBefore(logger, Jurisdiction.getUsername()+"新增Student"); + if(!Jurisdiction.buttonJurisdiction(menuUrl, "add")){return null;} //校验权限 + ModelAndView mv = this.getModelAndView(); + PageData pd = new PageData(); + pd = this.getPageData(); + studentService.save(pd); + mv.addObject("msg","success"); + mv.setViewName("save_result"); + return mv; + } + + /**删除 + * @param out + * @throws Exception + */ + @RequestMapping(value="/delete") + public void delete(PrintWriter out) throws Exception{ + logBefore(logger, Jurisdiction.getUsername()+"删除Student"); + if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return;} //校验权限 + PageData pd = new PageData(); + pd = this.getPageData(); + studentService.delete(pd); + out.write("success"); + out.close(); + } + + /**修改 + * @param + * @throws Exception + */ + @RequestMapping(value="/edit") + public ModelAndView edit() throws Exception{ + logBefore(logger, Jurisdiction.getUsername()+"修改Student"); + if(!Jurisdiction.buttonJurisdiction(menuUrl, "edit")){return null;} //校验权限 + ModelAndView mv = this.getModelAndView(); + PageData pd = new PageData(); + pd = this.getPageData(); + studentService.edit(pd); + mv.addObject("msg","success"); + mv.setViewName("save_result"); + return mv; + } + + /**列表 + * @param page + * @throws Exception + */ + @RequestMapping(value="/list") + public ModelAndView list(Page page) throws Exception{ + logBefore(logger, Jurisdiction.getUsername()+"列表Student"); + //if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} //校验权限(无权查看时页面会有提示,如果不注释掉这句代码就无法进入列表页面,所以根据情况是否加入本句代码) + ModelAndView mv = this.getModelAndView(); + PageData pd = new PageData(); + pd = this.getPageData(); + String keywords = pd.getString("keywords"); //关键词检索条件 + if(null != keywords && !"".equals(keywords)){ + pd.put("keywords", keywords.trim()); + } + page.setPd(pd); + List varList = studentService.list(page); //列出Student列表 + mv.setViewName("sunvote/student/student_list"); + mv.addObject("varList", varList); + mv.addObject("pd", pd); + mv.addObject("QX",Jurisdiction.getHC()); //按钮权限 + return mv; + } + + /**去新增页面 + * @param + * @throws Exception + */ + @RequestMapping(value="/goAdd") + public ModelAndView goAdd()throws Exception{ + ModelAndView mv = this.getModelAndView(); + PageData pd = new PageData(); + pd = this.getPageData(); + mv.setViewName("sunvote/student/student_edit"); + mv.addObject("msg", "save"); + mv.addObject("pd", pd); + return mv; + } + + /**去修改页面 + * @param + * @throws Exception + */ + @RequestMapping(value="/goEdit") + public ModelAndView goEdit()throws Exception{ + ModelAndView mv = this.getModelAndView(); + PageData pd = new PageData(); + pd = this.getPageData(); + pd = studentService.findById(pd); //根据ID读取 + mv.setViewName("sunvote/student/student_edit"); + mv.addObject("msg", "edit"); + mv.addObject("pd", pd); + return mv; + } + + /**批量删除 + * @param + * @throws Exception + */ + @RequestMapping(value="/deleteAll") + @ResponseBody + public Object deleteAll() throws Exception{ + logBefore(logger, Jurisdiction.getUsername()+"批量删除Student"); + if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return null;} //校验权限 + PageData pd = new PageData(); + Map map = new HashMap(); + pd = this.getPageData(); + List pdList = new ArrayList(); + String DATA_IDS = pd.getString("DATA_IDS"); + if(null != DATA_IDS && !"".equals(DATA_IDS)){ + String ArrayDATA_IDS[] = DATA_IDS.split(","); + studentService.deleteAll(ArrayDATA_IDS); + pd.put("msg", "ok"); + }else{ + pd.put("msg", "no"); + } + pdList.add(pd); + map.put("list", pdList); + return AppUtil.returnObject(pd, map); + } + + /**导出到excel + * @param + * @throws Exception + */ + @RequestMapping(value="/excel") + public ModelAndView exportExcel() throws Exception{ + logBefore(logger, Jurisdiction.getUsername()+"导出Student到excel"); + if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} + ModelAndView mv = new ModelAndView(); + PageData pd = new PageData(); + pd = this.getPageData(); + Map dataMap = new HashMap(); + List titles = new ArrayList(); + titles.add("学生姓名"); //1 + titles.add("学籍号"); //2 + titles.add("学号"); //3 + titles.add("性别"); //4 + titles.add("组号"); //5 + titles.add("签到码"); //6 + titles.add("家长姓名"); //7 + titles.add("家长手机号"); //8 + titles.add("键盘ID"); //9 + titles.add("备注"); //10 + dataMap.put("titles", titles); + List varOList = studentService.listAll(pd); + List varList = new ArrayList(); + for(int i=0;i list(Page page)throws Exception; + + /**列表(全部) + * @param pd + * @throws Exception + */ + public List listAll(PageData pd)throws Exception; + + /**通过id获取数据 + * @param pd + * @throws Exception + */ + public PageData findById(PageData pd)throws Exception; + + /**批量删除 + * @param ArrayDATA_IDS + * @throws Exception + */ + public void deleteAll(String[] ArrayDATA_IDS)throws Exception; + +} + diff --git a/src/com/fh/service/sunvote/student/impl/StudentService.java b/src/com/fh/service/sunvote/student/impl/StudentService.java new file mode 100644 index 0000000..32e5f6f --- /dev/null +++ b/src/com/fh/service/sunvote/student/impl/StudentService.java @@ -0,0 +1,82 @@ +package com.fh.service.sunvote.student.impl; + +import java.util.List; +import javax.annotation.Resource; +import org.springframework.stereotype.Service; +import com.fh.dao.DaoSupport; +import com.fh.entity.Page; +import com.fh.util.PageData; +import com.fh.service.sunvote.student.StudentManager; + +/** + * 说明: 学生管理 + * 创建人:FH Q313596790 + * 创建时间:2018-04-28 + * @version + */ +@Service("studentService") +public class StudentService implements StudentManager{ + + @Resource(name = "daoSupport") + private DaoSupport dao; + + /**新增 + * @param pd + * @throws Exception + */ + public void save(PageData pd)throws Exception{ + dao.save("StudentMapper.save", pd); + } + + /**删除 + * @param pd + * @throws Exception + */ + public void delete(PageData pd)throws Exception{ + dao.delete("StudentMapper.delete", pd); + } + + /**修改 + * @param pd + * @throws Exception + */ + public void edit(PageData pd)throws Exception{ + dao.update("StudentMapper.edit", pd); + } + + /**列表 + * @param page + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List list(Page page)throws Exception{ + return (List)dao.findForList("StudentMapper.datalistPage", page); + } + + /**列表(全部) + * @param pd + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List listAll(PageData pd)throws Exception{ + return (List)dao.findForList("StudentMapper.listAll", pd); + } + + /**通过id获取数据 + * @param pd + * @throws Exception + */ + public PageData findById(PageData pd)throws Exception{ + return (PageData)dao.findForObject("StudentMapper.findById", pd); + } + + /**批量删除 + * @param ArrayDATA_IDS + * @throws Exception + */ + public void deleteAll(String[] ArrayDATA_IDS)throws Exception{ + dao.delete("StudentMapper.deleteAll", ArrayDATA_IDS); + } + +} + diff --git a/src/com/fh/util/SpringBeanFactoryUtils.java b/src/com/fh/util/SpringBeanFactoryUtils.java new file mode 100644 index 0000000..957b2d3 --- /dev/null +++ b/src/com/fh/util/SpringBeanFactoryUtils.java @@ -0,0 +1,49 @@ +package com.fh.util; + + + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +/** + * ------------------------------------------- + * Title : SpringBeanFactoryUtils + * Description : 普通类调用Spring注解方式的Service层bean + * Create on : 2016年11月1日 下午3:12:25 + * Copyright (C) strongunion + * @author RICK + * 修改历史: + * 修改人 修改日期 修改描述 + * ------------------------------------------- + */ +public class SpringBeanFactoryUtils implements ApplicationContextAware { + + private static ApplicationContext appCtx; + + /** + * TODO: 此方法可以把ApplicationContext对象inject到当前类中作为一个静态成员变量。 + * @Auhor: RICK + * @Date : 2016年11月1日 + */ + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + appCtx = applicationContext; + } + + /** + * TODO: 获取ApplicationContext + * @Auhor: RICK + * @Date : 2016年11月1日 + */ + public static ApplicationContext getApplicationContext() { + return appCtx; + } + + /** + * TODO: 这是一个便利的方法,帮助我们快速得到一个BEAN + * @Auhor: RICK + * @Date : 2016年11月1日 + */ + public static Object getBean(String beanName) { + return appCtx.getBean(beanName); + } +} \ No newline at end of file