diff --git a/admin-core/src/main/resources/codeTemplate/js/entityApi.js b/admin-core/src/main/resources/codeTemplate/js/entityApi.js index 0167774d..e02c90a9 100644 --- a/admin-core/src/main/resources/codeTemplate/js/entityApi.js +++ b/admin-core/src/main/resources/codeTemplate/js/entityApi.js @@ -16,9 +16,10 @@ layui.define([], function(exports) { , exportExcel:function(form,callback){ var formPara = form.serializeJson(); - Common.post("/jlw/${entity.code}/excel/export.json", formPara, function(fileId) { - callback(fileId); - }) + Common.downLoad("/jlw/${entity.code}/excel/export.json", formPara, 'POST') + // Common.post("/jlw/${entity.code}/excel/export.json", formPara, function(fileId) { + // callback(fileId); + // }) } @} diff --git a/admin-core/src/main/resources/static/js/common.js b/admin-core/src/main/resources/static/js/common.js index 2ad64934..65c15f8f 100644 --- a/admin-core/src/main/resources/static/js/common.js +++ b/admin-core/src/main/resources/static/js/common.js @@ -107,11 +107,23 @@ var Common = { } }, error: function (rsp) { - Common.error(rsp.responseJSON.msg); + if(rsp.responseJSON?.msg) + Common.error(rsp.responseJSON?.msg); + else + Common.error('服务器错误,请联系管理员'); } }) }, + downLoad: function (url, data = {}, method = 'POST') { + var form = $('
'); + $.each(data, function (k, v) { + form.append($('')); + }); + $('body').append(form); + form.submit(); //自动提交 + }, getOneFromTable: function (layuiTable, tableId) { var checkStatus = layuiTable.checkStatus(tableId) , data = checkStatus.data; diff --git a/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseStudentSigninLogDao.java b/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseStudentSigninLogDao.java index 7f34d48b..e6cec19b 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseStudentSigninLogDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseStudentSigninLogDao.java @@ -8,6 +8,7 @@ import org.beetl.sql.mapper.annotation.SqlResource; import org.beetl.sql.mapper.annotation.Update; import java.util.List; +import java.util.Map; /** * 学生签到记录 Dao @@ -23,4 +24,6 @@ public interface TeacherOpenCourseStudentSigninLogDao extends BaseMapper getByIds(String ids); List getValuesByQuery(TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery); List getValuesByQueryNotWithPermission(TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery); + + List> getExcelValues(TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery); } diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java index 40155dba..6078cb4b 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java @@ -2,6 +2,7 @@ package com.ibeetl.jlw.service; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.BooleanUtil; +import cn.hutool.core.util.EnumUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.extra.validation.BeanValidationResult; import cn.hutool.extra.validation.ValidationUtil; @@ -11,21 +12,24 @@ import com.alibaba.fastjson.JSONObject; import com.ibeetl.admin.core.entity.CoreUser; import com.ibeetl.admin.core.service.CoreBaseService; import com.ibeetl.admin.core.util.PlatformException; +import com.ibeetl.admin.core.util.TimeTool; import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.admin.core.web.JsonReturnCode; import com.ibeetl.jlw.dao.StudentDao; import com.ibeetl.jlw.dao.TeacherOpenCourseMergeSchoolClassDao; import com.ibeetl.jlw.dao.TeacherOpenCourseStudentSigninLogDao; import com.ibeetl.jlw.dao.TeacherOpenCourseStudentSigninSettingDao; -import com.ibeetl.jlw.entity.Student; -import com.ibeetl.jlw.entity.TeacherOpenCourseMergeSchoolClass; -import com.ibeetl.jlw.entity.TeacherOpenCourseStudentSigninLog; -import com.ibeetl.jlw.entity.TeacherOpenCourseStudentSigninSetting; +import com.ibeetl.jlw.entity.*; import com.ibeetl.jlw.entity.dto.TeacherOpenCourseStudentSigninLogSigninDTO; import com.ibeetl.jlw.entity.dto.TeacherOpenCourseStudentSigninLogSigninDTO.ManualClass; import com.ibeetl.jlw.validator.TeacherOpenCourseStudentSigninLogSigninDTOValidator; import com.ibeetl.jlw.web.query.TeacherOpenCourseStudentSigninLogQuery; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.beetl.sql.core.SqlId; import org.beetl.sql.core.engine.PageQuery; import org.springframework.stereotype.Service; @@ -34,14 +38,13 @@ import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import javax.validation.constraints.NotNull; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.List; +import java.io.*; +import java.util.*; import static cn.jlw.util.IpUtils.getIpAddr; import static cn.jlw.util.IpUtils.isRangeInner; import static cn.jlw.util.ValidatorUtil.getFirstErrorMessage; +import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue; import static com.ibeetl.admin.core.util.servlet.ServletUtils.getRequest; import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser; import static com.ibeetl.jlw.entity.TeacherOpenCourseStudentSigninSetting.ALL_SCHOOL_CLASS_IDS_SIGN; @@ -372,14 +375,170 @@ public class TeacherOpenCourseStudentSigninLogService extends CoreBaseService fileEntityList, Listlist, CoreUser coreUser){ + ListerrMsg = new ArrayList<>(); + String msg =""; + int count = 0; + Date date = new Date(); + for(int item=0;null != fileEntityList && item map = new HashMap<>();//获取需要的表头的列 + //从第一列找到需要的表头 + for (int i=0; i0?JsonReturnCode.SUCCESS.getCode():JsonReturnCode.FAIL.getCode()); + jsonResult.setData(errMsg); + jsonResult.setMsg((count>0?"导入成功,共导入"+count+"条":"导入失败")+(StringUtils.isNotBlank(msg)?"
"+msg:"")); + return jsonResult; } + public List> getExcelValues (TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery){ + return teacherOpenCourseStudentSigninLogDao.getExcelValues(teacherOpenCourseStudentSigninLogQuery); + } + } diff --git a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseStudentSigninLogController.java b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseStudentSigninLogController.java index 230774ae..d89bb65e 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseStudentSigninLogController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseStudentSigninLogController.java @@ -1,11 +1,16 @@ package com.ibeetl.jlw.web; +import cn.jlw.Interceptor.GetFile; +import cn.jlw.Interceptor.RFile; import cn.jlw.Interceptor.SCoreUser; +import cn.jlw.util.ToolUtils; import cn.jlw.validate.ValidateConfig; import com.ibeetl.admin.core.annotation.Function; import com.ibeetl.admin.core.entity.CoreUser; import com.ibeetl.admin.core.file.FileService; +import com.ibeetl.admin.core.util.TimeTool; import com.ibeetl.admin.core.web.JsonResult; +import com.ibeetl.jlw.entity.FileEntity; import com.ibeetl.jlw.entity.TeacherOpenCourseStudentSigninLog; import com.ibeetl.jlw.entity.dto.TeacherOpenCourseStudentSigninLogSigninDTO; import com.ibeetl.jlw.service.TeacherOpenCourseStudentSigninLogService; @@ -13,6 +18,10 @@ import com.ibeetl.jlw.web.query.TeacherOpenCourseStudentSigninLogQuery; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.ss.usermodel.HorizontalAlignment; +import org.apache.poi.ss.usermodel.VerticalAlignment; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.beetl.sql.core.engine.PageQuery; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; @@ -23,7 +32,14 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.ArrayList; import java.util.List; +import java.util.Map; /** * 学生签到记录 教师-我的课程-开课-学生签到记录 接口 @@ -212,8 +228,179 @@ public class TeacherOpenCourseStudentSigninLogController{ * 2. 通过班级ID,查询学生列表 {@link StudentController#list} * 3. 通过学生ID,查询学生的签到日志 {@link TeacherOpenCourseStudentSigninLogController#list} * - * @param query - * @return */ + public void haha() {} + + //下载模板信息 + @GetMapping(MODEL + "/downloadTemplate.json") + public void download(HttpServletRequest request,HttpServletResponse response,@SCoreUser CoreUser coreUser) { + if(null == coreUser){ + return; + } + XSSFWorkbook workbook = null; + InputStream is = null; + try { + //TODO 改导入模板名字 + is = new FileInputStream(GetFile.p + File.separator +"filesystem"+ File.separator +"template"+ File.separator+ "导入模板.xlsx"); + workbook = new XSSFWorkbook(is); + try { + if(null != is){ + is.close(); + } + }catch (Exception e){ + e.printStackTrace(); + } + //准备将Excel的输出流通过response输出到页面下载 + //八进制输出流 + response.setContentType("application/octet-stream"); + //这后面可以设置导出Excel的名称,此例中名为template.xls + String fileName = ToolUtils.web2fileName(request,"teacherOpenCourseStudentSigninLogTemplate(" + TimeTool.getNowTime("YMD") + ").xlsx"); + response.setHeader("Content-disposition", "attachment;filename="+fileName); + //刷新缓冲 + response.flushBuffer(); + //workbook将Excel写入到response的输出流中,供页面下载 + workbook.write(response.getOutputStream()); + }catch (Exception e){ + e.printStackTrace(); + } finally { + try { + if (null != workbook) { + workbook.close(); + } + if (null != response && null != response.getOutputStream()) { + response.getOutputStream().close(); + } + } catch (Exception e) { } + } + } + //导入模板信息 + @PostMapping(MODEL + "/importTemplate.json") + @Function("teacherOpenCourseStudentSigninLog.importTemplate") + public JsonResult importTemplate(@RFile List fileEntityList, @SCoreUser CoreUser coreUser) { + if(null == coreUser){ + return JsonResult.failMessage("请登录后再操作"); + } + Listlist=new ArrayList<>(); + JsonResult jsonResult = teacherOpenCourseStudentSigninLogService.importTemplate(fileEntityList,list,coreUser); + if(list.size()>0){ + teacherOpenCourseStudentSigninLogService.deleteByList(list); + } + return jsonResult; + } + //导出信息 + @PostMapping(MODEL + "/excel/export.json") + @Function("teacherOpenCourseStudentSigninLog.exportDocument") + public void export(HttpServletRequest request, HttpServletResponse response, TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery, @SCoreUser CoreUser coreUser) { + if(null == coreUser){ + return; + } + HSSFWorkbook workbook = null; + try { + //表头数据 + String[] header = { + "签到配置", + "场次时间", + "学生", + "开课", + "班级", + "签到日期", + "签到方式 ", + "备注", + "签到的IP", + "标记 10签到 20缺勤", + }; + String[] headerCode = { + "teacherOpenCourseStudentSigninSettingId", + "teacherOpenCourseStudentSigninSettingSessionTime", + "studentId", + "teacherOpenCourseId", + "schoolClassId", + "teacherOpenCourseStudentSigninLogAddTime", + "teacherOpenCourseStudentSigninLogType", + "teacherOpenCourseStudentSigninLogRemark", + "teacherOpenCourseStudentSigninLogIp", + "teacherOpenCourseStudentSigninLogTag", + }; + //数据内容 + List> mapList = teacherOpenCourseStudentSigninLogService.getExcelValues(teacherOpenCourseStudentSigninLogQuery); + //内容宽度 + Map widthMap = mapList.get(0); + mapList.remove(0); + //声明一个工作簿 + workbook = new HSSFWorkbook(); + //生成一个表格,设置表格名称为"Sheet1" + HSSFSheet sheet = workbook.createSheet("Sheet1"); + //冻结表头 + sheet.createFreezePane(0, 1, 0, 1); + //设置默认列宽度为5个字节 + sheet.setDefaultColumnWidth(5); + //创建第一行表头 + HSSFRow headRow = sheet.createRow(0); + //头部样式 + HSSFCellStyle headerStyle = workbook.createCellStyle(); + //垂直居中 + headerStyle.setVerticalAlignment(VerticalAlignment.CENTER); + //水平居中 + headerStyle.setAlignment(HorizontalAlignment.CENTER); + //单元格样式 + HSSFCellStyle cellStyle = workbook.createCellStyle(); + //垂直居中 + cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); + //水平居左 + cellStyle.setAlignment(HorizontalAlignment.CENTER); + //自动换行 + cellStyle.setWrapText(true); + //遍历添加表头 + for (int i = 0; i < header.length; i++) { + //设置表格特定的列宽度 + if (null != widthMap.get(headerCode[i])) { + String width = widthMap.get(headerCode[i]).toString().split("\\.")[0]; + Integer w = Integer.parseInt(width) > header[i].length()*3?Integer.parseInt(width):header[i].length()*3; + sheet.setColumnWidth(i, w * 190); + } + //创建一个单元格 + HSSFCell cell = headRow.createCell(i); + //创建一个内容对象 + HSSFRichTextString text = new HSSFRichTextString(header[i]); + //将内容对象的文字内容写入到单元格中 + cell.setCellValue(text); + //设置样式 + cell.setCellStyle(headerStyle); + } + //遍历结果集,把内容加入表格 + for (int i = 0; i < mapList.size(); i++) { + HSSFRow row = sheet.createRow(i + 1); + row.setHeight((short) (50*10)); + Map map = mapList.get(i); + for (int j = 0; j < headerCode.length; j++) { + HSSFCell cell = row.createCell(j); + cell.setCellStyle(cellStyle); + HSSFRichTextString text = new HSSFRichTextString(null != map.get(headerCode[j]) ? map.get(headerCode[j]).toString() : " "); + cell.setCellValue(text); + } + } + //准备将Excel的输出流通过response输出到页面下载 + //八进制输出流 + response.setContentType("application/octet-stream"); + //这后面可以设置导出Excel的名称,此例中名为student.xls + String fileName = ToolUtils.web2fileName(request,"teacherOpenCourseStudentSigninLog(" + TimeTool.getNowTime("YMD") + ").xls"); + response.setHeader("Content-disposition", "attachment;filename="+fileName); + //刷新缓冲 + response.flushBuffer(); + //workbook将Excel写入到response的输出流中,供页面下载 + workbook.write(response.getOutputStream()); + }catch (Exception e){ + e.printStackTrace(); + } finally { + try { + if (null != workbook) { + workbook.close(); + } + if (null != response && null != response.getOutputStream()) { + response.getOutputStream().close(); + } + } catch (Exception e) { } + } + } } diff --git a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseStudentSigninLogQuery.java b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseStudentSigninLogQuery.java index fe3a4923..44dbf1b8 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseStudentSigninLogQuery.java +++ b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseStudentSigninLogQuery.java @@ -42,6 +42,22 @@ public class TeacherOpenCourseStudentSigninLogQuery extends PageParam { // 10 签到,20 缺勤 private SignInTypeEnum teacherOpenCourseStudentSigninLogTag; + public String getTeacherOpenCourseStudentSigninSettingIdPlural() { + return teacherOpenCourseStudentSigninSettingIdPlural; + } + + public void setTeacherOpenCourseStudentSigninSettingIdPlural(String teacherOpenCourseStudentSigninSettingIdPlural) { + this.teacherOpenCourseStudentSigninSettingIdPlural = teacherOpenCourseStudentSigninSettingIdPlural; + } + + public String getSchoolClassIdPlural() { + return schoolClassIdPlural; + } + + public void setSchoolClassIdPlural(String schoolClassIdPlural) { + this.schoolClassIdPlural = schoolClassIdPlural; + } + public static enum SignInTypeEnum { SIGN_IN(10, "签到"), UN_SIGN_IN(20, "缺勤"); @@ -65,7 +81,9 @@ public class TeacherOpenCourseStudentSigninLogQuery extends PageParam { private Long userId; private String teacherOpenCourseStudentSigninLogIdPlural; + private String teacherOpenCourseStudentSigninSettingIdPlural; private String studentIdPlural; + private String schoolClassIdPlural; private String teacherOpenCourseIdPlural; private String orgIdPlural; private String userIdPlural; diff --git a/web/src/main/resources/sql/jlw/teacherOpenCourseStudentSigninLog.md b/web/src/main/resources/sql/jlw/teacherOpenCourseStudentSigninLog.md index c2678866..33c06ed0 100644 --- a/web/src/main/resources/sql/jlw/teacherOpenCourseStudentSigninLog.md +++ b/web/src/main/resources/sql/jlw/teacherOpenCourseStudentSigninLog.md @@ -1,7 +1,6 @@ queryByCondition === * 根据不为空的参数进行分页查询 - select @pageTag(){ t.* @@ -13,14 +12,17 @@ queryByCondition @if(!isEmpty(teacherOpenCourseStudentSigninLogId)){ and t.teacher_open_course_student_signin_log_id =#teacherOpenCourseStudentSigninLogId# @} - @if(!isEmpty(teacherOpenCourseStudentSigninSettingSessionTime)){ - and t.teacher_open_course_student_signin_setting_session_time =#teacherOpenCourseStudentSigninSettingSessionTime# + @if(!isEmpty(teacherOpenCourseStudentSigninLogIdPlural)){ + and find_in_set(t.teacher_open_course_student_signin_log_id,#teacherOpenCourseStudentSigninLogIdPlural#) @} @if(!isEmpty(teacherOpenCourseStudentSigninSettingId)){ and t.teacher_open_course_student_signin_setting_id =#teacherOpenCourseStudentSigninSettingId# @} - @if(!isEmpty(teacherOpenCourseStudentSigninLogIdPlural)){ - and find_in_set(t.teacher_open_course_student_signin_log_id,#teacherOpenCourseStudentSigninLogIdPlural#) + @if(!isEmpty(teacherOpenCourseStudentSigninSettingIdPlural)){ + and find_in_set(t.teacher_open_course_student_signin_setting_id,#teacherOpenCourseStudentSigninSettingIdPlural#) + @} + @if(!isEmpty(teacherOpenCourseStudentSigninSettingSessionTime)){ + and t.teacher_open_course_student_signin_setting_session_time =#teacherOpenCourseStudentSigninSettingSessionTime# @} @if(!isEmpty(studentId)){ and t.student_id =#studentId# @@ -37,6 +39,9 @@ queryByCondition @if(!isEmpty(schoolClassId)){ and t.school_class_id =#schoolClassId# @} + @if(!isEmpty(schoolClassIdPlural)){ + and find_in_set(t.school_class_id,#schoolClassIdPlural#) + @} @if(!isEmpty(teacherOpenCourseStudentSigninLogAddTime)){ and t.teacher_open_course_student_signin_log_add_time =#teacherOpenCourseStudentSigninLogAddTime# @} @@ -69,7 +74,6 @@ queryByCondition queryByConditionQuery === * 根据不为空的参数进行分页查询(无权限) - select @pageTag(){ t.* @@ -79,14 +83,17 @@ queryByConditionQuery @if(!isEmpty(teacherOpenCourseStudentSigninLogId)){ and t.teacher_open_course_student_signin_log_id =#teacherOpenCourseStudentSigninLogId# @} - @if(!isEmpty(teacherOpenCourseStudentSigninSettingSessionTime)){ - and t.teacher_open_course_student_signin_setting_session_time =#teacherOpenCourseStudentSigninSettingSessionTime# + @if(!isEmpty(teacherOpenCourseStudentSigninLogIdPlural)){ + and find_in_set(t.teacher_open_course_student_signin_log_id,#teacherOpenCourseStudentSigninLogIdPlural#) @} @if(!isEmpty(teacherOpenCourseStudentSigninSettingId)){ and t.teacher_open_course_student_signin_setting_id =#teacherOpenCourseStudentSigninSettingId# @} - @if(!isEmpty(teacherOpenCourseStudentSigninLogIdPlural)){ - and find_in_set(t.teacher_open_course_student_signin_log_id,#teacherOpenCourseStudentSigninLogIdPlural#) + @if(!isEmpty(teacherOpenCourseStudentSigninSettingIdPlural)){ + and find_in_set(t.teacher_open_course_student_signin_setting_id,#teacherOpenCourseStudentSigninSettingIdPlural#) + @} + @if(!isEmpty(teacherOpenCourseStudentSigninSettingSessionTime)){ + and t.teacher_open_course_student_signin_setting_session_time =#teacherOpenCourseStudentSigninSettingSessionTime# @} @if(!isEmpty(studentId)){ and t.student_id =#studentId# @@ -103,6 +110,9 @@ queryByConditionQuery @if(!isEmpty(schoolClassId)){ and t.school_class_id =#schoolClassId# @} + @if(!isEmpty(schoolClassIdPlural)){ + and find_in_set(t.school_class_id,#schoolClassIdPlural#) + @} @if(!isEmpty(teacherOpenCourseStudentSigninLogAddTime)){ and t.teacher_open_course_student_signin_log_add_time =#teacherOpenCourseStudentSigninLogAddTime# @} @@ -132,30 +142,36 @@ queryByConditionQuery @} - - deleteTeacherOpenCourseStudentSigninLogByIds === - * 批量删除 - delete from teacher_open_course_student_signin_log where find_in_set(teacher_open_course_student_signin_log_id,#ids#) - getByIds === - -select * from teacher_open_course_student_signin_log where find_in_set(teacher_open_course_student_signin_log_id,#ids#) + select * from teacher_open_course_student_signin_log where find_in_set(teacher_open_course_student_signin_log_id,#ids#) updateGivenByIds === - * 批量更新指定字段,无论此字段是否有值 - update teacher_open_course_student_signin_log set + @if(contain("teacherOpenCourseStudentSigninSettingId",_given)){ + @if(isEmpty(teacherOpenCourseStudentSigninSettingId)){ + teacher_open_course_student_signin_setting_id = null , + @}else{ + teacher_open_course_student_signin_setting_id = #teacherOpenCourseStudentSigninSettingId# , + @} + @} + @if(contain("teacherOpenCourseStudentSigninSettingSessionTime",_given)){ + @if(isEmpty(teacherOpenCourseStudentSigninSettingSessionTime)){ + teacher_open_course_student_signin_setting_session_time = null , + @}else{ + teacher_open_course_student_signin_setting_session_time = #teacherOpenCourseStudentSigninSettingSessionTime# , + @} + @} @if(contain("studentId",_given)){ @if(isEmpty(studentId)){ student_id = null , @@ -170,13 +186,6 @@ updateGivenByIds teacher_open_course_id = #teacherOpenCourseId# , @} @} - @if(contain("teacherOpenCourseStudentSigninSettingSessionTime",_given)){ - @if(isEmpty(teacherOpenCourseStudentSigninSettingSessionTime)){ - teacher_open_course_student_signin_setting_session_time = null , - @}else{ - teacher_open_course_student_signin_setting_session_time = #teacherOpenCourseStudentSigninSettingSessionTime# , - @} - @} @if(contain("schoolClassId",_given)){ @if(isEmpty(schoolClassId)){ school_class_id = null , @@ -219,13 +228,6 @@ updateGivenByIds teacher_open_course_student_signin_log_tag = #teacherOpenCourseStudentSigninLogTag# , @} @} - @if(contain("teacherOpenCourseStudentSigninSettingId",_given)){ - @if(isEmpty(teacherOpenCourseStudentSigninSettingId)){ - teacher_open_course_student_signin_setting_id = null , - @}else{ - teacher_open_course_student_signin_setting_id = #teacherOpenCourseStudentSigninSettingId# , - @} - @} @if(contain("orgId",_given)){ @if(isEmpty(orgId)){ org_id = null , @@ -244,24 +246,21 @@ updateGivenByIds where find_in_set(teacher_open_course_student_signin_log_id,#teacherOpenCourseStudentSigninLogIdPlural#) - getTeacherOpenCourseStudentSigninLogValues === - * 根据不为空的参数进行查询 - select t.* from teacher_open_course_student_signin_log t where 1=1 @if(!isEmpty(teacherOpenCourseStudentSigninLogId)){ and t.teacher_open_course_student_signin_log_id =#teacherOpenCourseStudentSigninLogId# @} - @if(!isEmpty(teacherOpenCourseStudentSigninSettingSessionTime)){ - and t.teacher_open_course_student_signin_setting_session_time =#teacherOpenCourseStudentSigninSettingSessionTime# - @} @if(!isEmpty(teacherOpenCourseStudentSigninSettingId)){ and t.teacher_open_course_student_signin_setting_id =#teacherOpenCourseStudentSigninSettingId# @} + @if(!isEmpty(teacherOpenCourseStudentSigninSettingSessionTime)){ + and t.teacher_open_course_student_signin_setting_session_time =#teacherOpenCourseStudentSigninSettingSessionTime# + @} @if(!isEmpty(studentId)){ and t.student_id =#studentId# @} @@ -293,26 +292,27 @@ getTeacherOpenCourseStudentSigninLogValues and t.user_id =#userId# @} - + getValuesByQuery === - * 根据不为空的参数进行查询 - select t.* from teacher_open_course_student_signin_log t where 1=1 and #function("teacherOpenCourseStudentSigninLog.query")# @if(!isEmpty(teacherOpenCourseStudentSigninLogId)){ and t.teacher_open_course_student_signin_log_id =#teacherOpenCourseStudentSigninLogId# @} - @if(!isEmpty(teacherOpenCourseStudentSigninSettingSessionTime)){ - and t.teacher_open_course_student_signin_setting_session_time =#teacherOpenCourseStudentSigninSettingSessionTime# + @if(!isEmpty(teacherOpenCourseStudentSigninLogIdPlural)){ + and find_in_set(t.teacher_open_course_student_signin_log_id,#teacherOpenCourseStudentSigninLogIdPlural#) @} @if(!isEmpty(teacherOpenCourseStudentSigninSettingId)){ and t.teacher_open_course_student_signin_setting_id =#teacherOpenCourseStudentSigninSettingId# @} - @if(!isEmpty(teacherOpenCourseStudentSigninLogIdPlural)){ - and find_in_set(t.teacher_open_course_student_signin_log_id,#teacherOpenCourseStudentSigninLogIdPlural#) + @if(!isEmpty(teacherOpenCourseStudentSigninSettingIdPlural)){ + and find_in_set(t.teacher_open_course_student_signin_setting_id,#teacherOpenCourseStudentSigninSettingIdPlural#) + @} + @if(!isEmpty(teacherOpenCourseStudentSigninSettingSessionTime)){ + and t.teacher_open_course_student_signin_setting_session_time =#teacherOpenCourseStudentSigninSettingSessionTime# @} @if(!isEmpty(studentId)){ and t.student_id =#studentId# @@ -329,6 +329,9 @@ getValuesByQuery @if(!isEmpty(schoolClassId)){ and t.school_class_id =#schoolClassId# @} + @if(!isEmpty(schoolClassIdPlural)){ + and find_in_set(t.school_class_id,#schoolClassIdPlural#) + @} @if(!isEmpty(teacherOpenCourseStudentSigninLogAddTime)){ and t.teacher_open_course_student_signin_log_add_time =#teacherOpenCourseStudentSigninLogAddTime# @} @@ -360,24 +363,181 @@ getValuesByQuery getValuesByQueryNotWithPermission === - * 根据不为空的参数进行查询(不包含权限) - select t.* from teacher_open_course_student_signin_log t where 1=1 @if(!isEmpty(teacherOpenCourseStudentSigninLogId)){ and t.teacher_open_course_student_signin_log_id =#teacherOpenCourseStudentSigninLogId# @} + @if(!isEmpty(teacherOpenCourseStudentSigninLogIdPlural)){ + and find_in_set(t.teacher_open_course_student_signin_log_id,#teacherOpenCourseStudentSigninLogIdPlural#) + @} + @if(!isEmpty(teacherOpenCourseStudentSigninSettingId)){ + and t.teacher_open_course_student_signin_setting_id =#teacherOpenCourseStudentSigninSettingId# + @} + @if(!isEmpty(teacherOpenCourseStudentSigninSettingIdPlural)){ + and find_in_set(t.teacher_open_course_student_signin_setting_id,#teacherOpenCourseStudentSigninSettingIdPlural#) + @} @if(!isEmpty(teacherOpenCourseStudentSigninSettingSessionTime)){ and t.teacher_open_course_student_signin_setting_session_time =#teacherOpenCourseStudentSigninSettingSessionTime# @} + @if(!isEmpty(studentId)){ + and t.student_id =#studentId# + @} + @if(!isEmpty(studentIdPlural)){ + and find_in_set(t.student_id,#studentIdPlural#) + @} + @if(!isEmpty(teacherOpenCourseId)){ + and t.teacher_open_course_id =#teacherOpenCourseId# + @} + @if(!isEmpty(teacherOpenCourseIdPlural)){ + and find_in_set(t.teacher_open_course_id,#teacherOpenCourseIdPlural#) + @} + @if(!isEmpty(schoolClassId)){ + and t.school_class_id =#schoolClassId# + @} + @if(!isEmpty(schoolClassIdPlural)){ + and find_in_set(t.school_class_id,#schoolClassIdPlural#) + @} + @if(!isEmpty(teacherOpenCourseStudentSigninLogAddTime)){ + and t.teacher_open_course_student_signin_log_add_time =#teacherOpenCourseStudentSigninLogAddTime# + @} + @if(!isEmpty(teacherOpenCourseStudentSigninLogType)){ + and t.teacher_open_course_student_signin_log_type =#teacherOpenCourseStudentSigninLogType# + @} + @if(!isEmpty(teacherOpenCourseStudentSigninLogRemark)){ + and t.teacher_open_course_student_signin_log_remark =#teacherOpenCourseStudentSigninLogRemark# + @} + @if(!isEmpty(teacherOpenCourseStudentSigninLogIp)){ + and t.teacher_open_course_student_signin_log_ip =#teacherOpenCourseStudentSigninLogIp# + @} + @if(!isEmpty(teacherOpenCourseStudentSigninLogTag)){ + and t.teacher_open_course_student_signin_log_tag =#teacherOpenCourseStudentSigninLogTag# + @} + @if(!isEmpty(orgId)){ + and t.org_id =#orgId# + @} + @if(!isEmpty(orgIdPlural)){ + and find_in_set(t.org_id,#orgIdPlural#) + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + @if(!isEmpty(userIdPlural)){ + and find_in_set(t.user_id,#userIdPlural#) + @} + + +getExcelValues +=== +* 根据不为空的参数进行查询导入需要的参数 + SELECT * FROM ( + ( + select + MAX(LENGTH(t.teacher_open_course_student_signin_setting_id)) teacher_open_course_student_signin_setting_id, + MAX(LENGTH(t.teacher_open_course_student_signin_setting_session_time)) teacher_open_course_student_signin_setting_session_time, + MAX(LENGTH(t.student_id)) student_id, + MAX(LENGTH(t.teacher_open_course_id)) teacher_open_course_id, + MAX(LENGTH(t.school_class_id)) school_class_id, + MAX(LENGTH(t.teacher_open_course_student_signin_log_add_time)) teacher_open_course_student_signin_log_add_time, + MAX(LENGTH(t.teacher_open_course_student_signin_log_type)) teacher_open_course_student_signin_log_type, + MAX(LENGTH(t.teacher_open_course_student_signin_log_remark)) teacher_open_course_student_signin_log_remark, + MAX(LENGTH(t.teacher_open_course_student_signin_log_ip)) teacher_open_course_student_signin_log_ip, + MAX(LENGTH(t.teacher_open_course_student_signin_log_tag)) teacher_open_course_student_signin_log_tag + from teacher_open_course_student_signin_log t + where 1=1 and #function("teacherOpenCourseStudentSigninLog.query")# + @if(!isEmpty(teacherOpenCourseStudentSigninLogId)){ + and t.teacher_open_course_student_signin_log_id =#teacherOpenCourseStudentSigninLogId# + @} + @if(!isEmpty(teacherOpenCourseStudentSigninLogIdPlural)){ + and find_in_set(t.teacher_open_course_student_signin_log_id,#teacherOpenCourseStudentSigninLogIdPlural#) + @} @if(!isEmpty(teacherOpenCourseStudentSigninSettingId)){ and t.teacher_open_course_student_signin_setting_id =#teacherOpenCourseStudentSigninSettingId# @} + @if(!isEmpty(teacherOpenCourseStudentSigninSettingIdPlural)){ + and find_in_set(t.teacher_open_course_student_signin_setting_id,#teacherOpenCourseStudentSigninSettingIdPlural#) + @} + @if(!isEmpty(teacherOpenCourseStudentSigninSettingSessionTime)){ + and t.teacher_open_course_student_signin_setting_session_time =#teacherOpenCourseStudentSigninSettingSessionTime# + @} + @if(!isEmpty(studentId)){ + and t.student_id =#studentId# + @} + @if(!isEmpty(studentIdPlural)){ + and find_in_set(t.student_id,#studentIdPlural#) + @} + @if(!isEmpty(teacherOpenCourseId)){ + and t.teacher_open_course_id =#teacherOpenCourseId# + @} + @if(!isEmpty(teacherOpenCourseIdPlural)){ + and find_in_set(t.teacher_open_course_id,#teacherOpenCourseIdPlural#) + @} + @if(!isEmpty(schoolClassId)){ + and t.school_class_id =#schoolClassId# + @} + @if(!isEmpty(schoolClassIdPlural)){ + and find_in_set(t.school_class_id,#schoolClassIdPlural#) + @} + @if(!isEmpty(teacherOpenCourseStudentSigninLogAddTime)){ + and t.teacher_open_course_student_signin_log_add_time =#teacherOpenCourseStudentSigninLogAddTime# + @} + @if(!isEmpty(teacherOpenCourseStudentSigninLogType)){ + and t.teacher_open_course_student_signin_log_type =#teacherOpenCourseStudentSigninLogType# + @} + @if(!isEmpty(teacherOpenCourseStudentSigninLogRemark)){ + and t.teacher_open_course_student_signin_log_remark =#teacherOpenCourseStudentSigninLogRemark# + @} + @if(!isEmpty(teacherOpenCourseStudentSigninLogIp)){ + and t.teacher_open_course_student_signin_log_ip =#teacherOpenCourseStudentSigninLogIp# + @} + @if(!isEmpty(teacherOpenCourseStudentSigninLogTag)){ + and t.teacher_open_course_student_signin_log_tag =#teacherOpenCourseStudentSigninLogTag# + @} + @if(!isEmpty(orgId)){ + and t.org_id =#orgId# + @} + @if(!isEmpty(orgIdPlural)){ + and find_in_set(t.org_id,#orgIdPlural#) + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + @if(!isEmpty(userIdPlural)){ + and find_in_set(t.user_id,#userIdPlural#) + @} + ) + UNION ALL + ( + select + t.teacher_open_course_student_signin_setting_id , + t.teacher_open_course_student_signin_setting_session_time , + t.student_id , + t.teacher_open_course_id , + t.school_class_id , + t.teacher_open_course_student_signin_log_add_time , + t.teacher_open_course_student_signin_log_type , + t.teacher_open_course_student_signin_log_remark , + t.teacher_open_course_student_signin_log_ip , + t.teacher_open_course_student_signin_log_tag + from teacher_open_course_student_signin_log t + where 1=1 and #function("teacherOpenCourseStudentSigninLog.query")# + @if(!isEmpty(teacherOpenCourseStudentSigninLogId)){ + and t.teacher_open_course_student_signin_log_id =#teacherOpenCourseStudentSigninLogId# + @} @if(!isEmpty(teacherOpenCourseStudentSigninLogIdPlural)){ and find_in_set(t.teacher_open_course_student_signin_log_id,#teacherOpenCourseStudentSigninLogIdPlural#) @} + @if(!isEmpty(teacherOpenCourseStudentSigninSettingId)){ + and t.teacher_open_course_student_signin_setting_id =#teacherOpenCourseStudentSigninSettingId# + @} + @if(!isEmpty(teacherOpenCourseStudentSigninSettingIdPlural)){ + and find_in_set(t.teacher_open_course_student_signin_setting_id,#teacherOpenCourseStudentSigninSettingIdPlural#) + @} + @if(!isEmpty(teacherOpenCourseStudentSigninSettingSessionTime)){ + and t.teacher_open_course_student_signin_setting_session_time =#teacherOpenCourseStudentSigninSettingSessionTime# + @} @if(!isEmpty(studentId)){ and t.student_id =#studentId# @} @@ -393,6 +553,9 @@ getValuesByQueryNotWithPermission @if(!isEmpty(schoolClassId)){ and t.school_class_id =#schoolClassId# @} + @if(!isEmpty(schoolClassIdPlural)){ + and find_in_set(t.school_class_id,#schoolClassIdPlural#) + @} @if(!isEmpty(teacherOpenCourseStudentSigninLogAddTime)){ and t.teacher_open_course_student_signin_log_add_time =#teacherOpenCourseStudentSigninLogAddTime# @} @@ -420,6 +583,5 @@ getValuesByQueryNotWithPermission @if(!isEmpty(userIdPlural)){ and find_in_set(t.user_id,#userIdPlural#) @} - - - + ) + )t \ No newline at end of file diff --git a/web/src/main/resources/static/js/jlw/teacherOpenCourseStudentSigninLog/index.js b/web/src/main/resources/static/js/jlw/teacherOpenCourseStudentSigninLog/index.js index 983cbcfd..da6ff2c6 100644 --- a/web/src/main/resources/static/js/jlw/teacherOpenCourseStudentSigninLog/index.js +++ b/web/src/main/resources/static/js/jlw/teacherOpenCourseStudentSigninLog/index.js @@ -159,6 +159,25 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { Lib.doSearchForm($("#searchForm"), teacherOpenCourseStudentSigninLogTable, 1); view.initToolBar() }, + exportDocument: function () { + layui.use([ 'teacherOpenCourseStudentSigninLogApi' ], function() { + debugger + var teacherOpenCourseStudentSigninLogApi = layui.teacherOpenCourseStudentSigninLogApi + Common.openConfirm("确认要导出这些TeacherOpenCourseStudentSigninLog数据?", function() { + teacherOpenCourseStudentSigninLogApi.exportExcel($("#searchForm"), function(fileId) { + // Lib.download(fileId); + }) + }) + }); + }, + importDocument: function () { + var uploadUrl = Common.ctxPath+"/jlw/teacherOpenCourseStudentSigninLog/importTemplate.json"; + //模板, + var templatePath= Common.ctxPath+"/jlw/teacherOpenCourseStudentSigninLog/downloadTemplate.json"; + //公共的简单上传文件处理 + var url = "/core/file/simpleUpload.do?uploadUrl="+uploadUrl+"&templatePath="+templatePath; + Common.openDlg(url, "TeacherOpenCourseStudentSigninLog管理>上传"); + } } //触发事件 $('.ext-toolbar').on('click', function() { diff --git a/web/src/main/resources/static/js/jlw/teacherOpenCourseStudentSigninLog/teacherOpenCourseStudentSigninLogApi.js b/web/src/main/resources/static/js/jlw/teacherOpenCourseStudentSigninLog/teacherOpenCourseStudentSigninLogApi.js index c6618d0d..4383f176 100644 --- a/web/src/main/resources/static/js/jlw/teacherOpenCourseStudentSigninLog/teacherOpenCourseStudentSigninLogApi.js +++ b/web/src/main/resources/static/js/jlw/teacherOpenCourseStudentSigninLog/teacherOpenCourseStudentSigninLogApi.js @@ -11,6 +11,10 @@ layui.define([], function(exports) { Common.post("/jlw/teacherOpenCourseStudentSigninLog/delete.json",{"ids":ids},function(){ callback(); }) + }, + exportExcel:function(form,extendData, callback){ + var formPara = form.serializeJson(); + Common.downLoad("/jlw/teacherOpenCourseStudentSigninLog/excel/export.json", {...formPara, ...extendData}, 'POST') } }; diff --git a/web/src/main/resources/templates/jlw/teacherOpenCourseStudentSigninLog/index.html b/web/src/main/resources/templates/jlw/teacherOpenCourseStudentSigninLog/index.html index 30869396..4de0aa2d 100644 --- a/web/src/main/resources/templates/jlw/teacherOpenCourseStudentSigninLog/index.html +++ b/web/src/main/resources/templates/jlw/teacherOpenCourseStudentSigninLog/index.html @@ -7,6 +7,8 @@