From 1d841c31df728bd60245cc4d2c8e3b0859317917 Mon Sep 17 00:00:00 2001 From: Elvis Date: Fri, 20 Apr 2018 15:50:33 +0800 Subject: [PATCH] 添加对试卷类型管理 --- WebRoot/WEB-INF/jsp/sunvote/papertype/papertype_edit.jsp | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WebRoot/WEB-INF/jsp/sunvote/papertype/papertype_list.jsp | 366 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ resources/mybatis1/sunvote/PaperTypeMapper.xml | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/com/fh/controller/sunvote/papertype/PaperTypeController.java | 206 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/com/fh/service/sunvote/papertype/PaperTypeManager.java | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/com/fh/service/sunvote/papertype/impl/PaperTypeService.java | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 924 insertions(+), 0 deletions(-) create mode 100644 WebRoot/WEB-INF/jsp/sunvote/papertype/papertype_edit.jsp create mode 100644 WebRoot/WEB-INF/jsp/sunvote/papertype/papertype_list.jsp create mode 100644 resources/mybatis1/sunvote/PaperTypeMapper.xml create mode 100644 src/com/fh/controller/sunvote/papertype/PaperTypeController.java create mode 100644 src/com/fh/service/sunvote/papertype/PaperTypeManager.java create mode 100644 src/com/fh/service/sunvote/papertype/impl/PaperTypeService.java diff --git a/WebRoot/WEB-INF/jsp/sunvote/papertype/papertype_edit.jsp b/WebRoot/WEB-INF/jsp/sunvote/papertype/papertype_edit.jsp new file mode 100644 index 0000000..53bb464 --- /dev/null +++ b/WebRoot/WEB-INF/jsp/sunvote/papertype/papertype_edit.jsp @@ -0,0 +1,108 @@ +<%@ 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"%> + + + + + +
+ +
+
+
+
+
+ +
+ +
+ + + + + + + + + + + + +
名称:
备注:
+ 保存 + 取消 +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ + + + + <%@ include file="../../system/index/foot.jsp"%> + + + + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/jsp/sunvote/papertype/papertype_list.jsp b/WebRoot/WEB-INF/jsp/sunvote/papertype/papertype_list.jsp new file mode 100644 index 0000000..64d7fbe --- /dev/null +++ b/WebRoot/WEB-INF/jsp/sunvote/papertype/papertype_list.jsp @@ -0,0 +1,366 @@ +<%@ 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"%> + + + + + + +
+ +
+
+
+
+
+ + +
+ + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 序号名称备注操作
+ + ${vs.index+1}${var.NAME}${var.REMARK} + + + + + +
您无权查看
没有相关数据
+ +
+ +
+ +
+ +
+ +
+
+ + + + + + + +
+ + + + + <%@ include file="../../system/index/foot.jsp"%> + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/mybatis1/sunvote/PaperTypeMapper.xml b/resources/mybatis1/sunvote/PaperTypeMapper.xml new file mode 100644 index 0000000..4f59ffe --- /dev/null +++ b/resources/mybatis1/sunvote/PaperTypeMapper.xml @@ -0,0 +1,104 @@ + + + + + + + SV_PAPERTYPE + + + + + NAME, + REMARK, + $ID + + + + + #{NAME}, + #{REMARK}, + #{$ID} + + + + + insert into + + ( + + ) values ( + + ) + + + + + delete from + + where + $ID = #{$ID} + + + + + update + + set + NAME = #{NAME}, + 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/papertype/PaperTypeController.java b/src/com/fh/controller/sunvote/papertype/PaperTypeController.java new file mode 100644 index 0000000..ff8b11b --- /dev/null +++ b/src/com/fh/controller/sunvote/papertype/PaperTypeController.java @@ -0,0 +1,206 @@ +package com.fh.controller.sunvote.papertype; + +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.papertype.PaperTypeManager; + +/** + * 说明:试卷类型管理 + * 创建人:Elvis + * 创建时间:2018-04-20 + */ +@Controller +@RequestMapping(value="/papertype") +public class PaperTypeController extends BaseController { + + String menuUrl = "papertype/list.do"; //菜单地址(权限用) + @Resource(name="papertypeService") + private PaperTypeManager papertypeService; + + /**保存 + * @param + * @throws Exception + */ + @RequestMapping(value="/save") + public ModelAndView save() throws Exception{ + logBefore(logger, Jurisdiction.getUsername()+"新增PaperType"); + if(!Jurisdiction.buttonJurisdiction(menuUrl, "add")){return null;} //校验权限 + ModelAndView mv = this.getModelAndView(); + PageData pd = new PageData(); + pd = this.getPageData(); + papertypeService.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()+"删除PaperType"); + if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return;} //校验权限 + PageData pd = new PageData(); + pd = this.getPageData(); + papertypeService.delete(pd); + out.write("success"); + out.close(); + } + + /**修改 + * @param + * @throws Exception + */ + @RequestMapping(value="/edit") + public ModelAndView edit() throws Exception{ + logBefore(logger, Jurisdiction.getUsername()+"修改PaperType"); + if(!Jurisdiction.buttonJurisdiction(menuUrl, "edit")){return null;} //校验权限 + ModelAndView mv = this.getModelAndView(); + PageData pd = new PageData(); + pd = this.getPageData(); + papertypeService.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()+"列表PaperType"); + //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 = papertypeService.list(page); //列出PaperType列表 + mv.setViewName("sunvote/papertype/papertype_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/papertype/papertype_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 = papertypeService.findById(pd); //根据ID读取 + mv.setViewName("sunvote/papertype/papertype_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()+"批量删除PaperType"); + 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(","); + papertypeService.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()+"导出PaperType到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 + dataMap.put("titles", titles); + List varOList = papertypeService.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/papertype/impl/PaperTypeService.java b/src/com/fh/service/sunvote/papertype/impl/PaperTypeService.java new file mode 100644 index 0000000..ab0402d --- /dev/null +++ b/src/com/fh/service/sunvote/papertype/impl/PaperTypeService.java @@ -0,0 +1,82 @@ +package com.fh.service.sunvote.papertype.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.papertype.PaperTypeManager; + +/** + * 说明: 试卷类型管理 + * 创建人:FH Q313596790 + * 创建时间:2018-04-20 + * @version + */ +@Service("papertypeService") +public class PaperTypeService implements PaperTypeManager{ + + @Resource(name = "daoSupport") + private DaoSupport dao; + + /**新增 + * @param pd + * @throws Exception + */ + public void save(PageData pd)throws Exception{ + dao.save("PaperTypeMapper.save", pd); + } + + /**删除 + * @param pd + * @throws Exception + */ + public void delete(PageData pd)throws Exception{ + dao.delete("PaperTypeMapper.delete", pd); + } + + /**修改 + * @param pd + * @throws Exception + */ + public void edit(PageData pd)throws Exception{ + dao.update("PaperTypeMapper.edit", pd); + } + + /**列表 + * @param page + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List list(Page page)throws Exception{ + return (List)dao.findForList("PaperTypeMapper.datalistPage", page); + } + + /**列表(全部) + * @param pd + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List listAll(PageData pd)throws Exception{ + return (List)dao.findForList("PaperTypeMapper.listAll", pd); + } + + /**通过id获取数据 + * @param pd + * @throws Exception + */ + public PageData findById(PageData pd)throws Exception{ + return (PageData)dao.findForObject("PaperTypeMapper.findById", pd); + } + + /**批量删除 + * @param ArrayDATA_IDS + * @throws Exception + */ + public void deleteAll(String[] ArrayDATA_IDS)throws Exception{ + dao.delete("PaperTypeMapper.deleteAll", ArrayDATA_IDS); + } + +} + -- libgit2 0.21.4