Merge remote-tracking branch 'origin/beetlsql3-dev' into beetlsql3-dev
commit
6a5435dba2
@ -0,0 +1,35 @@
|
|||||||
|
package com.ibeetl.jlw.entity.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述: <br>
|
||||||
|
* 行列信息
|
||||||
|
*
|
||||||
|
* @author: mlx
|
||||||
|
* @description:
|
||||||
|
* @date: 2023/2/14 13:56
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BaseExcelInfoDTO {
|
||||||
|
|
||||||
|
private Map<String, BaseExcelIndexDTO> indexMap = new HashMap<>();
|
||||||
|
|
||||||
|
public interface BaseExcelIndexDTO {
|
||||||
|
/**
|
||||||
|
* 获取行索引 + 1
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer getRowIndex();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取列索引 + 1
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer getColIndex();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,99 @@
|
|||||||
|
package com.ibeetl.jlw.entity.dto;
|
||||||
|
|
||||||
|
import com.ibeetl.admin.core.util.excelGroupValidation.ExcelFile;
|
||||||
|
import com.ibeetl.admin.core.util.excelGroupValidation.ExcelValidation;
|
||||||
|
import com.ibeetl.jlw.entity.Teacher;
|
||||||
|
import com.ibeetl.jlw.enums.GenderEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.FieldNameConstants;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import static cn.jlw.util.excel.ExcelUtil.longValuesOf;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述: <br>
|
||||||
|
* 学生管理, 导入实体
|
||||||
|
*
|
||||||
|
* @Author: lx
|
||||||
|
* @Date: 2023/2/5 23:50
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@FieldNameConstants
|
||||||
|
@ToString
|
||||||
|
@ExcelFile(fileHeadTemplate = "universitiesCollegesId|universityFacultyId|universitySystemId|teacherName|teacherSn|teacherMobile|teacherEmail",
|
||||||
|
fileMappingTemplate = "universitiesCollegesId=院校名称|universityFacultyId=院系名称|universitySystemId=专业名称|" +
|
||||||
|
"teacherName=教师姓名|teacherJobNumber=工号|teacherMobile=电话|teacherEmail=邮箱",
|
||||||
|
datasheetHidden = true, enableDataValidation = true)
|
||||||
|
public class TeacherBatchImportDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 院校名称
|
||||||
|
*/
|
||||||
|
@ExcelValidation(datasourceMethod = "com.ibeetl.jlw.service.UniversitiesCollegesService.getAllUniversitiesColleges")
|
||||||
|
private String universitiesCollegesId ;
|
||||||
|
/**
|
||||||
|
* 院系名称
|
||||||
|
*/
|
||||||
|
@ExcelValidation(datasourceMethod = "com.ibeetl.jlw.service.UniversityFacultyService.getAllUniversityFacultyWithColleges", beforeFieldName = "universitiesCollegesId")
|
||||||
|
private String universityFacultyId ;
|
||||||
|
/**
|
||||||
|
* 专业名称
|
||||||
|
*/
|
||||||
|
@ExcelValidation(datasourceMethod = "com.ibeetl.jlw.service.UniversitySystemService.getAllUniversitiesCollegesWithFaculty", beforeFieldName = "universityFacultyId")
|
||||||
|
private String universitySystemId ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 教师姓名
|
||||||
|
*/
|
||||||
|
private String teacherName ;
|
||||||
|
/**
|
||||||
|
* 工号
|
||||||
|
*/
|
||||||
|
private String teacherJobNumber ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电话
|
||||||
|
*/
|
||||||
|
private String teacherMobile ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String teacherEmail ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型转换
|
||||||
|
*
|
||||||
|
* @param importPojo 导入的数据
|
||||||
|
* @param function 二次加工
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Teacher pojo(TeacherBatchImportDTO importPojo, Function<Teacher, Teacher> function) {
|
||||||
|
Teacher build = Teacher.builder()
|
||||||
|
.universitiesCollegesId(longValuesOf(importPojo.getUniversitiesCollegesId()))
|
||||||
|
.universityFacultyId(longValuesOf(importPojo.getUniversityFacultyId()))
|
||||||
|
.universitySystemId(longValuesOf(importPojo.getUniversitySystemId()))
|
||||||
|
.teacherJobNumber(importPojo.getTeacherJobNumber())
|
||||||
|
.teacherStatus(1)
|
||||||
|
.teacherGender(GenderEnum.UN_KNOW)
|
||||||
|
.teacherPassword("123qwe")
|
||||||
|
.addTime(new Date())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return function.apply(build);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型转换
|
||||||
|
*
|
||||||
|
* @param importPojo 导入的数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Teacher pojo(TeacherBatchImportDTO importPojo) {
|
||||||
|
return pojo(importPojo, e -> e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue