fix 导出公公方法

beetlsql3-dev
Mlxa0324 2 years ago
parent d3db44ece7
commit 5fb056b574

@ -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);
// })
}
@}

@ -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 = $('<form method="'+ method +'" action="' + Common.ctxPath + url + '">');
$.each(data, function (k, v) {
form.append($('<input type="hidden" name="' + k +
'" value="' + v + '">'));
});
$('body').append(form);
form.submit(); //自动提交
},
getOneFromTable: function (layuiTable, tableId) {
var checkStatus = layuiTable.checkStatus(tableId)
, data = checkStatus.data;

@ -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<Teacher
List<TeacherOpenCourseStudentSigninLog> getByIds(String ids);
List<TeacherOpenCourseStudentSigninLog> getValuesByQuery(TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery);
List<TeacherOpenCourseStudentSigninLog> getValuesByQueryNotWithPermission(TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery);
List<Map<String, Object>> getExcelValues(TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery);
}

@ -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<Te
add(signinLogQuery);
}
/**
*
* TODO mlx
* @param query
* @return
*/
public Object signinLog(TeacherOpenCourseStudentSigninLogQuery query) {
throw new PlatformException("签到日志接口未实现!");
public JsonResult importTemplate(List<FileEntity> fileEntityList, List<Long>list, CoreUser coreUser){
List<String[]>errMsg = new ArrayList<>();
String msg ="";
int count = 0;
Date date = new Date();
for(int item=0;null != fileEntityList && item<fileEntityList.size();item++){
FileEntity fileEntity = fileEntityList.get(item);
if(null != fileEntity){
File file = new File(fileEntity.getAbsoluteUrl());
if(file.exists() && file.isFile() && file.canRead() && ToolUtils.findInSet("xls,xlsx",fileEntity.getFormat())){
Workbook wb = null;
InputStream is = null;
try {
is = new FileInputStream(fileEntity.getAbsoluteUrl());
if("xls".equals(fileEntity.getFormat())){
wb = new HSSFWorkbook(is);
}else if("xlsx".equals(fileEntity.getFormat())){
wb = new XSSFWorkbook(is);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
if(null != is){
is.close();
}
}catch (Exception e){
e.printStackTrace();
}
if(wb != null){
//获取Sheet1
Sheet sheet = wb.getSheet("Sheet1");
//获取最大行数
int rowNum = sheet.getPhysicalNumberOfRows();
//获取第一行
Row firstRow = sheet.getRow(0);
//获取最大列数
int colNum = firstRow.getPhysicalNumberOfCells();
String columns[] = {
"签到配置",
"场次时间",
"学生",
"开课",
"班级",
"签到日期",
"签到方式 ",
"备注",
"签到的IP",
"标记 10签到 20缺勤",
};
Map<String,Integer> map = new HashMap<>();//获取需要的表头的列
//从第一列找到需要的表头
for (int i=0; i<colNum; i++){
String cellData = getCellFormatValue(firstRow.getCell(i));
for(int j=0;j<columns.length;j++){
if(columns[j].equals(cellData)){
map.put(columns[j],i);
}
}
}
//验证所需要的表头是否全
Integer flag = 0;
for(int i=0;i<columns.length;i++){
if(null != map.get(columns[i])){
flag ++;
}
}
if(flag != columns.length){
String str = " ";
for(int i=0;i<columns.length;i++){
str += "\""+columns[i]+"\""+(i == columns.length-1?"":", ");
}
return JsonResult.failMessage("导入失败,表格表头应包含"+str);
}
for (int i = 1; i<rowNum; i++) {
Row row = sheet.getRow(i);
if(null == row){
errMsg.add(new String[]{"第"+(i+1)+"数据为空"});
continue;
}
String teacherOpenCourseStudentSigninSettingId = getCellFormatValue(row.getCell(map.get(columns[0])));
String teacherOpenCourseStudentSigninSettingSessionTime = getCellFormatValue(row.getCell(map.get(columns[1])));
String studentId = getCellFormatValue(row.getCell(map.get(columns[2])));
String teacherOpenCourseId = getCellFormatValue(row.getCell(map.get(columns[3])));
String schoolClassId = getCellFormatValue(row.getCell(map.get(columns[4])));
String teacherOpenCourseStudentSigninLogAddTime = getCellFormatValue(row.getCell(map.get(columns[5])));
String teacherOpenCourseStudentSigninLogType = getCellFormatValue(row.getCell(map.get(columns[6])));
String teacherOpenCourseStudentSigninLogRemark = getCellFormatValue(row.getCell(map.get(columns[7])));
String teacherOpenCourseStudentSigninLogIp = getCellFormatValue(row.getCell(map.get(columns[8])));
String teacherOpenCourseStudentSigninLogTag = getCellFormatValue(row.getCell(map.get(columns[9])));
//TODO 判断(如重复等复杂判断要额外写)
if(StringUtils.isBlank(teacherOpenCourseStudentSigninSettingId)){
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[0])+1)+"列,第"+(i+1)+"行签到配置为空"});
continue;
}else
if(StringUtils.isBlank(teacherOpenCourseStudentSigninSettingSessionTime)){
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[1])+1)+"列,第"+(i+1)+"行场次时间为空"});
continue;
}else
if(StringUtils.isBlank(studentId)){
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[2])+1)+"列,第"+(i+1)+"行学生为空"});
continue;
}else
if(StringUtils.isBlank(teacherOpenCourseId)){
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[3])+1)+"列,第"+(i+1)+"行开课为空"});
continue;
}else
if(StringUtils.isBlank(schoolClassId)){
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[4])+1)+"列,第"+(i+1)+"行班级为空"});
continue;
}else
if(StringUtils.isBlank(teacherOpenCourseStudentSigninLogAddTime)){
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[5])+1)+"列,第"+(i+1)+"行签到日期为空"});
continue;
}else
if(StringUtils.isBlank(teacherOpenCourseStudentSigninLogType)){
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[6])+1)+"列,第"+(i+1)+"行签到方式 为空"});
continue;
}else
if(StringUtils.isBlank(teacherOpenCourseStudentSigninLogRemark)){
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[7])+1)+"列,第"+(i+1)+"行备注为空"});
continue;
}else
if(StringUtils.isBlank(teacherOpenCourseStudentSigninLogIp)){
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[8])+1)+"列,第"+(i+1)+"行签到的IP为空"});
continue;
}else
if(StringUtils.isBlank(teacherOpenCourseStudentSigninLogTag)){
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[9])+1)+"列,第"+(i+1)+"行标记 10签到 20缺勤为空"});
continue;
}else
{
//TODO 保存
TeacherOpenCourseStudentSigninLog teacherOpenCourseStudentSigninLog = new TeacherOpenCourseStudentSigninLog();
teacherOpenCourseStudentSigninLog.setTeacherOpenCourseStudentSigninSettingId(Long.parseLong(teacherOpenCourseStudentSigninSettingId));
teacherOpenCourseStudentSigninLog.setTeacherOpenCourseStudentSigninSettingSessionTime(TimeTool.getTime(teacherOpenCourseStudentSigninSettingSessionTime));
teacherOpenCourseStudentSigninLog.setStudentId(Long.parseLong(studentId));
teacherOpenCourseStudentSigninLog.setTeacherOpenCourseId(Long.parseLong(teacherOpenCourseId));
teacherOpenCourseStudentSigninLog.setSchoolClassId(Long.parseLong(schoolClassId));
teacherOpenCourseStudentSigninLog.setTeacherOpenCourseStudentSigninLogAddTime(TimeTool.getTime(teacherOpenCourseStudentSigninLogAddTime));
teacherOpenCourseStudentSigninLog.setTeacherOpenCourseStudentSigninLogType(teacherOpenCourseStudentSigninLogType);
teacherOpenCourseStudentSigninLog.setTeacherOpenCourseStudentSigninLogRemark(teacherOpenCourseStudentSigninLogRemark);
teacherOpenCourseStudentSigninLog.setTeacherOpenCourseStudentSigninLogIp(teacherOpenCourseStudentSigninLogIp);
teacherOpenCourseStudentSigninLog.setTeacherOpenCourseStudentSigninLogTag(EnumUtil
.likeValueOf(TeacherOpenCourseStudentSigninLogQuery.SignInTypeEnum.class, teacherOpenCourseStudentSigninLogTag));
teacherOpenCourseStudentSigninLog.setOrgId(coreUser.getOrgId());
teacherOpenCourseStudentSigninLog.setUserId(coreUser.getId());
count++;
}
}
}
}
}
}
JsonResult jsonResult = new JsonResult();
jsonResult.setCode(count>0?JsonReturnCode.SUCCESS.getCode():JsonReturnCode.FAIL.getCode());
jsonResult.setData(errMsg);
jsonResult.setMsg((count>0?"导入成功,共导入"+count+"条":"导入失败")+(StringUtils.isNotBlank(msg)?"<br>"+msg:""));
return jsonResult;
}
public List<Map<String,Object>> getExcelValues (TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery){
return teacherOpenCourseStudentSigninLogDao.getExcelValues(teacherOpenCourseStudentSigninLogQuery);
}
}

@ -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<FileEntity> fileEntityList, @SCoreUser CoreUser coreUser) {
if(null == coreUser){
return JsonResult.failMessage("请登录后再操作");
}
List<Long>list=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<Map<String, Object>> mapList = teacherOpenCourseStudentSigninLogService.getExcelValues(teacherOpenCourseStudentSigninLogQuery);
//内容宽度
Map<String, Object> 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<String, Object> 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) { }
}
}
}

@ -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;

@ -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

@ -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() {

@ -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')
}
};

@ -7,6 +7,8 @@
<script type="text/html" id="toolbar_teacherOpenCourseStudentSigninLog">
<div class="layui-btn-container">
<div class="layui-btn-group" >
<layui:accessButton function="teacherOpenCourseStudentSigninLog.exportDocument" action="exportDocument" class="layui-btn-warm"><span
class="iconfont">&#xe8c7;</span>导出</layui:accessButton>
<!--# if(core.searchIsShow(search)) {-->
<layui:accessButton function="teacherOpenCourseStudentSigninLog.query" id="searchFormSearch" action="search"><i class="layui-icon">&#xe615;</i>搜索</layui:accessButton>
<!--# }-->

Loading…
Cancel
Save