在学生信息和我的学生增加一个导出按钮,导出学生填写的所有基本信息

This commit is contained in:
2026-02-28 17:56:30 +08:00
parent 1fe293610e
commit 7b72d6dbcd
6 changed files with 469 additions and 1 deletions

View File

@@ -16,10 +16,12 @@ import com.srs.common.utils.StringUtils;
import com.srs.comprehensive.domain.Dto.StuDataSelcetDto;
import com.srs.comprehensive.domain.Dto.StuStatusImport;
import com.srs.comprehensive.domain.SrsStudent;
import com.srs.comprehensive.domain.CphStudentDetailExport;
import com.srs.comprehensive.domain.Vo.*;
import com.srs.comprehensive.service.ICascaderDataStudentService;
import com.srs.comprehensive.service.ISrsStudentService;
import com.srs.comprehensive.service.ICphStudentDetailExportService;
import com.srs.system.domain.vo.StuStatus;
import com.srs.system.service.ISysPostService;
import com.srs.web.controller.common.RoleBool;
@@ -52,8 +54,12 @@ import org.springframework.web.multipart.MultipartFile;
public class SrsStudentController extends BaseController {
@Autowired
private ISrsStudentService srsStudentService;
@Resource
@Autowired
private ICascaderDataStudentService cascaderDataStudentService;
@Autowired
private ICphStudentDetailExportService cphStudentDetailExportService;
@Autowired
ISysPostService _postService;
@@ -334,6 +340,31 @@ public class SrsStudentController extends BaseController {
util.exportExcel(response, list, "学生信息数据");
}
/**
* 导出全部学生信息(包含查新详情)
*/
//@PreAuthorize("@ss.hasPermi('system:student:exportAll')")
@Log(title = "学生信息", businessType = BusinessType.EXPORT)
@PostMapping("/exportAll")
public void exportAll(HttpServletResponse response, SrsStudent srsStudent) {
List<CphStudentDetailExport> list = cphStudentDetailExportService.getStudentDetailExportList(srsStudent);
ExcelUtil<CphStudentDetailExport> util = new ExcelUtil<CphStudentDetailExport>(CphStudentDetailExport.class);
util.exportExcel(response, list, "学生查新详情数据");
}
/**
* 在我的学生页面导出学生信息
*/
//@PreAuthorize("@ss.hasPermi('system:student:exportAllOwnStu')")
@Log(title = "学生信息", businessType = BusinessType.EXPORT)
@PostMapping("/exportAllOwnStu")
public void exportAllOwnStu(HttpServletResponse response, SrsStudent srsStudent) {
srsStudent.tNo = getUsername();
List<CphStudentDetailExport> list = cphStudentDetailExportService.getStudentDetailExportList(srsStudent);
ExcelUtil<CphStudentDetailExport> util = new ExcelUtil<CphStudentDetailExport>(CphStudentDetailExport.class);
util.exportExcel(response, list, "学生查新详情数据");
}
/**
* 下载导入模板
*

View File

@@ -0,0 +1,127 @@
package com.srs.comprehensive.domain;
import com.srs.common.annotation.Excel;
import com.srs.common.annotation.Excels;
import com.srs.common.core.domain.entity.SysDept;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 学生查新详情导出实体类
* 包含重要信息、其他信息、家庭成员、教育经历
*/
@Data
public class CphStudentDetailExport {
/** 基本信息 */
@Excel(name = "学号")
private String stuNo;
@Excel(name = "姓名")
private String name;
@Excel(name = "性别")
private String gender;
@Excel(name = "身份证号码")
private String idCard;
@Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd")
private Date birthday;
@Excel(name = "手机号码")
private String phone;
@Excel(name = "银行卡")
private String xhk;
@Excel(name = "开户行")
private String bankAddr;
/** 班级专业信息 */
@Excel(name = "班级名称")
private String className;
@Excel(name = "专业名称")
private String majorName;
@Excel(name = "学院名称")
private String deptName;
@Excel(name = "年级")
private String gradeName;
@Excel(name = "辅导员姓名")
private String teacherName;
/** 其他信息 */
@Excel(name = "民族")
private String mz;
@Excel(name = "政治面貌")
private String zzmm;
@Excel(name = "血型")
private String xx;
@Excel(name = "考生号")
private String ksh;
@Excel(name = "籍贯")
private String jg;
@Excel(name = "户口所在地")
private String hkszd;
@Excel(name = "户口所在省")
private String hksz1;
@Excel(name = "户口所在市/区")
private String hksz2;
@Excel(name = "户口所在区/县")
private String hksz3;
@Excel(name = "户口性质")
private String hkxz;
@Excel(name = "户口所在地区县以下详细地址")
private String hkxxdz;
/*@Excel(name = "学生居住地址")
private String xsjzdz;*/
@Excel(name = "所属派出所")
private String sspcs;
@Excel(name = "所属街道")
private String ssjd;
@Excel(name = "乘火车区间")
private String chcqj;
@Excel(name = "详细联系地址")
private String xxlxdz;
/*@Excel(name = "邮政编码")
private String yzbm;*/
@Excel(name = "现家庭地址")
private String xjtdz;
@Excel(name = "家庭邮政编码")
private String jtyzbm;
@Excel(name = "家庭电话")
private String jtdh;
/** 家庭成员信息 */
@Excel(name = "家庭成员信息", width = 100)
private String familyMembers;
/** 教育经历信息 */
@Excel(name = "教育经历信息", width = 100)
private String educationExperiences;
}

View File

@@ -0,0 +1,32 @@
package com.srs.comprehensive.mapper;
import com.srs.comprehensive.domain.CphStudentDetailExport;
import com.srs.comprehensive.domain.SrsStudent;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 学生查新详情导出Mapper接口
*/
@Mapper
public interface CphStudentDetailExportMapper {
/**
* 查询学生查新详情导出列表
*
* @param srsStudent 学生信息
* @return 学生查新详情导出列表
*/
List<CphStudentDetailExport> selectStudentDetailExportList(SrsStudent srsStudent);
/**
* 根据学号查询学生查新详情导出信息
*
* @param stuNo 学号
* @return 学生查新详情导出信息
*/
CphStudentDetailExport selectStudentDetailExportByStuNo(@Param("stuNo") String stuNo);
}

View File

@@ -0,0 +1,25 @@
package com.srs.comprehensive.service;
import com.srs.comprehensive.domain.CphStudentDetailExport;
import com.srs.comprehensive.domain.SrsStudent;
import java.util.List;
/**
* 学生查新详情导出服务接口
*/
public interface ICphStudentDetailExportService {
/**
* 根据查询条件获取学生查新详情列表
* @param srsStudent 查询条件
* @return 学生查新详情列表
*/
List<CphStudentDetailExport> getStudentDetailExportList(SrsStudent srsStudent);
/**
* 根据学号获取学生查新详情
* @param stuNo 学号
* @return 学生查新详情
*/
CphStudentDetailExport getStudentDetailExportByStuNo(String stuNo);
}

View File

@@ -0,0 +1,32 @@
package com.srs.comprehensive.service.impl;
import com.srs.comprehensive.domain.CphStudentDetailExport;
import com.srs.comprehensive.domain.SrsStudent;
import com.srs.comprehensive.mapper.CphStudentDetailExportMapper;
import com.srs.comprehensive.service.ICphStudentDetailExportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 学生查新详情导出服务实现类
*/
@Service
public class CphStudentDetailExportServiceImpl implements ICphStudentDetailExportService {
@Autowired
private CphStudentDetailExportMapper cphStudentDetailExportMapper;
@Override
public List<CphStudentDetailExport> getStudentDetailExportList(SrsStudent srsStudent) {
// 直接调用Mapper查询使用SQL聚合处理数据
return cphStudentDetailExportMapper.selectStudentDetailExportList(srsStudent);
}
@Override
public CphStudentDetailExport getStudentDetailExportByStuNo(String stuNo) {
// 直接调用Mapper查询使用SQL聚合处理数据
return cphStudentDetailExportMapper.selectStudentDetailExportByStuNo(stuNo);
}
}

View File

@@ -0,0 +1,221 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.srs.comprehensive.mapper.CphStudentDetailExportMapper">
<!-- 学生查新详情导出结果映射 -->
<resultMap type="CphStudentDetailExport" id="CphStudentDetailExportResult">
<!-- 基本信息 -->
<result property="stuNo" column="stu_no"/>
<result property="name" column="name"/>
<result property="gender" column="gender"/>
<result property="idCard" column="id_card"/>
<result property="birthday" column="birthday"/>
<result property="phone" column="phone"/>
<result property="xhk" column="xhk"/>
<result property="bankAddr" column="bank_addr"/>
<!-- 班级专业信息 -->
<result property="className" column="class_name"/>
<result property="majorName" column="major_name"/>
<result property="deptName" column="dept_name"/>
<result property="gradeName" column="grade_name"/>
<result property="teacherName" column="teacher_name"/>
<!-- 其他信息 -->
<result property="mz" column="mz"/>
<result property="zzmm" column="zzmm"/>
<result property="xx" column="xx"/>
<result property="ksh" column="ksh"/>
<result property="jg" column="jg"/>
<result property="hkszd" column="hkszd"/>
<result property="hksz1" column="hksz1"/>
<result property="hksz2" column="hksz2"/>
<result property="hksz3" column="hksz3"/>
<result property="hkxz" column="hkxz"/>
<result property="hkxxdz" column="hkxxdz"/>
<result property="sspcs" column="sspcs"/>
<result property="ssjd" column="ssjd"/>
<result property="chcqj" column="chcqj"/>
<result property="xxlxdz" column="xxlxdz"/>
<result property="xjtdz" column="xjtdz"/>
<result property="jtyzbm" column="jtyzbm"/>
<result property="jtdh" column="jtdh"/>
<!-- 家庭成员信息使用MySQL的GROUP_CONCAT函数聚合 -->
<result property="familyMembers" column="family_members"/>
<!-- 教育经历信息使用MySQL的GROUP_CONCAT函数聚合 -->
<result property="educationExperiences" column="education_experiences"/>
</resultMap>
<!-- 查询学生查新详情导出数据 -->
<select id="selectStudentDetailExportList" parameterType="SrsStudent" resultMap="CphStudentDetailExportResult">
SELECT
s.stu_no,
s.name,
s.gender,
AES_DECRYPT(UNHEX(s.id_card), 'zhxg') as id_card,
s.birthday,
s.phone,
s.xhk,
s.bank_addr,
c.class_name,
m.major_name,
d.dept_name,
f.grade_name,
e.name as teacher_name,
g.mz,
g.zzmm,
g.xx,
g.ksh,
g.jg,
g.hkszd,
g.hkxz,
g.hkxxdz,
g.hksz1,
g.hksz2,
g.hksz3,
g.sspcs,
g.ssjd,
g.chcqj,
g.xxlxdz,
g.xjtdz,
g.jtyzbm,
g.jtdh,
-- 聚合家庭成员信息使用DISTINCT避免重复
GROUP_CONCAT(
DISTINCT CONCAT(
'姓名: ', fm.family_name,
',关系: ', fm.family_relation,
',年龄: ', fm.age,
',政治面貌: ', fm.zzmm,
',职业: ', fm.job,
',工作单位: ', fm.work_place,
',年收入: ', COALESCE(fm.year_money, ''),
',联系方式: ', fm.phone,
',健康状况: ', fm.health
) SEPARATOR '\n'
) as family_members,
-- 聚合教育经历信息使用DISTINCT避免重复
GROUP_CONCAT(
DISTINCT CONCAT(
'开始时间: ', DATE_FORMAT(ee.start_time, '%Y-%m-%d'),
',结束时间: ', DATE_FORMAT(ee.end_time, '%Y-%m-%d'),
',学校: ', ee.school_name,
',职务: ', ee.post,
',证明人: ', ee.certifier
) SEPARATOR '\n'
) as education_experiences
FROM srs_student s
LEFT JOIN srs_class c ON s.class_id = c.class_id
LEFT JOIN srs_majors m ON c.major_id = m.major_id
LEFT JOIN sys_dept d ON m.college_id = d.dept_id
LEFT JOIN cph_teacher e ON c.teacher_id = e.teacher_id
LEFT JOIN srs_grade f ON f.grade_id = c.grade_id
LEFT JOIN cph_stu_extra_info g ON g.stu_no = s.stu_no
LEFT JOIN cph_family_member fm ON fm.stu_no = s.stu_no
LEFT JOIN srs_education_experience ee ON ee.stu_no = s.stu_no
<where>
<if test="stuNo != null and stuNo != ''">and s.stu_no like concat('%', #{stuNo}, '%')</if>
<if test="name != null and name != ''">and s.name like concat('%', #{name}, '%')</if>
<if test="gender != null and gender != ''">and s.gender = #{gender}</if>
<if test="birthday != null ">and s.birthday = #{birthday}</if>
<if test="idCard != null and idCard != ''">and s.id_card = #{idCard}</if>
<if test="deptId != null ">and d.dept_id = #{deptId}</if>
<if test="majorId != null ">and m.major_id = #{majorId}</if>
<if test="classId != null ">and s.class_id = #{classId}</if>
<if test="phone != null and phone != ''">and s.phone like concat('%', #{phone} , '%')</if>
<if test="address != null and address != ''">and s.address like concat('%', #{address} , '%')</if>
<if test="status != null and status != ''">and s.status = #{status}</if>
<if test="tNo != null and tNo != ''">and e.employee_id = #{tNo}</if>
<if test="gradeId != null">and c.grade_id = #{gradeId}</if>
<if test="cphName != null and cphName!=''">and e.name = #{cphName}</if>
</where>
GROUP BY s.stu_no
ORDER BY s.stu_no desc
</select>
<!-- 根据学号查询学生查新详情导出数据 -->
<select id="selectStudentDetailExportByStuNo" parameterType="String" resultMap="CphStudentDetailExportResult">
SELECT
s.stu_no,
s.name,
s.gender,
AES_DECRYPT(UNHEX(s.id_card), 'zhxg') as id_card,
s.birthday,
s.phone,
s.xhk,
s.bank_addr,
c.class_name,
m.major_name,
d.dept_name,
f.grade_name,
e.name as teacher_name,
g.mz,
g.zzmm,
g.xx,
g.ksh,
g.jg,
g.hkszd,
g.hkxz,
g.hkxxdz,
g.hksz1,
g.hksz2,
g.hksz3,
g.sspcs,
g.ssjd,
g.chcqj,
g.xxlxdz,
g.xjtdz,
g.jtyzbm,
g.jtdh,
-- 聚合家庭成员信息使用DISTINCT避免重复
GROUP_CONCAT(
DISTINCT CONCAT(
'姓名: ', fm.family_name,
',关系: ', fm.family_relation,
',年龄: ', fm.age,
',政治面貌: ', fm.zzmm,
',职业: ', fm.job,
',工作单位: ', fm.work_place,
',年收入: ', COALESCE(fm.year_money, ''),
',联系方式: ', fm.phone,
',健康状况: ', fm.health
) SEPARATOR '\n'
) as family_members,
-- 聚合教育经历信息使用DISTINCT避免重复
GROUP_CONCAT(
DISTINCT CONCAT(
'开始时间: ', DATE_FORMAT(ee.start_time, '%Y-%m-%d'),
',结束时间: ', DATE_FORMAT(ee.end_time, '%Y-%m-%d'),
',学校: ', ee.school_name,
',职务: ', ee.post,
',证明人: ', ee.certifier
) SEPARATOR '\n'
) as education_experiences
FROM srs_student s
LEFT JOIN srs_class c ON s.class_id = c.class_id
LEFT JOIN srs_majors m ON c.major_id = m.major_id
LEFT JOIN sys_dept d ON m.college_id = d.dept_id
LEFT JOIN cph_teacher e ON c.teacher_id = e.teacher_id
LEFT JOIN srs_grade f ON f.grade_id = c.grade_id
LEFT JOIN cph_stu_extra_info g ON g.stu_no = s.stu_no
LEFT JOIN cph_family_member fm ON fm.stu_no = s.stu_no
LEFT JOIN srs_education_experience ee ON ee.stu_no = s.stu_no
WHERE s.stu_no = #{stuNo}
GROUP BY s.stu_no
</select>
</mapper>