Commit d7525cae337f717e8094d6a9fa9d4bbfbf19924d

Authored by jack
1 parent a975f494

1.学生老师导入导出

2.客户端登录接口添加年级id
3.客户端试卷接口增加试卷类型筛选(年级卷,个人卷)
WebRoot/WEB-INF/jsp/sunvote/student/student_list2.jsp
@@ -102,6 +102,9 @@ @@ -102,6 +102,9 @@
102 <div class="creat"> 102 <div class="creat">
103 <input type="button" onclick="upload();" value="批量导入" /> 103 <input type="button" onclick="upload();" value="批量导入" />
104 </div> 104 </div>
  105 + <div class="creat">
  106 + <input type="button" onclick="export2();" value="批量导出" />
  107 + </div>
105 <div class="removeAll" > 108 <div class="removeAll" >
106 <input type="button" onclick="deleteAll();" value="批量删除" /> 109 <input type="button" onclick="deleteAll();" value="批量删除" />
107 </div> 110 </div>
@@ -214,6 +217,9 @@ @@ -214,6 +217,9 @@
214 }); 217 });
215 window.top.modal.show(); 218 window.top.modal.show();
216 } 219 }
  220 + function export2(){
  221 + window.open('<%=basePath%>student/excel?class_id=${pd.CLASS_ID}','_blank');
  222 + }
217 223
218 </script> 224 </script>
219 </html> 225 </html>
220 \ No newline at end of file 226 \ No newline at end of file
WebRoot/WEB-INF/jsp/sunvote/teacher/en_uploadexcel.jsp 0 → 100644
  1 +<%@ page language="java" contentType="text/html; charset=UTF-8"
  2 + pageEncoding="UTF-8"%>
  3 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  4 +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  5 +<%
  6 + String path = request.getContextPath();
  7 + String basePath = request.getScheme() + "://"
  8 + + request.getServerName() + ":" + request.getServerPort()
  9 + + path + "/";
  10 +%>
  11 +<!DOCTYPE html>
  12 +<html lang="en">
  13 +<head>
  14 +<base href="<%=basePath%>">
  15 +
  16 +<!-- jsp文件头和头部 -->
  17 +<%@ include file="../../system/index/top.jsp"%>
  18 +
  19 +
  20 +<style>
  21 +
  22 +.ace-file-input .ace-file-container{
  23 +display: block;
  24 + position: absolute;
  25 + top: 0;
  26 + left: 0;
  27 + right: 0;
  28 + height: 40px;
  29 + background-color: #ffffff;
  30 + border: 1px solid #d5d5d5;
  31 + cursor: pointer;
  32 + -webkit-box-shadow: none;
  33 + box-shadow: none;
  34 + -webkit-transition: all 0.15s;
  35 + -o-transition: all 0.15s;
  36 + transition: all 0.15s;
  37 +}
  38 +.ace-file-input .ace-file-container:before{
  39 + display: inline-block;
  40 + content: attr(data-title);
  41 + position: absolute;
  42 + right: 0;
  43 + top: 0;
  44 + bottom: 0;
  45 + line-height: 34px;
  46 + text-align: center;
  47 + padding: 0 8px;
  48 + background-color: #3bc2d6;
  49 + color: #FFF;
  50 + font-size: 11px;
  51 + font-weight: bold;
  52 + border: 2px solid #FFF;
  53 + border-left-width: 4px;
  54 + -webkit-transition: all 0.3s;
  55 + -o-transition: all 0.3s;
  56 + transition: all 0.3s;
  57 +}
  58 +.ace-file-input .ace-file-container .ace-file-name {
  59 + display: inline-block;
  60 + height: 38px;
  61 + max-width: 80%;
  62 + white-space: nowrap;
  63 + overflow: hidden;
  64 + line-height: 38px;
  65 + color: #888888;
  66 + font-size: 13px;
  67 + vertical-align: top;
  68 + position: static;
  69 + padding-left: 36px;
  70 + }
  71 +
  72 + .ace-file-input .ace-file-container .ace-icon {
  73 + display: inline-block;
  74 + position: absolute;
  75 + left: 0;
  76 + top: 0;
  77 + bottom: 0;
  78 + line-height: 34px;
  79 + width: 36px;
  80 + text-align: center;
  81 + font-family: FontAwesome;
  82 + font-size: 13px;
  83 + border: 2px solid #FFF;
  84 + color: #FFF;
  85 + -webkit-transition: all 0.1s;
  86 + -o-transition: all 0.1s;
  87 + transition: all 0.1s;
  88 + background-color: #3bc2d6;
  89 + }
  90 +
  91 + .ace-file-input .ace-file-container .ace-file-name:after {
  92 + display: inline-block;
  93 + content: attr(data-title);
  94 +}
  95 +
  96 +
  97 +</style>
  98 +
  99 +</head>
  100 +<body class="no-skin">
  101 +
  102 + <!-- /section:basics/navbar.layout -->
  103 + <div class="main-container" id="main-container">
  104 + <!-- /section:basics/sidebar -->
  105 + <div class="main-content">
  106 + <div class="main-content-inner">
  107 + <div class="page-content">
  108 + <div class="row">
  109 + <div class="col-xs-12">
  110 + <form action="student/readExcel.do?CLASS_ID=${pd.CLASS_ID}&TERM_ID=${pd.TERM_ID}" name="Form" id="Form" method="post" enctype="multipart/form-data">
  111 + <div id="zhongxin">
  112 + <input type="hidden" name="CLASS_ID" id="CLASS_ID" value="${pd.CLASS_ID}"/>
  113 + <input type="hidden" name="TERM_ID" id="TERM_ID" value="${pd.TERM_ID}"/>
  114 + <table style="width:95%;" >
  115 + <tr>
  116 + <td style="padding-top: 20px;"><input type="file" id="excel" name="excel" style="width:50px;" onchange="fileType(this)" /></td>
  117 + </tr>
  118 + <tr>
  119 + <td style="text-align: center;padding-top: 10px;">
  120 + <a class="btn btn-mini btn-primary" style="background-color:#3bc2d6 !important;border-color:#3bc2d6 !important;width:200px; height:50px;line-height:50px;font-size:18px;margin-top:5%;padding:0" onclick="save();">Import</a>
  121 + <a class="btn btn-mini btn-primary" style="background-color:#87b87f !important;border-color:#87b87f !important;width:200px; height:50px;line-height:50px;font-size:18px;margin-top:5%;padding:0" href="static/files/Template.xls" target="_blank" >Download template</a>
  122 + </td>
  123 + </tr>
  124 + </table>
  125 + </div>
  126 + <div id="zhongxin2" class="center" style="display:none"><br/><img src="static/images/jzx.gif" /><br/><h4 class="lighter block green"></h4></div>
  127 + </form>
  128 + </div>
  129 + <!-- /.col -->
  130 + </div>
  131 + <!-- /.row -->
  132 + </div>
  133 + <!-- /.page-content -->
  134 + </div>
  135 + </div>
  136 + <!-- /.main-content -->
  137 + </div>
  138 + <!-- /.main-container -->
  139 +
  140 + <!-- basic scripts -->
  141 + <!-- 页面底部js¨ -->
  142 + <%@ include file="../../system/index/foot.jsp"%>
  143 + <!-- ace scripts -->
  144 + <script src="static/ace/js/ace/ace.js"></script>
  145 + <!-- 上传控件 -->
  146 + <script src="static/ace/js/ace/elements.fileinput.js"></script>
  147 + <!--提示框-->
  148 + <script type="text/javascript" src="static/js/jquery.tips.js"></script>
  149 + <script type="text/javascript">
  150 + $(function() {
  151 + //上传
  152 + $('#excel').ace_file_input({
  153 + no_file:'Please select a file in xls format',
  154 + btn_choose:'Select',
  155 + btn_change:'Modify',
  156 + droppable:false,
  157 + onchange:null,
  158 + thumbnail:false, //| true | large
  159 + whitelist:'xls|xls',
  160 + blacklist:'gif|png|jpg|jpeg'
  161 + //onchange:''
  162 + });
  163 + });
  164 +
  165 + //保存
  166 + function save(){
  167 + if($("#excel").val()=="" || document.getElementById("excel").files[0] =='Please select a file in xls format'){
  168 +
  169 + $("#excel").tips({
  170 + side:3,
  171 + msg:'Please select file',
  172 + bg:'#AE81FF',
  173 + time:3
  174 + });
  175 + return false;
  176 + }
  177 + $("#Form").submit();
  178 + $("#zhongxin").hide();
  179 + $("#zhongxin2").show();
  180 + }
  181 + function fileType(obj){
  182 + var fileType=obj.value.substr(obj.value.lastIndexOf(".")).toLowerCase();//获得文件后缀名
  183 + if(fileType != '.xls'){
  184 + $("#excel").tips({
  185 + side:3,
  186 + msg:'Please select a file in xls format',
  187 + bg:'#AE81FF',
  188 + time:3
  189 + });
  190 + $("#excel").val('');
  191 + document.getElementById("excel").files[0] = 'Please select a file in xls format';
  192 + }
  193 + }
  194 + </script>
  195 +
  196 +
  197 +</body>
  198 +</html>
0 \ No newline at end of file 199 \ No newline at end of file
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_list2.jsp
@@ -113,6 +113,12 @@ @@ -113,6 +113,12 @@
113 <div class="creat"> 113 <div class="creat">
114 <input type="button" onclick="add();" value="添加老师" /> 114 <input type="button" onclick="add();" value="添加老师" />
115 </div> 115 </div>
  116 + <div class="creat">
  117 + <input type="button" onclick="upload();" value="批量导入" />
  118 + </div>
  119 + <div class="creat">
  120 + <input type="button" onclick="export2();" value="批量导出" />
  121 + </div>
116 <div class="removeAll"> 122 <div class="removeAll">
117 <input type="button" onclick="del()" value="删除" /> 123 <input type="button" onclick="del()" value="删除" />
118 </div> 124 </div>
@@ -278,6 +284,19 @@ @@ -278,6 +284,19 @@
278 }}); 284 }});
279 window.top.remove.show(); 285 window.top.remove.show();
280 } 286 }
  287 + function upload(){
  288 + window.top.modal.init({
  289 + 'title':'EXCEL导入教师名单',
  290 + 'url':'<%=basePath%>teacher/goUploadExcel.do?school_id=${pd.SCHOOL_ID}',
  291 + func:function() {
  292 + tosearch();
  293 + }
  294 + });
  295 + window.top.modal.show();
  296 + }
  297 + function export2(){
  298 + window.open('<%=basePath%>teacher/excel?school_id=${pd.SCHOOL_ID}','_blank');
  299 + }
281 </script> 300 </script>
282 301
283 302
WebRoot/WEB-INF/jsp/sunvote/teacher/uploadexcel.jsp 0 → 100644
  1 +<%@ page language="java" contentType="text/html; charset=UTF-8"
  2 + pageEncoding="UTF-8"%>
  3 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  4 +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  5 +<%
  6 + String path = request.getContextPath();
  7 + String basePath = request.getScheme() + "://"
  8 + + request.getServerName() + ":" + request.getServerPort()
  9 + + path + "/";
  10 +%>
  11 +<!DOCTYPE html>
  12 +<html lang="en">
  13 +<head>
  14 +<base href="<%=basePath%>">
  15 +
  16 +<!-- jsp文件头和头部 -->
  17 +<%@ include file="../../system/index/top.jsp"%>
  18 +
  19 +
  20 +<style>
  21 +
  22 +.ace-file-input .ace-file-container{
  23 +display: block;
  24 + position: absolute;
  25 + top: 0;
  26 + left: 0;
  27 + right: 0;
  28 + height: 40px;
  29 + background-color: #ffffff;
  30 + border: 1px solid #d5d5d5;
  31 + cursor: pointer;
  32 + -webkit-box-shadow: none;
  33 + box-shadow: none;
  34 + -webkit-transition: all 0.15s;
  35 + -o-transition: all 0.15s;
  36 + transition: all 0.15s;
  37 +}
  38 +.ace-file-input .ace-file-container:before{
  39 + display: inline-block;
  40 + content: attr(data-title);
  41 + position: absolute;
  42 + right: 0;
  43 + top: 0;
  44 + bottom: 0;
  45 + line-height: 34px;
  46 + text-align: center;
  47 + padding: 0 8px;
  48 + background-color: #3bc2d6;
  49 + color: #FFF;
  50 + font-size: 11px;
  51 + font-weight: bold;
  52 + border: 2px solid #FFF;
  53 + border-left-width: 4px;
  54 + -webkit-transition: all 0.3s;
  55 + -o-transition: all 0.3s;
  56 + transition: all 0.3s;
  57 +}
  58 +.ace-file-input .ace-file-container .ace-file-name {
  59 + display: inline-block;
  60 + height: 38px;
  61 + max-width: 80%;
  62 + white-space: nowrap;
  63 + overflow: hidden;
  64 + line-height: 38px;
  65 + color: #888888;
  66 + font-size: 13px;
  67 + vertical-align: top;
  68 + position: static;
  69 + padding-left: 36px;
  70 + }
  71 +
  72 + .ace-file-input .ace-file-container .ace-icon {
  73 + display: inline-block;
  74 + position: absolute;
  75 + left: 0;
  76 + top: 0;
  77 + bottom: 0;
  78 + line-height: 34px;
  79 + width: 36px;
  80 + text-align: center;
  81 + font-family: FontAwesome;
  82 + font-size: 13px;
  83 + border: 2px solid #FFF;
  84 + color: #FFF;
  85 + -webkit-transition: all 0.1s;
  86 + -o-transition: all 0.1s;
  87 + transition: all 0.1s;
  88 + background-color: #3bc2d6;
  89 + }
  90 +
  91 + .ace-file-input .ace-file-container .ace-file-name:after {
  92 + display: inline-block;
  93 + content: attr(data-title);
  94 +}
  95 +
  96 +
  97 +</style>
  98 +
  99 +</head>
  100 +<body class="no-skin">
  101 +
  102 + <!-- /section:basics/navbar.layout -->
  103 + <div class="main-container" id="main-container">
  104 + <!-- /section:basics/sidebar -->
  105 + <div class="main-content">
  106 + <div class="main-content-inner">
  107 + <div class="page-content">
  108 + <div class="row">
  109 + <div class="col-xs-12">
  110 + <form action="teacher/readExcel.do?SCHOOL_ID=${pd.SCHOOL_ID}" name="Form" id="Form" method="post" enctype="multipart/form-data">
  111 + <div id="zhongxin">
  112 + <input type="hidden" name="SCHOOL_ID" id="SCHOOL_ID" value="${pd.SCHOOL_ID}"/>
  113 +
  114 + <table style="width:95%;" >
  115 + <tr>
  116 + <td style="padding-top: 20px;"><input type="file" id="excel" name="excel" style="width:50px;" onchange="fileType(this)" /></td>
  117 + </tr>
  118 + <tr>
  119 + <td style="text-align: center;padding-top: 10px;">
  120 + <a class="btn btn-mini btn-primary" style="background-color:#3bc2d6 !important;border-color:#3bc2d6 !important;width:200px; height:50px;line-height:50px;font-size:18px;margin-top:5%;padding:0" onclick="save();">导入</a>
  121 + <a class="btn btn-mini btn-primary" style="background-color:#87b87f !important;border-color:#87b87f !important;width:200px; height:50px;line-height:50px;font-size:18px;margin-top:5%;padding:0" href="static/files/Template1.xls" target="_blank" >下载模板</a>
  122 + </td>
  123 + </tr>
  124 + </table>
  125 + </div>
  126 + <div id="zhongxin2" class="center" style="display:none"><br/><img src="static/images/jzx.gif" /><br/><h4 class="lighter block green"></h4></div>
  127 + </form>
  128 + </div>
  129 + <!-- /.col -->
  130 + </div>
  131 + <!-- /.row -->
  132 + </div>
  133 + <!-- /.page-content -->
  134 + </div>
  135 + </div>
  136 + <!-- /.main-content -->
  137 + </div>
  138 + <!-- /.main-container -->
  139 +
  140 + <!-- basic scripts -->
  141 + <!-- 页面底部js¨ -->
  142 + <%@ include file="../../system/index/foot.jsp"%>
  143 + <!-- ace scripts -->
  144 + <script src="static/ace/js/ace/ace.js"></script>
  145 + <!-- 上传控件 -->
  146 + <script src="static/ace/js/ace/elements.fileinput.js"></script>
  147 + <!--提示框-->
  148 + <script type="text/javascript" src="static/js/jquery.tips.js"></script>
  149 + <script type="text/javascript">
  150 + $(function() {
  151 + //上传
  152 + $('#excel').ace_file_input({
  153 + no_file:'请选择EXCEL ...',
  154 + btn_choose:'选择',
  155 + btn_change:'更改',
  156 + droppable:false,
  157 + onchange:null,
  158 + thumbnail:false, //| true | large
  159 + whitelist:'xls|xls',
  160 + blacklist:'gif|png|jpg|jpeg'
  161 + //onchange:''
  162 + });
  163 + });
  164 +
  165 + //保存
  166 + function save(){
  167 + if($("#excel").val()=="" || document.getElementById("excel").files[0] =='请选择xls格式的文件'){
  168 +
  169 + $("#excel").tips({
  170 + side:3,
  171 + msg:'请选择文件',
  172 + bg:'#AE81FF',
  173 + time:3
  174 + });
  175 + return false;
  176 + }
  177 + $("#Form").submit();
  178 + $("#zhongxin").hide();
  179 + $("#zhongxin2").show();
  180 + }
  181 + function fileType(obj){
  182 + var fileType=obj.value.substr(obj.value.lastIndexOf(".")).toLowerCase();//获得文件后缀名
  183 + if(fileType != '.xls'){
  184 + $("#excel").tips({
  185 + side:3,
  186 + msg:'请上传xls格式的文件',
  187 + bg:'#AE81FF',
  188 + time:3
  189 + });
  190 + $("#excel").val('');
  191 + document.getElementById("excel").files[0] = '请选择xls格式的文件';
  192 + }
  193 + }
  194 + </script>
  195 +
  196 +
  197 +</body>
  198 +</html>
0 \ No newline at end of file 199 \ No newline at end of file
WebRoot/WEB-INF/jsp/system/index/login.jsp
@@ -105,7 +105,7 @@ body{ @@ -105,7 +105,7 @@ body{
105 </div> 105 </div>
106 </div> 106 </div>
107 <div class="div_foot"> 107 <div class="div_foot">
108 - 备案许可证号: <a target= "_blank" href="http://www.miitbeian.gov.cn/">湘ICP备09025927号-10</a> 108 + <!-- 备案许可证号: <a target= "_blank" href="http://www.miitbeian.gov.cn/">湘ICP备09025927号-10</a> -->
109 </div> 109 </div>
110 <script type="text/javascript"> 110 <script type="text/javascript">
111 111
WebRoot/static/files/Template1.xls 0 → 100644
No preview for this file type
resources/mybatis1/api/V1Mapper.xml
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 <!-- 通过教师ID获取班级数据 --> 5 <!-- 通过教师ID获取班级数据 -->
6 <select id="getTeacherClassInfo" parameterType="pd" resultType="pd"> 6 <select id="getTeacherClassInfo" parameterType="pd" resultType="pd">
7 SELECT 7 SELECT
8 - CLASS_ID,CLASS_NAME,CLASS_CODE 8 + CLASS_ID,CLASS_NAME,CLASS_CODE,sv_sclass.GRADE_ID
9 FROM 9 FROM
10 sv_coursemanagement 10 sv_coursemanagement
11 LEFT JOIN sv_sclass ON sv_coursemanagement.CLASS_ID = sv_sclass.ID 11 LEFT JOIN sv_sclass ON sv_coursemanagement.CLASS_ID = sv_sclass.ID
resources/mybatis1/sunvote/PaperMapper.xml
@@ -223,6 +223,12 @@ @@ -223,6 +223,12 @@
223 <if test="CLASS_ID != null and CLASS_ID != ''"> 223 <if test="CLASS_ID != null and CLASS_ID != ''">
224 and CLASS_ID = #{CLASS_ID} 224 and CLASS_ID = #{CLASS_ID}
225 </if> 225 </if>
  226 + <if test="SCHOOL_ID != null and SCHOOL_ID != ''">
  227 + and SCHOOL_ID = #{SCHOOL_ID}
  228 + </if>
  229 + <if test="GRADE_ID != null and GRADE_ID != ''">
  230 + and GRADE_ID = #{GRADE_ID}
  231 + </if>
226 232
227 <if test="START_DATE != null and START_DATE != ''"><!-- 关键词检索 --> 233 <if test="START_DATE != null and START_DATE != ''"><!-- 关键词检索 -->
228 and (CREATE_DATE &gt; #{START_DATE}) 234 and (CREATE_DATE &gt; #{START_DATE})
resources/mybatis1/sunvote/StudentMapper.xml
@@ -186,10 +186,12 @@ @@ -186,10 +186,12 @@
186 sv_student.PARENT_PHONE, 186 sv_student.PARENT_PHONE,
187 sv_student.KEYPAD_ID, 187 sv_student.KEYPAD_ID,
188 sv_student.REMARK, 188 sv_student.REMARK,
189 - sv_student.ID 189 + sv_student.ID,
  190 + sv_sclass.CLASS_NAME
190 from sv_student 191 from sv_student
191 LEFT JOIN sv_classroster cr ON sv_student.ID = cr.STUDENT_ID 192 LEFT JOIN sv_classroster cr ON sv_student.ID = cr.STUDENT_ID
192 LEFT JOIN sv_term ON cr.TEAMID = sv_term.TERM_ID 193 LEFT JOIN sv_term ON cr.TEAMID = sv_term.TERM_ID
  194 + LEFT JOIN sv_sclass ON cr.SCLASS_ID = sv_sclass.ID
193 WHERE 195 WHERE
194 1 = 1 196 1 = 1
195 AND sv_term.START_DATE &lt; NOW() 197 AND sv_term.START_DATE &lt; NOW()
resources/mybatis1/sunvote/SubjectMapper.xml
@@ -69,6 +69,16 @@ @@ -69,6 +69,16 @@
69 ID = #{ID} 69 ID = #{ID}
70 </select> 70 </select>
71 71
  72 + <!-- 通过cname获取数据 -->
  73 + <select id="findByCname" parameterType="pd" resultType="pd">
  74 + select
  75 + <include refid="Field"></include>
  76 + from
  77 + <include refid="tableName"></include>
  78 + where
  79 + CNAME = #{SUBJECT_IDS}
  80 + </select>
  81 +
72 <!-- 列表 --> 82 <!-- 列表 -->
73 <select id="datalistPage" parameterType="page" resultType="pd"> 83 <select id="datalistPage" parameterType="page" resultType="pd">
74 select 84 select
resources/mybatis1/sunvote/TeacherMapper.xml
@@ -23,6 +23,23 @@ @@ -23,6 +23,23 @@
23 ID 23 ID
24 </sql> 24 </sql>
25 25
  26 + <sql id="Field2">
  27 + SV_TEACHER.SCHOOL_ID,
  28 + SV_TEACHER.`NAME`,
  29 + sv_school.`NAME` AS SCHOOL_NAME,
  30 + sv_subject.CNAME,
  31 + SV_TEACHER.PHONE,
  32 + SV_TEACHER.SEAT_PHONE,
  33 + SV_TEACHER.CARD_NO,
  34 + SV_TEACHER.ACCOUT,
  35 + SV_TEACHER.PASSWORD,
  36 + SV_TEACHER.SEX,
  37 + SV_TEACHER.SUBJECT_IDS,
  38 + SV_TEACHER.KEYPAD_ID,
  39 + SV_TEACHER.HEADMASTER,
  40 + SV_TEACHER.ID
  41 + </sql>
  42 +
26 <!-- 字段值 --> 43 <!-- 字段值 -->
27 <sql id="FieldValue"> 44 <sql id="FieldValue">
28 #{SCHOOL_ID}, 45 #{SCHOOL_ID},
@@ -134,6 +151,16 @@ @@ -134,6 +151,16 @@
134 </select> 151 </select>
135 152
136 <!-- 通过ID获取数据 --> 153 <!-- 通过ID获取数据 -->
  154 + <select id="findById2" parameterType="String" resultType="pd">
  155 + select
  156 + <include refid="Field"></include>
  157 + from
  158 + <include refid="tableName"></include>
  159 + where
  160 + ID = #{ID}
  161 + </select>
  162 +
  163 + <!-- 通过ID获取数据 -->
137 <select id="getUserInfo" parameterType="pd" resultType="pd"> 164 <select id="getUserInfo" parameterType="pd" resultType="pd">
138 select 165 select
139 <include refid="Field"></include> 166 <include refid="Field"></include>
@@ -176,9 +203,11 @@ @@ -176,9 +203,11 @@
176 <!-- 列表(全部) --> 203 <!-- 列表(全部) -->
177 <select id="listAll" parameterType="pd" resultType="pd"> 204 <select id="listAll" parameterType="pd" resultType="pd">
178 select 205 select
179 - <include refid="Field"></include> 206 + <include refid="Field2"></include>
180 from 207 from
181 <include refid="tableName"></include> 208 <include refid="tableName"></include>
  209 + LEFT JOIN sv_school ON sv_teacher.SCHOOL_ID = sv_school.ID
  210 + LEFT JOIN sv_subject on sv_teacher.SUBJECT_IDS = sv_subject.ID
182 where 1 = 1 211 where 1 = 1
183 <if test="SCHOOL_ID != null and SCHOOL_ID != ''"><!-- 关键词检索 --> 212 <if test="SCHOOL_ID != null and SCHOOL_ID != ''"><!-- 关键词检索 -->
184 and 213 and
src/com/fh/controller/api/V1.java
@@ -548,6 +548,13 @@ public class V1 extends BaseController { @@ -548,6 +548,13 @@ public class V1 extends BaseController {
548 * showcount; 548 * showcount;
549 pd.put("CURRENTPAGE", "" + currentPage); 549 pd.put("CURRENTPAGE", "" + currentPage);
550 } 550 }
  551 + PageData p = teacherService.findById2(pd.get("USER_ID").toString());
  552 + if(p != null){
  553 + pd.put("SCHOOL_ID", p.get("SCHOOL_ID"));
  554 + pd.remove("USER_ID");
  555 + }else{
  556 + pd.put("SCHOOL_ID", "");
  557 + }
551 List<PageData> pageList = paperService.listAllByType(pd); 558 List<PageData> pageList = paperService.listAllByType(pd);
552 res.setData(pageList); 559 res.setData(pageList);
553 } else { 560 } else {
src/com/fh/controller/sunvote/student/StudentController.java
@@ -381,38 +381,43 @@ public class StudentController extends BaseController { @@ -381,38 +381,43 @@ public class StudentController extends BaseController {
381 * @throws Exception 381 * @throws Exception
382 */ 382 */
383 @RequestMapping(value="/excel") 383 @RequestMapping(value="/excel")
384 - public ModelAndView exportExcel() throws Exception{ 384 + public ModelAndView exportExcel(Page page) throws Exception{
385 logBefore(logger, Jurisdiction.getUsername()+"导出Student到excel"); 385 logBefore(logger, Jurisdiction.getUsername()+"导出Student到excel");
386 ModelAndView mv = new ModelAndView(); 386 ModelAndView mv = new ModelAndView();
387 PageData pd = new PageData(); 387 PageData pd = new PageData();
388 pd = this.getPageData(); 388 pd = this.getPageData();
  389 + page.setPd(pd);
389 Map<String,Object> dataMap = new HashMap<String,Object>(); 390 Map<String,Object> dataMap = new HashMap<String,Object>();
390 List<String> titles = new ArrayList<String>(); 391 List<String> titles = new ArrayList<String>();
391 titles.add("学生姓名"); //1 392 titles.add("学生姓名"); //1
392 - titles.add("学籍号"); //2  
393 - titles.add("学号"); //3  
394 - titles.add("性别"); //4  
395 - titles.add("组号"); //5  
396 - titles.add("签到码"); //6  
397 - titles.add("家长姓名"); //7  
398 - titles.add("家长手机号"); //8  
399 - titles.add("键盘ID"); //9  
400 - titles.add("备注"); //10 393 + titles.add("学号"); //2
  394 + titles.add("键盘ID"); //3
  395 + titles.add("年级"); //4
  396 +// titles.add("组号"); //5
  397 +// titles.add("签到码"); //6
  398 +// titles.add("家长姓名"); //7
  399 +// titles.add("家长手机号"); //8
  400 +// titles.add("键盘ID"); //9
  401 +// titles.add("备注"); //10
401 dataMap.put("titles", titles); 402 dataMap.put("titles", titles);
402 - List<PageData> varOList = studentService.listAll(pd); 403 + List<PageData> varOList = studentService.listAllClass(pd);
403 List<PageData> varList = new ArrayList<PageData>(); 404 List<PageData> varList = new ArrayList<PageData>();
404 for(int i=0;i<varOList.size();i++){ 405 for(int i=0;i<varOList.size();i++){
405 PageData vpd = new PageData(); 406 PageData vpd = new PageData();
406 - vpd.put("var1", varOList.get(i).getString("NAME")); //1  
407 - vpd.put("var2", varOList.get(i).getString("SNO")); //2  
408 - vpd.put("var3", varOList.get(i).getString("NUMBER")); //3  
409 - vpd.put("var4", varOList.get(i).get("SEX").toString()); //4  
410 - vpd.put("var5", varOList.get(i).getString("GROUP")); //5  
411 - vpd.put("var6", varOList.get(i).getString("SIGN_NO")); //6  
412 - vpd.put("var7", varOList.get(i).getString("PARENT_NAME")); //7  
413 - vpd.put("var8", varOList.get(i).getString("PARENT_PHONE")); //8  
414 - vpd.put("var9", varOList.get(i).getString("KEYPAD_ID")); //9  
415 - vpd.put("var10", varOList.get(i).getString("REMARK")); //10 407 + vpd.put("var1", varOList.get(i).getString("NAME"));
  408 + vpd.put("var2", varOList.get(i).getString("NUMBER"));
  409 + vpd.put("var3", varOList.get(i).getString("KEYPAD_ID"));
  410 + vpd.put("var4", varOList.get(i).getString("CLASS_NAME"));
  411 +// vpd.put("var1", varOList.get(i).getString("NAME")); //1
  412 +// vpd.put("var2", varOList.get(i).getString("SNO")); //2
  413 +// vpd.put("var3", varOList.get(i).getString("NUMBER")); //3
  414 +// vpd.put("var4", varOList.get(i).get("SEX").toString()); //4
  415 +// vpd.put("var5", varOList.get(i).getString("GROUP")); //5
  416 +// vpd.put("var6", varOList.get(i).getString("SIGN_NO")); //6
  417 +// vpd.put("var7", varOList.get(i).getString("PARENT_NAME")); //7
  418 +// vpd.put("var8", varOList.get(i).getString("PARENT_PHONE")); //8
  419 +// vpd.put("var9", varOList.get(i).getString("KEYPAD_ID")); //9
  420 +// vpd.put("var10", varOList.get(i).getString("REMARK")); //10
416 varList.add(vpd); 421 varList.add(vpd);
417 } 422 }
418 dataMap.put("varList", varList); 423 dataMap.put("varList", varList);
src/com/fh/controller/sunvote/teacher/TeacherController.java
@@ -17,7 +17,9 @@ import org.springframework.stereotype.Controller; @@ -17,7 +17,9 @@ import org.springframework.stereotype.Controller;
17 import org.springframework.web.bind.WebDataBinder; 17 import org.springframework.web.bind.WebDataBinder;
18 import org.springframework.web.bind.annotation.InitBinder; 18 import org.springframework.web.bind.annotation.InitBinder;
19 import org.springframework.web.bind.annotation.RequestMapping; 19 import org.springframework.web.bind.annotation.RequestMapping;
  20 +import org.springframework.web.bind.annotation.RequestParam;
20 import org.springframework.web.bind.annotation.ResponseBody; 21 import org.springframework.web.bind.annotation.ResponseBody;
  22 +import org.springframework.web.multipart.MultipartFile;
21 import org.springframework.web.servlet.ModelAndView; 23 import org.springframework.web.servlet.ModelAndView;
22 24
23 import com.fh.controller.api.ResponseGson; 25 import com.fh.controller.api.ResponseGson;
@@ -30,9 +32,13 @@ import com.fh.service.sunvote.teacher.TeacherManager; @@ -30,9 +32,13 @@ import com.fh.service.sunvote.teacher.TeacherManager;
30 import com.fh.service.system.fhlog.FHlogManager; 32 import com.fh.service.system.fhlog.FHlogManager;
31 import com.fh.service.system.user.UserManager; 33 import com.fh.service.system.user.UserManager;
32 import com.fh.util.AppUtil; 34 import com.fh.util.AppUtil;
  35 +import com.fh.util.Const;
  36 +import com.fh.util.FileUpload;
33 import com.fh.util.Jurisdiction; 37 import com.fh.util.Jurisdiction;
  38 +import com.fh.util.ObjectExcelRead;
34 import com.fh.util.ObjectExcelView; 39 import com.fh.util.ObjectExcelView;
35 import com.fh.util.PageData; 40 import com.fh.util.PageData;
  41 +import com.fh.util.PathUtil;
36 import com.fh.util.Tools; 42 import com.fh.util.Tools;
37 43
38 /** 44 /**
@@ -718,7 +724,85 @@ public class TeacherController extends BaseController { @@ -718,7 +724,85 @@ public class TeacherController extends BaseController {
718 map.put("list", pdList); 724 map.put("list", pdList);
719 return AppUtil.returnObject(pd, map); 725 return AppUtil.returnObject(pd, map);
720 } 726 }
  727 +
  728 + /**打开上传EXCEL页面
  729 + * @return
  730 + * @throws Exception
  731 + */
  732 + @RequestMapping(value="/goUploadExcel")
  733 + public ModelAndView goUploadExcel()throws Exception{
  734 + ModelAndView mv = this.getModelAndView();
  735 + mv.addObject("pd", getPageData());
  736 +
  737 + if(isChineseLanguageClient()){
  738 + mv.setViewName("sunvote/teacher/uploadexcel");
  739 + }else{
  740 + mv.setViewName("sunvote/teacher/en_uploadexcel");
  741 + }
  742 + return mv;
  743 + }
  744 +
721 745
  746 + /**从EXCEL导入到数据库
  747 + * @param file
  748 + * @return
  749 + * @throws Exception
  750 + */
  751 + @RequestMapping(value="/readExcel")
  752 + public ModelAndView readExcel(
  753 + @RequestParam(value="excel",required=false) MultipartFile file
  754 + ) throws Exception{
  755 + logBefore(logger,Jurisdiction.getUsername() + "从EXCEL导入到数据库");
  756 + ModelAndView mv = this.getModelAndView();
  757 + PageData tpd = getPageData();
  758 + PageData pd = new PageData();
  759 +
  760 + String schoolID = tpd.getString("SCHOOL_ID");
  761 + if (null != file && !file.isEmpty()) {
  762 + String filePath = PathUtil.getClasspath() + Const.FILEPATHFILE; //文件上传路径
  763 + String fileName = FileUpload.fileUp(file, filePath, "userexcel"); //执行上传
  764 + List<PageData> listPd = (List)ObjectExcelRead.readExcel(filePath, fileName, 0, 0, 0); //执行读EXCEL操作,读出的数据导入List 2:从第3行开始;0:从第A列开始;0:第0个sheet
  765 + if(listPd.size() > 0 ){
  766 + pd= listPd.get(0);
  767 + for(int i = 1 ; i < listPd.size();i++){
  768 + PageData savePd = new PageData();
  769 + PageData temp = listPd.get(i);
  770 + for(int j = 0 ; ;j++){
  771 + if(temp.get("var" + j) == null){
  772 + break ;
  773 + }
  774 + if(temp.get("var" + j) != null && !"".equals(temp.get("var" + j).toString())){
  775 + savePd.put(pd.getString("var" + j).toUpperCase(), temp.get("var" + j));
  776 + }
  777 +
  778 + }
  779 + PageData page = subjectService.findByCname(savePd);
  780 + if(page!=null){
  781 + savePd.put("SUBJECT_IDS", page.get("ID"));
  782 + }else{
  783 + savePd.put("SUBJECT_IDS", "");
  784 + }
  785 + if(!savePd.containsKey("ID")){
  786 + if (savePd.values().size() > 0) {
  787 + String teacherId = this.get32UUID();
  788 + savePd.put("ID", teacherId);
  789 + savePd.put("SCHOOL_ID", schoolID);
  790 +
  791 + teacherService.save(savePd);
  792 + }
  793 +
  794 + }else{
  795 + teacherService.edit(savePd);
  796 + }
  797 + }
  798 +
  799 + }
  800 + }
  801 + mv.addObject("msg","success");
  802 + mv.setViewName("save_result2");
  803 + return mv;
  804 + }
  805 +
722 /** 806 /**
723 * 导出到excel 807 * 导出到excel
724 * 808 *
@@ -748,15 +832,15 @@ public class TeacherController extends BaseController { @@ -748,15 +832,15 @@ public class TeacherController extends BaseController {
748 List<PageData> varList = new ArrayList<PageData>(); 832 List<PageData> varList = new ArrayList<PageData>();
749 for (int i = 0; i < varOList.size(); i++) { 833 for (int i = 0; i < varOList.size(); i++) {
750 PageData vpd = new PageData(); 834 PageData vpd = new PageData();
751 - vpd.put("var1", varOList.get(i).get("SCHOOL_ID").toString()); // 1 835 + vpd.put("var1", varOList.get(i).get("SCHOOL_NAME").toString()); // 1
752 vpd.put("var2", varOList.get(i).getString("NAME")); // 2 836 vpd.put("var2", varOList.get(i).getString("NAME")); // 2
753 vpd.put("var3", varOList.get(i).getString("PHONE")); // 3 837 vpd.put("var3", varOList.get(i).getString("PHONE")); // 3
754 vpd.put("var4", varOList.get(i).getString("SEAT_PHONE")); // 4 838 vpd.put("var4", varOList.get(i).getString("SEAT_PHONE")); // 4
755 vpd.put("var5", varOList.get(i).getString("CARD_NO")); // 5 839 vpd.put("var5", varOList.get(i).getString("CARD_NO")); // 5
756 vpd.put("var6", varOList.get(i).getString("ACCOUT")); // 6 840 vpd.put("var6", varOList.get(i).getString("ACCOUT")); // 6
757 vpd.put("var7", varOList.get(i).getString("PASSWORD")); // 7 841 vpd.put("var7", varOList.get(i).getString("PASSWORD")); // 7
758 - vpd.put("var8", varOList.get(i).get("SEX").toString()); // 8  
759 - vpd.put("var9", varOList.get(i).getString("SUBJECT_IDS")); // 9 842 + vpd.put("var8", varOList.get(i).get("SEX").toString().equals("1")?"男":"女"); // 8
  843 + vpd.put("var9", varOList.get(i).getString("CNAME")); // 9
760 vpd.put("var10", varOList.get(i).getString("KEYPAD_ID")); // 10 844 vpd.put("var10", varOList.get(i).getString("KEYPAD_ID")); // 10
761 varList.add(vpd); 845 varList.add(vpd);
762 } 846 }
src/com/fh/service/sunvote/subject/SubjectManager.java
@@ -54,6 +54,12 @@ public interface SubjectManager{ @@ -54,6 +54,12 @@ public interface SubjectManager{
54 */ 54 */
55 public PageData findById(PageData pd)throws Exception; 55 public PageData findById(PageData pd)throws Exception;
56 56
  57 + /**通过cname获取数据
  58 + * @param pd
  59 + * @throws Exception
  60 + */
  61 + public PageData findByCname(PageData pd)throws Exception;
  62 +
57 /**批量删除 63 /**批量删除
58 * @param ArrayDATA_IDS 64 * @param ArrayDATA_IDS
59 * @throws Exception 65 * @throws Exception
src/com/fh/service/sunvote/subject/impl/SubjectService.java
@@ -97,6 +97,14 @@ public class SubjectService implements SubjectManager{ @@ -97,6 +97,14 @@ public class SubjectService implements SubjectManager{
97 return (PageData)dao.findForObject("SubjectMapper.findById", pd); 97 return (PageData)dao.findForObject("SubjectMapper.findById", pd);
98 } 98 }
99 99
  100 + /**通过id获取数据
  101 + * @param pd
  102 + * @throws Exception
  103 + */
  104 + public PageData findByCname(PageData pd)throws Exception{
  105 + return (PageData)dao.findForObject("SubjectMapper.findByCname", pd);
  106 + }
  107 +
100 /**批量删除 108 /**批量删除
101 * @param ArrayDATA_IDS 109 * @param ArrayDATA_IDS
102 * @throws Exception 110 * @throws Exception
src/com/fh/service/sunvote/teacher/TeacherManager.java
@@ -76,6 +76,12 @@ public interface TeacherManager{ @@ -76,6 +76,12 @@ public interface TeacherManager{
76 */ 76 */
77 public PageData findById(PageData pd)throws Exception; 77 public PageData findById(PageData pd)throws Exception;
78 78
  79 + /**通过id获取数据
  80 + * @param pd
  81 + * @throws Exception
  82 + */
  83 + public PageData findById2(String ID)throws Exception;
  84 +
79 /**通过username&password获取数据 85 /**通过username&password获取数据
80 * @param pd 86 * @param pd
81 * @throws Exception 87 * @throws Exception
src/com/fh/service/sunvote/teacher/impl/TeacherService.java
@@ -77,6 +77,14 @@ public class TeacherService implements TeacherManager{ @@ -77,6 +77,14 @@ public class TeacherService implements TeacherManager{
77 * @param pd 77 * @param pd
78 * @throws Exception 78 * @throws Exception
79 */ 79 */
  80 + public PageData findById2(String ID)throws Exception{
  81 + return (PageData)dao.findForObject("TeacherMapper.findById2", ID);
  82 + }
  83 +
  84 + /**通过id获取数据
  85 + * @param pd
  86 + * @throws Exception
  87 + */
80 public PageData getUserInfo(PageData pd)throws Exception{ 88 public PageData getUserInfo(PageData pd)throws Exception{
81 return (PageData)dao.findForObject("TeacherMapper.getUserInfo", pd); 89 return (PageData)dao.findForObject("TeacherMapper.getUserInfo", pd);
82 } 90 }