提交代码,在sys_user表中新增了account_type字段来区分学生和老师

This commit is contained in:
zlwu committed 2025-07-24 20:30:50 +08:00
1 parent b215f7b9b3
commit 0c6d70cc4c
26 files changed
+5917 -3

No files matched your search

@@ -0,0 +1,105 @@
package org.dromara.xg.controller;
import java.util.List;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.web.core.BaseController;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.xg.domain.vo.XgStudentMsgVo;
import org.dromara.xg.domain.bo.XgStudentMsgBo;
import org.dromara.xg.service.IXgStudentMsgService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
* 学生信息
*
* @author zlwu
* @date 2025-07-24
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/studentMsg/studentMsg")
public class XgStudentMsgController extends BaseController {
private final IXgStudentMsgService xgStudentMsgService;
/**
* 查询学生信息列表
*/
@SaCheckPermission("studentMsg:studentMsg:list")
@GetMapping("/list")
public TableDataInfo<XgStudentMsgVo> list(XgStudentMsgBo bo, PageQuery pageQuery) {
return xgStudentMsgService.queryPageList(bo, pageQuery);
}
/**
* 导出学生信息列表
*/
@SaCheckPermission("studentMsg:studentMsg:export")
@Log(title = "学生信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(XgStudentMsgBo bo, HttpServletResponse response) {
List<XgStudentMsgVo> list = xgStudentMsgService.queryList(bo);
ExcelUtil.exportExcel(list, "学生信息", XgStudentMsgVo.class, response);
}
/**
* 获取学生信息详细信息
*
* @param id 主键
*/
@SaCheckPermission("studentMsg:studentMsg:query")
@GetMapping("/{id}")
public R<XgStudentMsgVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(xgStudentMsgService.queryById(id));
}
/**
* 新增学生信息
*/
@SaCheckPermission("studentMsg:studentMsg:add")
@Log(title = "学生信息", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody XgStudentMsgBo bo) {
return toAjax(xgStudentMsgService.insertByBo(bo));
}
/**
* 修改学生信息
*/
@SaCheckPermission("studentMsg:studentMsg:edit")
@Log(title = "学生信息", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody XgStudentMsgBo bo) {
return toAjax(xgStudentMsgService.updateByBo(bo));
}
/**
* 删除学生信息
*
* @param ids 主键串
*/
@SaCheckPermission("studentMsg:studentMsg:remove")
@Log(title = "学生信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(xgStudentMsgService.deleteWithValidByIds(List.of(ids), true));
}
}
@@ -0,0 +1,548 @@
package org.dromara.xg.domain;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serial;
/**
* 学生信息对象 xg_student_msg
*
* @author zlwu
* @date 2025-07-24
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("xg_student_msg")
public class XgStudentMsg extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键ID(雪花ID)
*/
@TableId(value = "id")
private Long id;
/**
* 删除标志(0代表存在 1代表删除)
*/
@TableLogic(value = "0", delval = "1")
private Long deleted;
/**
* 学号
*/
private String studentNo;
/**
* 身份证号
*/
private String idCard;
/**
* 姓名
*/
private String name;
/**
* 英文姓名
*/
private String nameEnglish;
/**
* 曾用名
*/
private String formerName;
/**
* 性别:M-男,F-女
*/
private String gender;
/**
* 出生日期
*/
private Date birthDate;
/**
* 民族
*/
private String nationality;
/**
* 籍贯
*/
private String nativePlace;
/**
* 政治面貌
*/
private String politicalStatus;
/**
* 户籍所在地
*/
private String hukouLocation;
/**
* 家庭地址
*/
private String homeAddress;
/**
* 现住址
*/
private String currentAddress;
/**
* 邮政编码
*/
private String postalCode;
/**
* 照片URL
*/
private String photoUrl;
/**
* 学生照片存储路径
*/
private String photoPath;
/**
* 手机号码
*/
private String phone;
/**
* 是否住校:0-否,1-是
*/
private Long isBoarder;
/**
* 文化程度
*/
private String educationLevel;
/**
* 户口类型:农业、非农业
*/
private String householdRegisterType;
/**
* 宗教信仰
*/
private String religion;
/**
* 生源地区(省市县)
*/
private String sourceRegion;
/**
* 毕业院校
*/
private String graduateSchool;
/**
* 电子邮箱
*/
private String email;
/**
* QQ号码
*/
private String qq;
/**
* 微信号
*/
private String wechat;
/**
* 婚姻状况:1 未婚、2 已婚、3 离异、4 丧偶
*/
private String maritalStatus;
/**
* 紧急联系人姓名
*/
private String emergencyContactName;
/**
* 紧急联系人电话
*/
private String emergencyContactPhone;
/**
* 紧急联系人关系
*/
private String emergencyContactRelation;
/**
* 是否贫困生:0-否,1-是
*/
private Long isPoorStudent;
/**
* 是否少数民族:0-否,1-是
*/
private Long isMinority;
/**
* 是否残疾:0-否,1-是
*/
private Long isDisabled;
/**
* 是否孤儿:0-否,1-是
*/
private Long isOrphan;
/**
* 是否留守儿童:0-否,1-是
*/
private Long isLeftBehindChild;
/**
* 是否独生子女:0-否,1-是
*/
private Long isSingleChild;
/**
* 是否低保:0-否,1-是
*/
private Long isLowIncome;
/**
* 是否有助学贷款:0-否,1-是
*/
private Long hasLoan;
/**
* 助学贷款金额
*/
private Long loanAmount;
/**
* 特长爱好
*/
private String specialties;
/**
* 获奖情况
*/
private String awards;
/**
* 违纪记录
*/
private String violations;
/**
* 社会活动
*/
private String socialActivities;
/**
* 父亲姓名
*/
private String fatherName;
/**
* 父亲电话
*/
private String fatherPhone;
/**
* 父亲工作单位
*/
private String fatherWorkUnit;
/**
* 母亲姓名
*/
private String motherName;
/**
* 母亲电话
*/
private String motherPhone;
/**
* 母亲工作单位
*/
private String motherWorkUnit;
/**
* 监护人姓名
*/
private String guardianName;
/**
* 监护人电话
*/
private String guardianPhone;
/**
* 监护人关系
*/
private String guardianRelation;
/**
* 家庭年收入
*/
private Long familyIncome;
/**
* 人均收入
*/
private Long perCapitaIncome;
/**
* 收入来源
*/
private String incomeSource;
/**
* 家庭经济状况:富裕、一般、困难、特困
*/
private String familyEconomicStatus;
/**
* 家庭成员数量
*/
private Long familyMembers;
/**
* 身高(cm)
*/
private Long height;
/**
* 体重(kg)
*/
private Long weight;
/**
* 血型
*/
private String bloodType;
/**
* 健康状况
*/
private String healthStatus;
/**
* 特殊体质或疾病
*/
private String specialCondition;
/**
* 病史
*/
private String medicalHistory;
/**
* 过敏史
*/
private String allergies;
/**
* 残疾类型 1 - 视力残疾 2 - 听力残疾 3 - 智力残疾 9 - 其他残疾
*/
private String disabilityType;
/**
* 残疾等级
*/
private String disabilityLevel;
/**
* 录取类别:统招、自主招生、专项计划等
*/
private String admissionCategory;
/**
* 学籍状态:1-在籍,2-休学,3-复学,4-退学,5-毕业
*/
private String studentStatus;
/**
* 入学年份
*/
private Long enrollmentYear;
/**
* 入学日期
*/
private Date enrollmentDate;
/**
* 银行卡号
*/
private String bankCardNo;
/**
* 开户银行
*/
private String bankName;
/**
* 开户支行
*/
private String bankBranch;
/**
* 持卡人姓名
*/
private String cardHolderName;
/**
* 信息状态:1-正常,2-待审核,3-审核中,4-已驳回,5-已锁定
*/
private String infoStatus;
/**
* 数据来源:manual-手工录入,import-批量导入,sync-系统同步
*/
private String dataSource;
/**
* 最后修改批次ID
*/
private Long lastBatchId;
/**
* 最后审核时间
*/
private Date lastAuditTime;
/**
* 信息是否完整:0-不完整,1-完整
*/
private Long isComplete;
/**
* 完整度百分比
*/
private Long completionRate;
/**
* 学制(年)- 预留,数据从班级表关联
*/
private Long schoolSystem;
/**
* 学历层次 - 预留,数据从班级表关联
*/
private String academicLevel;
/**
* 培养方式:全日制、在职、函授、夜大等 - 预留,数据从班级表关联
*/
private String trainingType;
/**
* 专业id - 预留,数据从班级表关联
*/
private String majorId;
/**
* 专业名称 - 预留,数据从班级表关联
*/
private String majorName;
/**
* 班级id - 预留,数据从班级表关联
*/
private String classId;
/**
* 班级名称 - 预留,数据从班级表关联
*/
private String className;
/**
* 年级 - 预留,数据从班级表关联
*/
private String grade;
/**
* 学院id - 预留,数据从班级表关联
*/
private String collegeId;
/**
* 学院名称 - 预留,数据从班级表关联
*/
private String collegeName;
/**
* 辅导员ID - 预留,数据从班级表关联
*/
private Long counselorId;
/**
* 辅导员姓名 - 预留,数据从班级表关联
*/
private String counselorName;
/**
* 班主任ID - 预留,数据从班级表关联
*/
private Long classTeacherId;
/**
* 班主任姓名 - 预留,数据从班级表关联
*/
private String classTeacherName;
/**
* 宿舍楼栋 - 预留,数据从班级表关联
*/
private String dormitoryBuilding;
/**
* 宿舍房间号 - 预留,数据从班级表关联
*/
private String dormitoryRoom;
/**
* 扩展字段1
*/
private String extField1;
/**
* 扩展字段2
*/
private String extField2;
/**
* 扩展字段3
*/
private String extField3;
/**
* 扩展字段4
*/
private String extField4;
/**
* 扩展字段5
*/
private String extField5;
/**
* 备注信息
*/
private String remark;
}
@@ -48,4 +48,8 @@ public class XgSysUser extends TenantEntity {
@TableLogic
private String delFlag;
/**
* 账户类型 1 - 教职工 2- 学生
*/
private String accountType;
}
@@ -0,0 +1,550 @@
package org.dromara.xg.domain.bo;
import org.dromara.xg.domain.XgStudentMsg;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* 学生信息业务对象 xg_student_msg
*
* @author zlwu
* @date 2025-07-24
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = XgStudentMsg.class, reverseConvertGenerate = false)
public class XgStudentMsgBo extends BaseEntity {
/**
* 主键ID(雪花ID)
*/
@NotNull(message = "主键ID(雪花ID)不能为空", groups = { EditGroup.class })
private Long id;
/**
* 删除标志(0代表存在 1代表删除)
*/
private Long deleted;
/**
* 学号
*/
@NotBlank(message = "学号不能为空", groups = { AddGroup.class, EditGroup.class })
private String studentNo;
/**
* 身份证号
*/
private String idCard;
/**
* 姓名
*/
@NotBlank(message = "姓名不能为空", groups = { AddGroup.class, EditGroup.class })
private String name;
/**
* 英文姓名
*/
private String nameEnglish;
/**
* 曾用名
*/
private String formerName;
/**
* 性别:M-男,F-女
*/
@NotBlank(message = "性别:M-男,F-女不能为空", groups = { AddGroup.class, EditGroup.class })
private String gender;
/**
* 出生日期
*/
private Date birthDate;
/**
* 民族
*/
private String nationality;
/**
* 籍贯
*/
private String nativePlace;
/**
* 政治面貌
*/
private String politicalStatus;
/**
* 户籍所在地
*/
private String hukouLocation;
/**
* 家庭地址
*/
private String homeAddress;
/**
* 现住址
*/
private String currentAddress;
/**
* 邮政编码
*/
private String postalCode;
/**
* 照片URL
*/
private String photoUrl;
/**
* 学生照片存储路径
*/
private String photoPath;
/**
* 手机号码
*/
private String phone;
/**
* 是否住校:0-否,1-是
*/
private Long isBoarder;
/**
* 文化程度
*/
private String educationLevel;
/**
* 户口类型:农业、非农业
*/
private String householdRegisterType;
/**
* 宗教信仰
*/
private String religion;
/**
* 生源地区(省市县)
*/
private String sourceRegion;
/**
* 毕业院校
*/
private String graduateSchool;
/**
* 电子邮箱
*/
private String email;
/**
* QQ号码
*/
private String qq;
/**
* 微信号
*/
private String wechat;
/**
* 婚姻状况:1 未婚、2 已婚、3 离异、4 丧偶
*/
private String maritalStatus;
/**
* 紧急联系人姓名
*/
private String emergencyContactName;
/**
* 紧急联系人电话
*/
private String emergencyContactPhone;
/**
* 紧急联系人关系
*/
private String emergencyContactRelation;
/**
* 是否贫困生:0-否,1-是
*/
private Long isPoorStudent;
/**
* 是否少数民族:0-否,1-是
*/
private Long isMinority;
/**
* 是否残疾:0-否,1-是
*/
private Long isDisabled;
/**
* 是否孤儿:0-否,1-是
*/
private Long isOrphan;
/**
* 是否留守儿童:0-否,1-是
*/
private Long isLeftBehindChild;
/**
* 是否独生子女:0-否,1-是
*/
private Long isSingleChild;
/**
* 是否低保:0-否,1-是
*/
private Long isLowIncome;
/**
* 是否有助学贷款:0-否,1-是
*/
private Long hasLoan;
/**
* 助学贷款金额
*/
private Long loanAmount;
/**
* 特长爱好
*/
private String specialties;
/**
* 获奖情况
*/
private String awards;
/**
* 违纪记录
*/
private String violations;
/**
* 社会活动
*/
private String socialActivities;
/**
* 父亲姓名
*/
private String fatherName;
/**
* 父亲电话
*/
private String fatherPhone;
/**
* 父亲工作单位
*/
private String fatherWorkUnit;
/**
* 母亲姓名
*/
private String motherName;
/**
* 母亲电话
*/
private String motherPhone;
/**
* 母亲工作单位
*/
private String motherWorkUnit;
/**
* 监护人姓名
*/
private String guardianName;
/**
* 监护人电话
*/
private String guardianPhone;
/**
* 监护人关系
*/
private String guardianRelation;
/**
* 家庭年收入
*/
private Long familyIncome;
/**
* 人均收入
*/
private Long perCapitaIncome;
/**
* 收入来源
*/
private String incomeSource;
/**
* 家庭经济状况:富裕、一般、困难、特困
*/
private String familyEconomicStatus;
/**
* 家庭成员数量
*/
private Long familyMembers;
/**
* 身高(cm)
*/
private Long height;
/**
* 体重(kg)
*/
private Long weight;
/**
* 血型
*/
private String bloodType;
/**
* 健康状况
*/
private String healthStatus;
/**
* 特殊体质或疾病
*/
private String specialCondition;
/**
* 病史
*/
private String medicalHistory;
/**
* 过敏史
*/
private String allergies;
/**
* 残疾类型 1 - 视力残疾 2 - 听力残疾 3 - 智力残疾 9 - 其他残疾
*/
private String disabilityType;
/**
* 残疾等级
*/
private String disabilityLevel;
/**
* 录取类别:统招、自主招生、专项计划等
*/
private String admissionCategory;
/**
* 学籍状态:1-在籍,2-休学,3-复学,4-退学,5-毕业
*/
private String studentStatus;
/**
* 入学年份
*/
private Long enrollmentYear;
/**
* 入学日期
*/
private Date enrollmentDate;
/**
* 银行卡号
*/
private String bankCardNo;
/**
* 开户银行
*/
private String bankName;
/**
* 开户支行
*/
private String bankBranch;
/**
* 持卡人姓名
*/
private String cardHolderName;
/**
* 信息状态:1-正常,2-待审核,3-审核中,4-已驳回,5-已锁定
*/
private String infoStatus;
/**
* 数据来源:manual-手工录入,import-批量导入,sync-系统同步
*/
private String dataSource;
/**
* 最后修改批次ID
*/
private Long lastBatchId;
/**
* 最后审核时间
*/
private Date lastAuditTime;
/**
* 信息是否完整:0-不完整,1-完整
*/
private Long isComplete;
/**
* 完整度百分比
*/
private Long completionRate;
/**
* 学制(年)- 预留,数据从班级表关联
*/
private Long schoolSystem;
/**
* 学历层次 - 预留,数据从班级表关联
*/
private String academicLevel;
/**
* 培养方式:全日制、在职、函授、夜大等 - 预留,数据从班级表关联
*/
private String trainingType;
/**
* 专业id - 预留,数据从班级表关联
*/
private String majorId;
/**
* 专业名称 - 预留,数据从班级表关联
*/
private String majorName;
/**
* 班级id - 预留,数据从班级表关联
*/
private String classId;
/**
* 班级名称 - 预留,数据从班级表关联
*/
private String className;
/**
* 年级 - 预留,数据从班级表关联
*/
private String grade;
/**
* 学院id - 预留,数据从班级表关联
*/
private String collegeId;
/**
* 学院名称 - 预留,数据从班级表关联
*/
private String collegeName;
/**
* 辅导员ID - 预留,数据从班级表关联
*/
private Long counselorId;
/**
* 辅导员姓名 - 预留,数据从班级表关联
*/
private String counselorName;
/**
* 班主任ID - 预留,数据从班级表关联
*/
private Long classTeacherId;
/**
* 班主任姓名 - 预留,数据从班级表关联
*/
private String classTeacherName;
/**
* 宿舍楼栋 - 预留,数据从班级表关联
*/
private String dormitoryBuilding;
/**
* 宿舍房间号 - 预留,数据从班级表关联
*/
private String dormitoryRoom;
/**
* 扩展字段1
*/
private String extField1;
/**
* 扩展字段2
*/
private String extField2;
/**
* 扩展字段3
*/
private String extField3;
/**
* 扩展字段4
*/
private String extField4;
/**
* 扩展字段5
*/
private String extField5;
/**
* 备注信息
*/
private String remark;
}
@@ -0,0 +1,664 @@
package org.dromara.xg.domain.vo;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.xg.domain.XgStudentMsg;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* 学生信息视图对象 xg_student_msg
*
* @author zlwu
* @date 2025-07-24
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = XgStudentMsg.class)
public class XgStudentMsgVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键ID(雪花ID)
*/
@ExcelProperty(value = "主键ID", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "雪=花ID")
private Long id;
/**
* 删除标志(0代表存在 1代表删除)
*/
@ExcelProperty(value = "删除标志", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "0=代表存在,1=代表删除")
private Long deleted;
/**
* 学号
*/
@ExcelProperty(value = "学号")
private String studentNo;
/**
* 身份证号
*/
@ExcelProperty(value = "身份证号")
private String idCard;
/**
* 姓名
*/
@ExcelProperty(value = "姓名")
private String name;
/**
* 英文姓名
*/
@ExcelProperty(value = "英文姓名")
private String nameEnglish;
/**
* 曾用名
*/
@ExcelProperty(value = "曾用名")
private String formerName;
/**
* 性别:M-男,F-女
*/
@ExcelProperty(value = "性别:M-男,F-女")
private String gender;
/**
* 出生日期
*/
@ExcelProperty(value = "出生日期")
private Date birthDate;
/**
* 民族
*/
@ExcelProperty(value = "民族 ")
private String nationality;
/**
* 籍贯
*/
@ExcelProperty(value = "籍贯")
private String nativePlace;
/**
* 政治面貌
*/
@ExcelProperty(value = "政治面貌")
private String politicalStatus;
/**
* 户籍所在地
*/
@ExcelProperty(value = "户籍所在地")
private String hukouLocation;
/**
* 家庭地址
*/
@ExcelProperty(value = "家庭地址")
private String homeAddress;
/**
* 现住址
*/
@ExcelProperty(value = "现住址")
private String currentAddress;
/**
* 邮政编码
*/
@ExcelProperty(value = "邮政编码")
private String postalCode;
/**
* 照片URL
*/
@ExcelProperty(value = "照片URL")
private String photoUrl;
/**
* 学生照片存储路径
*/
@ExcelProperty(value = "学生照片存储路径")
private String photoPath;
/**
* 手机号码
*/
@ExcelProperty(value = "手机号码")
private String phone;
/**
* 是否住校:0-否,1-是
*/
@ExcelProperty(value = "是否住校:0-否,1-是")
private Long isBoarder;
/**
* 文化程度
*/
@ExcelProperty(value = "文化程度")
private String educationLevel;
/**
* 户口类型:农业、非农业
*/
@ExcelProperty(value = "户口类型:农业、非农业")
private String householdRegisterType;
/**
* 宗教信仰
*/
@ExcelProperty(value = "宗教信仰")
private String religion;
/**
* 生源地区(省市县)
*/
@ExcelProperty(value = "生源地区", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "省=市县")
private String sourceRegion;
/**
* 毕业院校
*/
@ExcelProperty(value = "毕业院校")
private String graduateSchool;
/**
* 电子邮箱
*/
@ExcelProperty(value = "电子邮箱")
private String email;
/**
* QQ号码
*/
@ExcelProperty(value = "QQ号码")
private String qq;
/**
* 微信号
*/
@ExcelProperty(value = "微信号")
private String wechat;
/**
* 婚姻状况:1 未婚、2 已婚、3 离异、4 丧偶
*/
@ExcelProperty(value = "婚姻状况:1 未婚、2 已婚、3 离异、4 丧偶 ")
private String maritalStatus;
/**
* 紧急联系人姓名
*/
@ExcelProperty(value = "紧急联系人姓名")
private String emergencyContactName;
/**
* 紧急联系人电话
*/
@ExcelProperty(value = "紧急联系人电话")
private String emergencyContactPhone;
/**
* 紧急联系人关系
*/
@ExcelProperty(value = "紧急联系人关系")
private String emergencyContactRelation;
/**
* 是否贫困生:0-否,1-是
*/
@ExcelProperty(value = "是否贫困生:0-否,1-是")
private Long isPoorStudent;
/**
* 是否少数民族:0-否,1-是
*/
@ExcelProperty(value = "是否少数民族:0-否,1-是")
private Long isMinority;
/**
* 是否残疾:0-否,1-是
*/
@ExcelProperty(value = "是否残疾:0-否,1-是")
private Long isDisabled;
/**
* 是否孤儿:0-否,1-是
*/
@ExcelProperty(value = "是否孤儿:0-否,1-是")
private Long isOrphan;
/**
* 是否留守儿童:0-否,1-是
*/
@ExcelProperty(value = "是否留守儿童:0-否,1-是")
private Long isLeftBehindChild;
/**
* 是否独生子女:0-否,1-是
*/
@ExcelProperty(value = "是否独生子女:0-否,1-是")
private Long isSingleChild;
/**
* 是否低保:0-否,1-是
*/
@ExcelProperty(value = "是否低保:0-否,1-是")
private Long isLowIncome;
/**
* 是否有助学贷款:0-否,1-是
*/
@ExcelProperty(value = "是否有助学贷款:0-否,1-是")
private Long hasLoan;
/**
* 助学贷款金额
*/
@ExcelProperty(value = "助学贷款金额")
private Long loanAmount;
/**
* 特长爱好
*/
@ExcelProperty(value = "特长爱好")
private String specialties;
/**
* 获奖情况
*/
@ExcelProperty(value = "获奖情况")
private String awards;
/**
* 违纪记录
*/
@ExcelProperty(value = "违纪记录")
private String violations;
/**
* 社会活动
*/
@ExcelProperty(value = "社会活动")
private String socialActivities;
/**
* 父亲姓名
*/
@ExcelProperty(value = "父亲姓名")
private String fatherName;
/**
* 父亲电话
*/
@ExcelProperty(value = "父亲电话")
private String fatherPhone;
/**
* 父亲工作单位
*/
@ExcelProperty(value = "父亲工作单位")
private String fatherWorkUnit;
/**
* 母亲姓名
*/
@ExcelProperty(value = "母亲姓名")
private String motherName;
/**
* 母亲电话
*/
@ExcelProperty(value = "母亲电话")
private String motherPhone;
/**
* 母亲工作单位
*/
@ExcelProperty(value = "母亲工作单位")
private String motherWorkUnit;
/**
* 监护人姓名
*/
@ExcelProperty(value = "监护人姓名")
private String guardianName;
/**
* 监护人电话
*/
@ExcelProperty(value = "监护人电话")
private String guardianPhone;
/**
* 监护人关系
*/
@ExcelProperty(value = "监护人关系")
private String guardianRelation;
/**
* 家庭年收入
*/
@ExcelProperty(value = "家庭年收入")
private Long familyIncome;
/**
* 人均收入
*/
@ExcelProperty(value = "人均收入")
private Long perCapitaIncome;
/**
* 收入来源
*/
@ExcelProperty(value = "收入来源")
private String incomeSource;
/**
* 家庭经济状况:富裕、一般、困难、特困
*/
@ExcelProperty(value = "家庭经济状况:富裕、一般、困难、特困")
private String familyEconomicStatus;
/**
* 家庭成员数量
*/
@ExcelProperty(value = "家庭成员数量")
private Long familyMembers;
/**
* 身高(cm)
*/
@ExcelProperty(value = "身高", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "c=m")
private Long height;
/**
* 体重(kg)
*/
@ExcelProperty(value = "体重", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "k=g")
private Long weight;
/**
* 血型
*/
@ExcelProperty(value = "血型")
private String bloodType;
/**
* 健康状况
*/
@ExcelProperty(value = "健康状况")
private String healthStatus;
/**
* 特殊体质或疾病
*/
@ExcelProperty(value = "特殊体质或疾病")
private String specialCondition;
/**
* 病史
*/
@ExcelProperty(value = "病史")
private String medicalHistory;
/**
* 过敏史
*/
@ExcelProperty(value = "过敏史")
private String allergies;
/**
* 残疾类型 1 - 视力残疾 2 - 听力残疾 3 - 智力残疾 9 - 其他残疾
*/
@ExcelProperty(value = "残疾类型 1 - 视力残疾 2 - 听力残疾 3 - 智力残疾 9 - 其他残疾")
private String disabilityType;
/**
* 残疾等级
*/
@ExcelProperty(value = "残疾等级")
private String disabilityLevel;
/**
* 录取类别:统招、自主招生、专项计划等
*/
@ExcelProperty(value = "录取类别:统招、自主招生、专项计划等")
private String admissionCategory;
/**
* 学籍状态:1-在籍,2-休学,3-复学,4-退学,5-毕业
*/
@ExcelProperty(value = "学籍状态:1-在籍,2-休学,3-复学,4-退学,5-毕业")
private String studentStatus;
/**
* 入学年份
*/
@ExcelProperty(value = "入学年份")
private Long enrollmentYear;
/**
* 入学日期
*/
@ExcelProperty(value = "入学日期")
private Date enrollmentDate;
/**
* 银行卡号
*/
@ExcelProperty(value = "银行卡号")
private String bankCardNo;
/**
* 开户银行
*/
@ExcelProperty(value = "开户银行")
private String bankName;
/**
* 开户支行
*/
@ExcelProperty(value = "开户支行")
private String bankBranch;
/**
* 持卡人姓名
*/
@ExcelProperty(value = "持卡人姓名")
private String cardHolderName;
/**
* 信息状态:1-正常,2-待审核,3-审核中,4-已驳回,5-已锁定
*/
@ExcelProperty(value = "信息状态:1-正常,2-待审核,3-审核中,4-已驳回,5-已锁定")
private String infoStatus;
/**
* 数据来源:manual-手工录入,import-批量导入,sync-系统同步
*/
@ExcelProperty(value = "数据来源:manual-手工录入,import-批量导入,sync-系统同步")
private String dataSource;
/**
* 最后修改批次ID
*/
@ExcelProperty(value = "最后修改批次ID")
private Long lastBatchId;
/**
* 最后审核时间
*/
@ExcelProperty(value = "最后审核时间")
private Date lastAuditTime;
/**
* 信息是否完整:0-不完整,1-完整
*/
@ExcelProperty(value = "信息是否完整:0-不完整,1-完整")
private Long isComplete;
/**
* 完整度百分比
*/
@ExcelProperty(value = "完整度百分比")
private Long completionRate;
/**
* 学制(年)- 预留,数据从班级表关联
*/
@ExcelProperty(value = "学制", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "年=")
private Long schoolSystem;
/**
* 学历层次 - 预留,数据从班级表关联
*/
@ExcelProperty(value = "学历层次 - 预留,数据从班级表关联")
private String academicLevel;
/**
* 培养方式:全日制、在职、函授、夜大等 - 预留,数据从班级表关联
*/
@ExcelProperty(value = "培养方式:全日制、在职、函授、夜大等 - 预留,数据从班级表关联")
private String trainingType;
/**
* 专业id - 预留,数据从班级表关联
*/
@ExcelProperty(value = "专业id - 预留,数据从班级表关联")
private String majorId;
/**
* 专业名称 - 预留,数据从班级表关联
*/
@ExcelProperty(value = "专业名称 - 预留,数据从班级表关联")
private String majorName;
/**
* 班级id - 预留,数据从班级表关联
*/
@ExcelProperty(value = "班级id - 预留,数据从班级表关联")
private String classId;
/**
* 班级名称 - 预留,数据从班级表关联
*/
@ExcelProperty(value = "班级名称 - 预留,数据从班级表关联")
private String className;
/**
* 年级 - 预留,数据从班级表关联
*/
@ExcelProperty(value = "年级 - 预留,数据从班级表关联")
private String grade;
/**
* 学院id - 预留,数据从班级表关联
*/
@ExcelProperty(value = "学院id - 预留,数据从班级表关联")
private String collegeId;
/**
* 学院名称 - 预留,数据从班级表关联
*/
@ExcelProperty(value = "学院名称 - 预留,数据从班级表关联")
private String collegeName;
/**
* 辅导员ID - 预留,数据从班级表关联
*/
@ExcelProperty(value = "辅导员ID - 预留,数据从班级表关联")
private Long counselorId;
/**
* 辅导员姓名 - 预留,数据从班级表关联
*/
@ExcelProperty(value = "辅导员姓名 - 预留,数据从班级表关联")
private String counselorName;
/**
* 班主任ID - 预留,数据从班级表关联
*/
@ExcelProperty(value = "班主任ID - 预留,数据从班级表关联")
private Long classTeacherId;
/**
* 班主任姓名 - 预留,数据从班级表关联
*/
@ExcelProperty(value = "班主任姓名 - 预留,数据从班级表关联")
private String classTeacherName;
/**
* 宿舍楼栋 - 预留,数据从班级表关联
*/
@ExcelProperty(value = "宿舍楼栋 - 预留,数据从班级表关联")
private String dormitoryBuilding;
/**
* 宿舍房间号 - 预留,数据从班级表关联
*/
@ExcelProperty(value = "宿舍房间号 - 预留,数据从班级表关联")
private String dormitoryRoom;
/**
* 扩展字段1
*/
@ExcelProperty(value = "扩展字段1")
private String extField1;
/**
* 扩展字段2
*/
@ExcelProperty(value = "扩展字段2")
private String extField2;
/**
* 扩展字段3
*/
@ExcelProperty(value = "扩展字段3")
private String extField3;
/**
* 扩展字段4
*/
@ExcelProperty(value = "扩展字段4")
private String extField4;
/**
* 扩展字段5
*/
@ExcelProperty(value = "扩展字段5")
private String extField5;
/**
* 备注信息
*/
@ExcelProperty(value = "备注信息")
private String remark;
}
@@ -0,0 +1,15 @@
package org.dromara.xg.mapper;
import org.dromara.xg.domain.XgStudentMsg;
import org.dromara.xg.domain.vo.XgStudentMsgVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 学生信息Mapper接口
*
* @author zlwu
* @date 2025-07-24
*/
public interface XgStudentMsgMapper extends BaseMapperPlus<XgStudentMsg, XgStudentMsgVo> {
}
@@ -20,4 +20,12 @@ public interface XgSysUserMapper extends BaseMapperPlus<XgSysUser, XgSysUser> {
*/
List<XgSysUser> selectActiveUserList();
/**
* 根据账户类型查询有效用户列表
*
* @param accountType 账户类型
* @return 用户列表
*/
List<XgSysUser> selectActiveUserListByAccountType(String accountType);
}
@@ -0,0 +1,68 @@
package org.dromara.xg.service;
import org.dromara.xg.domain.vo.XgStudentMsgVo;
import org.dromara.xg.domain.bo.XgStudentMsgBo;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
/**
* 学生信息Service接口
*
* @author zlwu
* @date 2025-07-24
*/
public interface IXgStudentMsgService {
/**
* 查询学生信息
*
* @param id 主键
* @return 学生信息
*/
XgStudentMsgVo queryById(Long id);
/**
* 分页查询学生信息列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 学生信息分页列表
*/
TableDataInfo<XgStudentMsgVo> queryPageList(XgStudentMsgBo bo, PageQuery pageQuery);
/**
* 查询符合条件的学生信息列表
*
* @param bo 查询条件
* @return 学生信息列表
*/
List<XgStudentMsgVo> queryList(XgStudentMsgBo bo);
/**
* 新增学生信息
*
* @param bo 学生信息
* @return 是否新增成功
*/
Boolean insertByBo(XgStudentMsgBo bo);
/**
* 修改学生信息
*
* @param bo 学生信息
* @return 是否修改成功
*/
Boolean updateByBo(XgStudentMsgBo bo);
/**
* 校验并批量删除学生信息信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}
@@ -89,7 +89,7 @@ public class XgDormManagerServiceImpl implements IXgDormManagerService {
sql.append("INNER JOIN sys_user_role ur ON u.user_id = ur.user_id ");
sql.append("INNER JOIN sys_role r ON ur.role_id = r.role_id ");
sql.append(
"WHERE r.role_key = 'teacher' AND u.status = '0' and not exists (select 1 from xg_dorm_manager where user_id = u.user_id and deleted = '0' and manager_type = '"
"WHERE (r.role_key = 'teacher' or u.account_type='1') AND u.status = '0' and not exists (select 1 from xg_dorm_manager where user_id = u.user_id and deleted = '0' and manager_type = '"
+ managerType + "') ");
List<Object> params = new ArrayList<>();
@@ -0,0 +1,233 @@
package org.dromara.xg.service.impl;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.dromara.xg.domain.bo.XgStudentMsgBo;
import org.dromara.xg.domain.vo.XgStudentMsgVo;
import org.dromara.xg.domain.XgStudentMsg;
import org.dromara.xg.mapper.XgStudentMsgMapper;
import org.dromara.xg.service.IXgStudentMsgService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 学生信息Service业务层处理
*
* @author zlwu
* @date 2025-07-24
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class XgStudentMsgServiceImpl implements IXgStudentMsgService {
private final XgStudentMsgMapper baseMapper;
/**
* 查询学生信息
*
* @param id 主键
* @return 学生信息
*/
@Override
public XgStudentMsgVo queryById(Long id){
return baseMapper.selectVoById(id);
}
/**
* 分页查询学生信息列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 学生信息分页列表
*/
@Override
public TableDataInfo<XgStudentMsgVo> queryPageList(XgStudentMsgBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<XgStudentMsg> lqw = buildQueryWrapper(bo);
Page<XgStudentMsgVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 查询符合条件的学生信息列表
*
* @param bo 查询条件
* @return 学生信息列表
*/
@Override
public List<XgStudentMsgVo> queryList(XgStudentMsgBo bo) {
LambdaQueryWrapper<XgStudentMsg> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<XgStudentMsg> buildQueryWrapper(XgStudentMsgBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<XgStudentMsg> lqw = Wrappers.lambdaQuery();
lqw.orderByAsc(XgStudentMsg::getId);
lqw.eq(bo.getDeleted() != null, XgStudentMsg::getDeleted, bo.getDeleted());
lqw.eq(StringUtils.isNotBlank(bo.getStudentNo()), XgStudentMsg::getStudentNo, bo.getStudentNo());
lqw.eq(StringUtils.isNotBlank(bo.getIdCard()), XgStudentMsg::getIdCard, bo.getIdCard());
lqw.like(StringUtils.isNotBlank(bo.getName()), XgStudentMsg::getName, bo.getName());
lqw.eq(StringUtils.isNotBlank(bo.getNameEnglish()), XgStudentMsg::getNameEnglish, bo.getNameEnglish());
lqw.like(StringUtils.isNotBlank(bo.getFormerName()), XgStudentMsg::getFormerName, bo.getFormerName());
lqw.eq(StringUtils.isNotBlank(bo.getGender()), XgStudentMsg::getGender, bo.getGender());
lqw.eq(bo.getBirthDate() != null, XgStudentMsg::getBirthDate, bo.getBirthDate());
lqw.eq(StringUtils.isNotBlank(bo.getNationality()), XgStudentMsg::getNationality, bo.getNationality());
lqw.eq(StringUtils.isNotBlank(bo.getNativePlace()), XgStudentMsg::getNativePlace, bo.getNativePlace());
lqw.eq(StringUtils.isNotBlank(bo.getPoliticalStatus()), XgStudentMsg::getPoliticalStatus, bo.getPoliticalStatus());
lqw.eq(StringUtils.isNotBlank(bo.getHukouLocation()), XgStudentMsg::getHukouLocation, bo.getHukouLocation());
lqw.eq(StringUtils.isNotBlank(bo.getHomeAddress()), XgStudentMsg::getHomeAddress, bo.getHomeAddress());
lqw.eq(StringUtils.isNotBlank(bo.getCurrentAddress()), XgStudentMsg::getCurrentAddress, bo.getCurrentAddress());
lqw.eq(StringUtils.isNotBlank(bo.getPostalCode()), XgStudentMsg::getPostalCode, bo.getPostalCode());
lqw.eq(StringUtils.isNotBlank(bo.getPhotoUrl()), XgStudentMsg::getPhotoUrl, bo.getPhotoUrl());
lqw.eq(StringUtils.isNotBlank(bo.getPhotoPath()), XgStudentMsg::getPhotoPath, bo.getPhotoPath());
lqw.eq(StringUtils.isNotBlank(bo.getPhone()), XgStudentMsg::getPhone, bo.getPhone());
lqw.eq(bo.getIsBoarder() != null, XgStudentMsg::getIsBoarder, bo.getIsBoarder());
lqw.eq(StringUtils.isNotBlank(bo.getEducationLevel()), XgStudentMsg::getEducationLevel, bo.getEducationLevel());
lqw.eq(StringUtils.isNotBlank(bo.getHouseholdRegisterType()), XgStudentMsg::getHouseholdRegisterType, bo.getHouseholdRegisterType());
lqw.eq(StringUtils.isNotBlank(bo.getReligion()), XgStudentMsg::getReligion, bo.getReligion());
lqw.eq(StringUtils.isNotBlank(bo.getSourceRegion()), XgStudentMsg::getSourceRegion, bo.getSourceRegion());
lqw.eq(StringUtils.isNotBlank(bo.getGraduateSchool()), XgStudentMsg::getGraduateSchool, bo.getGraduateSchool());
lqw.eq(StringUtils.isNotBlank(bo.getEmail()), XgStudentMsg::getEmail, bo.getEmail());
lqw.eq(StringUtils.isNotBlank(bo.getQq()), XgStudentMsg::getQq, bo.getQq());
lqw.eq(StringUtils.isNotBlank(bo.getWechat()), XgStudentMsg::getWechat, bo.getWechat());
lqw.eq(StringUtils.isNotBlank(bo.getMaritalStatus()), XgStudentMsg::getMaritalStatus, bo.getMaritalStatus());
lqw.like(StringUtils.isNotBlank(bo.getEmergencyContactName()), XgStudentMsg::getEmergencyContactName, bo.getEmergencyContactName());
lqw.eq(StringUtils.isNotBlank(bo.getEmergencyContactPhone()), XgStudentMsg::getEmergencyContactPhone, bo.getEmergencyContactPhone());
lqw.eq(StringUtils.isNotBlank(bo.getEmergencyContactRelation()), XgStudentMsg::getEmergencyContactRelation, bo.getEmergencyContactRelation());
lqw.eq(bo.getIsPoorStudent() != null, XgStudentMsg::getIsPoorStudent, bo.getIsPoorStudent());
lqw.eq(bo.getIsMinority() != null, XgStudentMsg::getIsMinority, bo.getIsMinority());
lqw.eq(bo.getIsDisabled() != null, XgStudentMsg::getIsDisabled, bo.getIsDisabled());
lqw.eq(bo.getIsOrphan() != null, XgStudentMsg::getIsOrphan, bo.getIsOrphan());
lqw.eq(bo.getIsLeftBehindChild() != null, XgStudentMsg::getIsLeftBehindChild, bo.getIsLeftBehindChild());
lqw.eq(bo.getIsSingleChild() != null, XgStudentMsg::getIsSingleChild, bo.getIsSingleChild());
lqw.eq(bo.getIsLowIncome() != null, XgStudentMsg::getIsLowIncome, bo.getIsLowIncome());
lqw.eq(bo.getHasLoan() != null, XgStudentMsg::getHasLoan, bo.getHasLoan());
lqw.eq(bo.getLoanAmount() != null, XgStudentMsg::getLoanAmount, bo.getLoanAmount());
lqw.eq(StringUtils.isNotBlank(bo.getSpecialties()), XgStudentMsg::getSpecialties, bo.getSpecialties());
lqw.eq(StringUtils.isNotBlank(bo.getAwards()), XgStudentMsg::getAwards, bo.getAwards());
lqw.eq(StringUtils.isNotBlank(bo.getViolations()), XgStudentMsg::getViolations, bo.getViolations());
lqw.eq(StringUtils.isNotBlank(bo.getSocialActivities()), XgStudentMsg::getSocialActivities, bo.getSocialActivities());
lqw.like(StringUtils.isNotBlank(bo.getFatherName()), XgStudentMsg::getFatherName, bo.getFatherName());
lqw.eq(StringUtils.isNotBlank(bo.getFatherPhone()), XgStudentMsg::getFatherPhone, bo.getFatherPhone());
lqw.eq(StringUtils.isNotBlank(bo.getFatherWorkUnit()), XgStudentMsg::getFatherWorkUnit, bo.getFatherWorkUnit());
lqw.like(StringUtils.isNotBlank(bo.getMotherName()), XgStudentMsg::getMotherName, bo.getMotherName());
lqw.eq(StringUtils.isNotBlank(bo.getMotherPhone()), XgStudentMsg::getMotherPhone, bo.getMotherPhone());
lqw.eq(StringUtils.isNotBlank(bo.getMotherWorkUnit()), XgStudentMsg::getMotherWorkUnit, bo.getMotherWorkUnit());
lqw.like(StringUtils.isNotBlank(bo.getGuardianName()), XgStudentMsg::getGuardianName, bo.getGuardianName());
lqw.eq(StringUtils.isNotBlank(bo.getGuardianPhone()), XgStudentMsg::getGuardianPhone, bo.getGuardianPhone());
lqw.eq(StringUtils.isNotBlank(bo.getGuardianRelation()), XgStudentMsg::getGuardianRelation, bo.getGuardianRelation());
lqw.eq(bo.getFamilyIncome() != null, XgStudentMsg::getFamilyIncome, bo.getFamilyIncome());
lqw.eq(bo.getPerCapitaIncome() != null, XgStudentMsg::getPerCapitaIncome, bo.getPerCapitaIncome());
lqw.eq(StringUtils.isNotBlank(bo.getIncomeSource()), XgStudentMsg::getIncomeSource, bo.getIncomeSource());
lqw.eq(StringUtils.isNotBlank(bo.getFamilyEconomicStatus()), XgStudentMsg::getFamilyEconomicStatus, bo.getFamilyEconomicStatus());
lqw.eq(bo.getFamilyMembers() != null, XgStudentMsg::getFamilyMembers, bo.getFamilyMembers());
lqw.eq(bo.getHeight() != null, XgStudentMsg::getHeight, bo.getHeight());
lqw.eq(bo.getWeight() != null, XgStudentMsg::getWeight, bo.getWeight());
lqw.eq(StringUtils.isNotBlank(bo.getBloodType()), XgStudentMsg::getBloodType, bo.getBloodType());
lqw.eq(StringUtils.isNotBlank(bo.getHealthStatus()), XgStudentMsg::getHealthStatus, bo.getHealthStatus());
lqw.eq(StringUtils.isNotBlank(bo.getSpecialCondition()), XgStudentMsg::getSpecialCondition, bo.getSpecialCondition());
lqw.eq(StringUtils.isNotBlank(bo.getMedicalHistory()), XgStudentMsg::getMedicalHistory, bo.getMedicalHistory());
lqw.eq(StringUtils.isNotBlank(bo.getAllergies()), XgStudentMsg::getAllergies, bo.getAllergies());
lqw.eq(StringUtils.isNotBlank(bo.getDisabilityType()), XgStudentMsg::getDisabilityType, bo.getDisabilityType());
lqw.eq(StringUtils.isNotBlank(bo.getDisabilityLevel()), XgStudentMsg::getDisabilityLevel, bo.getDisabilityLevel());
lqw.eq(StringUtils.isNotBlank(bo.getAdmissionCategory()), XgStudentMsg::getAdmissionCategory, bo.getAdmissionCategory());
lqw.eq(StringUtils.isNotBlank(bo.getStudentStatus()), XgStudentMsg::getStudentStatus, bo.getStudentStatus());
lqw.eq(bo.getEnrollmentYear() != null, XgStudentMsg::getEnrollmentYear, bo.getEnrollmentYear());
lqw.eq(bo.getEnrollmentDate() != null, XgStudentMsg::getEnrollmentDate, bo.getEnrollmentDate());
lqw.eq(StringUtils.isNotBlank(bo.getBankCardNo()), XgStudentMsg::getBankCardNo, bo.getBankCardNo());
lqw.like(StringUtils.isNotBlank(bo.getBankName()), XgStudentMsg::getBankName, bo.getBankName());
lqw.eq(StringUtils.isNotBlank(bo.getBankBranch()), XgStudentMsg::getBankBranch, bo.getBankBranch());
lqw.like(StringUtils.isNotBlank(bo.getCardHolderName()), XgStudentMsg::getCardHolderName, bo.getCardHolderName());
lqw.eq(StringUtils.isNotBlank(bo.getInfoStatus()), XgStudentMsg::getInfoStatus, bo.getInfoStatus());
lqw.eq(StringUtils.isNotBlank(bo.getDataSource()), XgStudentMsg::getDataSource, bo.getDataSource());
lqw.eq(bo.getLastBatchId() != null, XgStudentMsg::getLastBatchId, bo.getLastBatchId());
lqw.eq(bo.getLastAuditTime() != null, XgStudentMsg::getLastAuditTime, bo.getLastAuditTime());
lqw.eq(bo.getIsComplete() != null, XgStudentMsg::getIsComplete, bo.getIsComplete());
lqw.eq(bo.getCompletionRate() != null, XgStudentMsg::getCompletionRate, bo.getCompletionRate());
lqw.eq(bo.getSchoolSystem() != null, XgStudentMsg::getSchoolSystem, bo.getSchoolSystem());
lqw.eq(StringUtils.isNotBlank(bo.getAcademicLevel()), XgStudentMsg::getAcademicLevel, bo.getAcademicLevel());
lqw.eq(StringUtils.isNotBlank(bo.getTrainingType()), XgStudentMsg::getTrainingType, bo.getTrainingType());
lqw.eq(StringUtils.isNotBlank(bo.getMajorId()), XgStudentMsg::getMajorId, bo.getMajorId());
lqw.like(StringUtils.isNotBlank(bo.getMajorName()), XgStudentMsg::getMajorName, bo.getMajorName());
lqw.eq(StringUtils.isNotBlank(bo.getClassId()), XgStudentMsg::getClassId, bo.getClassId());
lqw.like(StringUtils.isNotBlank(bo.getClassName()), XgStudentMsg::getClassName, bo.getClassName());
lqw.eq(StringUtils.isNotBlank(bo.getGrade()), XgStudentMsg::getGrade, bo.getGrade());
lqw.eq(StringUtils.isNotBlank(bo.getCollegeId()), XgStudentMsg::getCollegeId, bo.getCollegeId());
lqw.like(StringUtils.isNotBlank(bo.getCollegeName()), XgStudentMsg::getCollegeName, bo.getCollegeName());
lqw.eq(bo.getCounselorId() != null, XgStudentMsg::getCounselorId, bo.getCounselorId());
lqw.like(StringUtils.isNotBlank(bo.getCounselorName()), XgStudentMsg::getCounselorName, bo.getCounselorName());
lqw.eq(bo.getClassTeacherId() != null, XgStudentMsg::getClassTeacherId, bo.getClassTeacherId());
lqw.like(StringUtils.isNotBlank(bo.getClassTeacherName()), XgStudentMsg::getClassTeacherName, bo.getClassTeacherName());
lqw.eq(StringUtils.isNotBlank(bo.getDormitoryBuilding()), XgStudentMsg::getDormitoryBuilding, bo.getDormitoryBuilding());
lqw.eq(StringUtils.isNotBlank(bo.getDormitoryRoom()), XgStudentMsg::getDormitoryRoom, bo.getDormitoryRoom());
lqw.eq(StringUtils.isNotBlank(bo.getExtField1()), XgStudentMsg::getExtField1, bo.getExtField1());
lqw.eq(StringUtils.isNotBlank(bo.getExtField2()), XgStudentMsg::getExtField2, bo.getExtField2());
lqw.eq(StringUtils.isNotBlank(bo.getExtField3()), XgStudentMsg::getExtField3, bo.getExtField3());
lqw.eq(StringUtils.isNotBlank(bo.getExtField4()), XgStudentMsg::getExtField4, bo.getExtField4());
lqw.eq(StringUtils.isNotBlank(bo.getExtField5()), XgStudentMsg::getExtField5, bo.getExtField5());
return lqw;
}
/**
* 新增学生信息
*
* @param bo 学生信息
* @return 是否新增成功
*/
@Override
public Boolean insertByBo(XgStudentMsgBo bo) {
XgStudentMsg add = MapstructUtils.convert(bo, XgStudentMsg.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 修改学生信息
*
* @param bo 学生信息
* @return 是否修改成功
*/
@Override
public Boolean updateByBo(XgStudentMsgBo bo) {
XgStudentMsg update = MapstructUtils.convert(bo, XgStudentMsg.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(XgStudentMsg entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 校验并批量删除学生信息信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}
}
@@ -21,12 +21,12 @@ public class XgSysUserServiceImpl implements IXgSysUserService {
private final XgSysUserMapper baseMapper;
/**
* 查询所有有效用户列表
* 查询所有有效用户列表(account_type=1)
*
* @return 有效用户列表
*/
@Override
public List<XgSysUser> selectActiveUserList() {
return baseMapper.selectActiveUserList();
return baseMapper.selectActiveUserListByAccountType("1");
}
}
@@ -0,0 +1,7 @@
<?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="org.dromara.xg.mapper.XgStudentMsgMapper">
</mapper>
@@ -24,4 +24,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time desc
</select>
<!-- 根据账户类型查询有效用户列表 -->
<select id="selectActiveUserListByAccountType" parameterType="String" resultMap="XgSysUserResult">
select user_id, nick_name, phonenumber
from sys_user
where status = '0' and del_flag = '0' and account_type = #{accountType}
order by create_time desc
</select>
</mapper>
@@ -0,0 +1,20 @@
# 变更记录 2025-07-24
## 系统用户查询功能调整
### 变更时间
2025-07-24 14:35:26
### 变更内容
1. 修改了系统用户查询功能,在 `XgSysUserServiceImpl.selectActiveUserList()` 方法中,增加了 account_type=1 的过滤条件
2. 在 XgSysUserMapper 接口中添加了 `selectActiveUserListByAccountType(Integer accountType)` 方法
3. 在 XgSysUserMapper.xml 中添加了相应的查询实现,增加 account_type = #{accountType} 条件
### 变更原因
需要限制系统用户查询结果,只返回 account_type=1 的用户记录
### 变更影响
该变更不影响其他功能,只是进一步限制了查询结果的范围
### 变更人
Claude AI 辅助开发
@@ -675,6 +675,51 @@
}
```
### 2.23 获取部门下拉树结构
- **接口路径**: GET `/system/user/deptTree`
- **权限标识**: `xg:studentInfo:list`
- **功能描述**: 获取部门下拉树结构数据
- **更新时间**: 2025-07-24(更新:添加deptId参数)
#### 请求参数
| 参数名 | 类型 | 必填 | 说明 |
|--------|------|------|------|
| deptId | integer | 否 | 部门ID,用于筛选特定部门下的数据,默认不传则获取所有部门 |
#### 响应数据
```json
{
"code": 200,
"msg": "查询成功",
"data": [
{
"id": 101,
"label": "计算机学院",
"children": [
{
"id": 1001,
"label": "计算机科学与技术专业"
},
{
"id": 1002,
"label": "软件工程专业"
}
]
},
{
"id": 102,
"label": "电子信息学院",
"children": [
{
"id": 2001,
"label": "电子信息工程专业"
}
]
}
]
}
```
## 3. 班级信息管理接口
### 3.1 查询班级信息列表
+1
View File
@@ -3484,6 +3484,7 @@ CREATE TABLE `sys_user` (
`user_name` varchar(30) NOT NULL COMMENT '用户账号',
`nick_name` varchar(30) NOT NULL COMMENT '用户昵称',
`user_type` varchar(10) DEFAULT 'sys_user' COMMENT '用户类型(sys_user系统用户)',
`account_type` varchar(255) DEFAULT '1' NULL COMMENT '账户类型 1 - 教职工 2- 学生',
`email` varchar(50) DEFAULT '' COMMENT '用户邮箱',
`phonenumber` varchar(11) DEFAULT '' COMMENT '手机号码',
`sex` char(1) DEFAULT '0' COMMENT '用户性别(0男 1女 2未知)',
@@ -0,0 +1,24 @@
CREATE TABLE `sys_region` (
`id` bigint(20) NOT NULL COMMENT '主键ID',
`code` varchar(20) NOT NULL COMMENT '行政区划编码',
`name` varchar(50) NOT NULL COMMENT '行政区划名称',
`short_name` varchar(30) DEFAULT NULL COMMENT '行政区划简称',
`parent_code` bigint(20) DEFAULT '0' COMMENT '父级行政区划编码,顶级为0',
`level` tinyint(1) NOT NULL COMMENT '层级(1:省,2:市,3:区/县,4:街道/镇)',
`sort` int(11) DEFAULT '0' COMMENT '排序',
`status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`longitude` decimal(10,7) DEFAULT NULL COMMENT '经度',
`latitude` decimal(10,7) DEFAULT NULL COMMENT '纬度',
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`deleted` tinyint(1) DEFAULT '0' COMMENT '逻辑删除标识(0未删除 1已删除)',
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (`id`),
UNIQUE KEY `idx_region_code` (`code`,`deleted`,`tenant_id`),
KEY `idx_region_parent_id` (`parent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='行政区划表';
+65
View File
@@ -0,0 +1,65 @@
import request from '@/utils/request';
// 获取管理员列表
export function getAdminList(params?: any) {
// 根据不同类型构造不同参数
return request({
url: '/studentMsg/admin/list',
method: 'get',
params
});
}
// 新增管理员
export function addAdmin(data: any) {
return request({
url: '/studentMsg/admin',
method: 'post',
data
});
}
// 更新管理员
export function updateAdmin(data: any) {
return request({
url: '/studentMsg/admin',
method: 'put',
data
});
}
// 删除管理员
export function deleteAdmin(id: number | string) {
return request({
url: `/studentMsg/admin/${id}`,
method: 'delete'
});
}
// 分配范围
export function assignScope(params: any, data: any) {
return request({
url: '/studentMsg/admin/assignScope',
method: 'post',
params,
data
});
}
// 获取范围名称
export function getScopeNames(params: any) {
return request({
url: '/studentMsg/admin/getScopeNames',
method: 'get',
params
});
}
// 获取可分配的范围
export function getScopeOptions(type: string) {
return request({
url: '/studentMsg/admin/getScopeOptions',
method: 'get',
params: { type }
});
}
+424
View File
@@ -0,0 +1,424 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StudentQuery, StudentVO, StudentForm, XgDeptTreeVO, R, TableDataInfo } from './types';
/**
* 查询部门下拉树结构
* @param deptId 部门ID
*/
export const XgDeptTreeSelect = (belongDeptId?: number): AxiosPromise<XgDeptTreeVO[]> => {
// 实际项目中连接后端接口
return request({
url: '/system/user/deptTree',
method: 'get',
params: {
belongDeptId
}
});
// // 模拟数据,直接返回与页面组件期望格式一致的数据
// return Promise.resolve({
// data: mockDeptTree,
// status: 200,
// statusText: 'OK',
// headers: {},
// config: {} as any
// }) as any;
};
// 查询学生列表
export function listStudent(query?: StudentQuery): AxiosPromise<R<TableDataInfo<StudentVO[]>>> {
// 实际使用时连接后端接口
// return request({
// url: '/studentMsg/student/list',
// method: 'get',
// params: query
// });
// 模拟数据
return Promise.resolve({
data: {
code: 200,
msg: 'success',
data: {
total: mockStudentData.length,
rows: mockStudentData
}
}
} as any);
}
// 查询学生详细
export function getStudent(studentId?: string | number): AxiosPromise<R<{
student: StudentVO;
majors: any[];
classes: any[];
}>> {
if (studentId) {
// 实际使用时连接后端接口
// return request({
// url: '/studentMsg/student/' + studentId,
// method: 'get'
// });
// 模拟数据
const student = mockStudentData.find(item => item.studentId === studentId);
return Promise.resolve({
data: {
code: 200,
msg: 'success',
data: {
student: student || {},
majors: mockMajors,
classes: mockClasses
}
}
} as any);
} else {
// 新增时返回初始空对象和选项数据
return Promise.resolve({
data: {
code: 200,
msg: 'success',
data: {
student: {},
majors: mockMajors,
classes: mockClasses
}
}
} as any);
}
}
// 新增学生
export function addStudent(data: StudentForm): AxiosPromise<R<any>> {
// 实际使用时连接后端接口
// return request({
// url: '/studentMsg/student',
// method: 'post',
// data: data
// });
// 模拟数据
return Promise.resolve({
data: {
code: 200,
msg: '添加成功'
}
} as any);
}
// 修改学生
export function updateStudent(data: StudentForm): AxiosPromise<R<any>> {
// 实际使用时连接后端接口
// return request({
// url: '/studentMsg/student',
// method: 'put',
// data: data
// });
// 模拟数据
return Promise.resolve({
data: {
code: 200,
msg: '修改成功'
}
} as any);
}
// 删除学生
export function delStudent(studentId: string | number | Array<string | number>): AxiosPromise<R<any>> {
// 实际使用时连接后端接口
// return request({
// url: '/studentMsg/student/' + studentId,
// method: 'delete'
// });
// 模拟数据
return Promise.resolve({
data: {
code: 200,
msg: '删除成功'
}
} as any);
}
// 查询院系树结构
export function deptTreeSelect(): AxiosPromise<R<any>> {
// 实际使用时连接后端接口
// return request({
// url: '/studentMsg/dept/treeselect',
// method: 'get'
// });
// 模拟数据
return Promise.resolve({
data: {
code: 200,
msg: 'success',
data: mockDeptTree
}
} as any);
}
// 导出学生
export function exportStudent(query?: StudentQuery): AxiosPromise<any> {
// 实际使用时连接后端接口
// return request({
// url: '/studentMsg/student/export',
// method: 'get',
// params: query
// });
// 模拟数据
return Promise.resolve({
data: mockStudentData,
status: 200,
statusText: 'OK',
headers: {},
config: {} as any
}) as any;
}
// 学生状态修改
export function changeStudentStatus(studentId: string | number, status: string): AxiosPromise<R<any>> {
// 实际使用时连接后端接口
// return request({
// url: '/studentMsg/student/changeStatus',
// method: 'put',
// data: {
// studentId,
// status
// }
// });
// 模拟数据
return Promise.resolve({
data: {
code: 200,
msg: '状态修改成功'
}
} as any);
}
// 模拟数据 - 学生列表
const mockStudentData: StudentVO[] = [
{
studentId: 1,
studentNo: '202001001',
studentName: '张三',
nickName: '小张',
sex: '0',
age: 20,
phonenumber: '13800138001',
email: 'zhangsan@example.com',
idCard: '110101200101011234',
deptId: 105,
deptName: '计算机科学与技术系',
majorId: 1,
majorName: '计算机科学与技术',
classId: 101,
className: '计算机2001班',
address: '北京市海淀区',
status: '0',
createTime: '2023-01-01 10:00:00',
remark: ''
},
{
studentId: 2,
studentNo: '202001002',
studentName: '李四',
nickName: '小李',
sex: '0',
age: 21,
phonenumber: '13800138002',
email: 'lisi@example.com',
idCard: '110101200001011235',
deptId: 105,
deptName: '计算机科学与技术系',
majorId: 1,
majorName: '计算机科学与技术',
classId: 101,
className: '计算机2001班',
address: '上海市浦东新区',
status: '0',
createTime: '2023-01-01 10:10:00',
remark: ''
},
{
studentId: 3,
studentNo: '202001003',
studentName: '王五',
nickName: '小王',
sex: '0',
age: 19,
phonenumber: '13800138003',
email: 'wangwu@example.com',
idCard: '110101200201011236',
deptId: 106,
deptName: '软件工程系',
majorId: 2,
majorName: '软件工程',
classId: 201,
className: '软工2001班',
address: '广州市天河区',
status: '0',
createTime: '2023-01-02 09:00:00',
remark: ''
},
{
studentId: 4,
studentNo: '202001004',
studentName: '赵六',
nickName: '小赵',
sex: '1',
age: 20,
phonenumber: '13800138004',
email: 'zhaoliu@example.com',
idCard: '110101200101011237',
deptId: 106,
deptName: '软件工程系',
majorId: 2,
majorName: '软件工程',
classId: 201,
className: '软工2001班',
address: '深圳市南山区',
status: '0',
createTime: '2023-01-02 10:30:00',
remark: ''
},
{
studentId: 5,
studentNo: '202001005',
studentName: '钱七',
nickName: '小钱',
sex: '1',
age: 21,
phonenumber: '13800138005',
email: 'qianqi@example.com',
idCard: '110101200001011238',
deptId: 107,
deptName: '人工智能系',
majorId: 3,
majorName: '人工智能',
classId: 301,
className: '人工智能2001班',
address: '杭州市西湖区',
status: '1', // 停用状态
createTime: '2023-01-03 11:20:00',
remark: '休学中'
}
];
// 模拟数据 - 院系树
const mockDeptTree = [
{
id: 100,
label: '信息学院',
children: [
{
id: 105,
label: '计算机科学与技术系',
children: []
},
{
id: 106,
label: '软件工程系',
children: []
},
{
id: 107,
label: '人工智能系',
children: []
}
]
},
{
id: 200,
label: '经济管理学院',
children: [
{
id: 205,
label: '市场营销系',
children: []
},
{
id: 206,
label: '财务管理系',
children: []
}
]
}
];
// 模拟数据 - 专业
const mockMajors = [
{
majorId: 1,
majorName: '计算机科学与技术',
deptId: 105
},
{
majorId: 2,
majorName: '软件工程',
deptId: 106
},
{
majorId: 3,
majorName: '人工智能',
deptId: 107
},
{
majorId: 4,
majorName: '市场营销',
deptId: 205
},
{
majorId: 5,
majorName: '财务管理',
deptId: 206
}
];
// 模拟数据 - 班级
const mockClasses = [
{
classId: 101,
className: '计算机2001班',
majorId: 1
},
{
classId: 102,
className: '计算机2002班',
majorId: 1
},
{
classId: 201,
className: '软工2001班',
majorId: 2
},
{
classId: 202,
className: '软工2002班',
majorId: 2
},
{
classId: 301,
className: '人工智能2001班',
majorId: 3
},
{
classId: 401,
className: '市场营销2001班',
majorId: 4
},
{
classId: 501,
className: '财务管理2001班',
majorId: 5
}
];
export default { listStudent, getStudent, addStudent, updateStudent, delStudent, deptTreeSelect, exportStudent, changeStudentStatus, XgDeptTreeSelect };
@@ -0,0 +1,63 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StudentMsgVO, StudentMsgForm, StudentMsgQuery } from '@/api/studentMsg/studentMsg/types';
/**
* 查询学生信息列表
* @param query
* @returns {*}
*/
export const listStudentMsg = (query?: StudentMsgQuery): AxiosPromise<StudentMsgVO[]> => {
return request({
url: '/studentMsg/studentMsg/list',
method: 'get',
params: query
});
};
/**
* 查询学生信息详细
* @param id
*/
export const getStudentMsg = (id: string | number): AxiosPromise<StudentMsgVO> => {
return request({
url: '/studentMsg/studentMsg/' + id,
method: 'get'
});
};
/**
* 新增学生信息
* @param data
*/
export const addStudentMsg = (data: StudentMsgForm) => {
return request({
url: '/studentMsg/studentMsg',
method: 'post',
data: data
});
};
/**
* 修改学生信息
* @param data
*/
export const updateStudentMsg = (data: StudentMsgForm) => {
return request({
url: '/studentMsg/studentMsg',
method: 'put',
data: data
});
};
/**
* 删除学生信息
* @param id
*/
export const delStudentMsg = (id: string | number | Array<string | number>) => {
return request({
url: '/studentMsg/studentMsg/' + id,
method: 'delete'
});
};
File diff suppressed because it is too large. Load diff
+80
View File
@@ -0,0 +1,80 @@
/**
* 部门树结构
*/
export interface XgDeptTreeVO extends BaseEntity {
id: number | string;
label: string;
parentId: number | string;
weight: number;
children: XgDeptTreeVO[];
disabled: boolean;
}
// 学生查询参数
export interface StudentQuery {
pageNum: number;
pageSize: number;
studentName?: string;
studentNo?: string;
phonenumber?: string;
status?: string;
deptId?: number;
}
// 学生视图对象
export interface StudentVO {
studentId: number | string;
studentNo: string;
studentName: string;
nickName?: string;
sex?: string;
age?: number;
phonenumber?: string;
email?: string;
idCard?: string;
deptId?: number;
deptName?: string;
majorId?: number;
majorName?: string;
classId?: number;
className?: string;
address?: string;
status?: string;
createBy?: number;
createTime?: string;
updateBy?: number;
updateTime?: string;
remark?: string;
}
// 学生表单对象
export interface StudentForm {
studentId?: number | string;
deptId?: number;
studentNo: string;
studentName: string;
nickName?: string;
password?: string;
phonenumber?: string;
email?: string;
idCard?: string;
sex?: string;
status?: string;
majorId?: number;
classId?: number;
address?: string;
remark?: string;
}
// 统一响应类型
export interface R<T> {
code: number;
msg: string;
data: T;
}
// 表格数据信息类型
export interface TableDataInfo<T> {
total: number;
rows: T;
}
@@ -0,0 +1,147 @@
<template>
<el-dialog
:title="mode === 'add' ? '新增' + getTypeLabel(type) : '编辑' + getTypeLabel(type)"
v-model="visible"
width="500px"
append-to-body
destroy-on-close
>
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入姓名" />
</el-form-item>
<el-form-item label="手机号码" prop="phone">
<el-input v-model="form.phone" placeholder="请输入手机号码" />
</el-form-item>
<el-form-item label="性别" prop="sex">
<el-radio-group v-model="form.sex">
<el-radio :label="0">男</el-radio>
<el-radio :label="1">女</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" @click="submitForm">确 定</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, reactive, watchEffect, computed } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';
const props = defineProps({
modelValue: {
type: Boolean,
default: false
},
mode: {
type: String,
default: 'add'
},
type: {
type: String,
default: 'school'
},
admin: {
type: Object,
default: () => ({})
}
});
const emit = defineEmits(['update:modelValue', 'submit']);
// 计算属性:对话框可见性
const visible = computed({
get: () => props.modelValue,
set: (value) => emit('update:modelValue', value)
});
// 表单和校验
const formRef = ref(null);
const form = reactive({
id: null,
name: '',
phone: '',
sex: 0,
remark: ''
});
// 表单校验规则
const rules = reactive({
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
phone: [
{ required: true, message: '请输入手机号码', trigger: 'blur' },
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' }
]
});
// 监听传入的admin数据,更新表单
watchEffect(() => {
if (props.admin) {
form.id = props.admin.id;
form.name = props.admin.name;
form.phone = props.admin.phone;
form.sex = props.admin.sex;
form.remark = props.admin.remark;
}
});
// 根据类型获取标签文本
function getTypeLabel(type) {
switch (type) {
case 'school':
return '全校管理员';
case 'custom':
return '自定义管理员';
case 'teacher':
return '班主任';
default:
return '管理员';
}
}
// 提交表单
function submitForm() {
formRef.value?.validate((valid) => {
if (valid) {
// 这里模拟保存
emit('submit', {
id: form.id,
name: form.name,
phone: form.phone,
sex: form.sex,
remark: form.remark,
scope: props.admin?.scope || ''
});
ElMessage.success('保存成功');
visible.value = false;
}
});
}
// 取消
function cancel() {
visible.value = false;
}
// 暴露组件以修复导出问题
defineExpose({
submitForm,
cancel
});
</script>
<style scoped>
.dialog-footer {
display: flex;
justify-content: flex-end;
}
</style>
@@ -0,0 +1,165 @@
<template>
<el-dialog :title="getScopeDialogTitle(type)" v-model="visible" width="600px" append-to-body destroy-on-close>
<el-form :model="form" label-width="100px">
<el-form-item :label="getScopeName(type)">
<div v-if="type === 'custom'">
<el-checkbox-group v-model="form.selectedScopes">
<el-checkbox v-for="item in scopeOptions.custom" :key="item.id" :label="item.id">
{{ item.name }}
</el-checkbox>
</el-checkbox-group>
</div>
<div v-else-if="type === 'teacher'">
<el-checkbox-group v-model="form.selectedScopes">
<el-checkbox v-for="item in scopeOptions.teacher" :key="item.id" :label="item.id">
{{ item.name }}
</el-checkbox>
</el-checkbox-group>
</div>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" @click="submitForm">确 定</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, reactive, computed } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';
const props = defineProps({
modelValue: {
type: Boolean,
default: false
},
admin: {
type: Object,
default: () => ({})
},
type: {
type: String,
default: 'custom'
}
});
const emit = defineEmits(['update:modelValue', 'submit']);
// 计算属性:对话框可见性
const visible = computed({
get: () => props.modelValue,
set: (value) => emit('update:modelValue', value)
});
// 范围选项(模拟数据)
const scopeOptions = {
custom: [
{ id: 1, name: '高一年级' },
{ id: 2, name: '高二年级' },
{ id: 3, name: '高三年级' },
{ id: 4, name: '初一年级' },
{ id: 5, name: '初二年级' },
{ id: 6, name: '初三年级' }
],
teacher: [
{ id: 101, name: '高一(1)班' },
{ id: 102, name: '高一(2)班' },
{ id: 103, name: '高一(3)班' },
{ id: 104, name: '高二(1)班' },
{ id: 105, name: '高二(2)班' },
{ id: 106, name: '高三(1)班' },
{ id: 107, name: '高三(2)班' }
]
};
// 表单数据
const form = reactive({
selectedScopes: [] as number[]
});
// 获取范围对话框标题
function getScopeDialogTitle(type: string) {
const name = props.admin?.name || '';
switch (type) {
case 'custom':
return `为【${name}】分配管理范围`;
case 'teacher':
return `为【${name}】分配班级`;
default:
return `为【${name}】分配范围`;
}
}
// 获取范围名称
function getScopeName(type: string) {
switch (type) {
case 'custom':
return '管理范围';
case 'teacher':
return '所管理班级';
default:
return '管理范围';
}
}
// 提交表单
function submitForm() {
// 组装要提交的数据
const selectedIds = form.selectedScopes;
let scopeName = '';
// 根据类型获取选中的名称
if (type.value === 'custom') {
scopeName = scopeOptions.custom
.filter((item) => selectedIds.includes(item.id))
.map((item) => item.name)
.join(', ');
} else if (type.value === 'teacher') {
scopeName = scopeOptions.teacher
.filter((item) => selectedIds.includes(item.id))
.map((item) => item.name)
.join(', ');
}
// 提交
emit('submit', {
sourceIds: selectedIds,
scopeName: scopeName
});
ElMessage.success('分配成功');
visible.value = false;
}
// 取消
function cancel() {
visible.value = false;
}
// 从props获取类型的响应式引用
const type = computed(() => props.type);
// 暴露组件以修复导出问题
defineExpose({
submitForm,
cancel
});
</script>
<style scoped>
.dialog-footer {
display: flex;
justify-content: flex-end;
}
.el-checkbox-group {
display: flex;
flex-wrap: wrap;
}
.el-checkbox {
margin-right: 15px;
margin-bottom: 10px;
}
</style>
+391
View File
@@ -0,0 +1,391 @@
<template>
<div class="p-2 page-container">
<el-card>
<el-tabs v-model="activeTab">
<el-tab-pane label="全校管理员" name="school">
<!-- 检索栏(全校管理员) -->
<div class="mb-[10px]">
<el-card shadow="hover">
<el-form :inline="true" :model="schoolSearchForm" class="search-form">
<el-form-item label="姓名">
<el-input v-model="schoolSearchForm.name" placeholder="请输入姓名" clearable @keyup.enter="handleSearch('school')" />
</el-form-item>
<el-form-item label="手机号码">
<el-input v-model="schoolSearchForm.phone" placeholder="请输入手机号码" clearable @keyup.enter="handleSearch('school')" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleSearch('school')">搜索</el-button>
<el-button icon="Refresh" @click="handleReset('school')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
<!-- 按钮+列表区域 -->
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="onAdd('school')">新增管理员</el-button>
</el-col>
</el-row>
</template>
<el-table :data="filteredAdmins('school')" border>
<el-table-column prop="name" label="姓名" align="center" />
<el-table-column prop="phone" label="手机号码" align="center" />
<el-table-column prop="sex" label="性别" align="center">
<template #default="scope">
{{ scope.row.sex === 0 ? '男' : '女' }}
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" align="center" />
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="编辑" placement="top">
<el-button link type="primary" plain icon="Edit" @click="onEdit('school', scope.row)" />
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button link type="danger" plain icon="Delete" @click="onDelete('school', scope.row)" />
</el-tooltip>
</template>
</el-table-column>
</el-table>
</el-card>
</el-tab-pane>
<el-tab-pane label="自定义管理员" name="custom">
<!-- 检索栏(自定义管理员) -->
<div class="mb-[10px]">
<el-card shadow="hover">
<el-form :inline="true" :model="customSearchForm" class="search-form">
<el-form-item label="姓名">
<el-input v-model="customSearchForm.name" placeholder="请输入姓名" clearable @keyup.enter="handleSearch('custom')" />
</el-form-item>
<el-form-item label="手机号码">
<el-input v-model="customSearchForm.phone" placeholder="请输入手机号码" clearable @keyup.enter="handleSearch('custom')" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleSearch('custom')">搜索</el-button>
<el-button icon="Refresh" @click="handleReset('custom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="onAdd('custom')">新增管理员</el-button>
</el-col>
</el-row>
</template>
<el-table :data="filteredAdmins('custom')" border>
<el-table-column prop="name" label="姓名" align="center" />
<el-table-column prop="phone" label="手机号码" align="center" />
<el-table-column prop="sex" label="性别" align="center">
<template #default="scope">
{{ scope.row.sex === 0 ? '男' : '女' }}
</template>
</el-table-column>
<el-table-column prop="scope" label="管理范围" align="center" />
<el-table-column prop="remark" label="备注" align="center" />
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="编辑" placement="top">
<el-button link type="primary" plain icon="Edit" @click="onEdit('custom', scope.row)" />
</el-tooltip>
<el-tooltip content="分配范围" placement="top">
<el-button link type="warning" plain icon="Setting" @click="onScope('custom', scope.row)" />
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button link type="danger" plain icon="Delete" @click="onDelete('custom', scope.row)" />
</el-tooltip>
</template>
</el-table-column>
</el-table>
</el-card>
</el-tab-pane>
<el-tab-pane label="班主任" name="teacher">
<!-- 检索栏(班主任) -->
<div class="mb-[10px]">
<el-card shadow="hover">
<el-form :inline="true" :model="teacherSearchForm" class="search-form">
<el-form-item label="姓名">
<el-input v-model="teacherSearchForm.name" placeholder="请输入姓名" clearable @keyup.enter="handleSearch('teacher')" />
</el-form-item>
<el-form-item label="手机号码">
<el-input v-model="teacherSearchForm.phone" placeholder="请输入手机号码" clearable @keyup.enter="handleSearch('teacher')" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleSearch('teacher')">搜索</el-button>
<el-button icon="Refresh" @click="handleReset('teacher')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="onAdd('teacher')">新增班主任</el-button>
</el-col>
</el-row>
</template>
<el-table :data="filteredAdmins('teacher')" border>
<el-table-column prop="name" label="姓名" align="center" />
<el-table-column prop="phone" label="手机号码" align="center" />
<el-table-column prop="sex" label="性别" align="center">
<template #default="scope">
{{ scope.row.sex === 0 ? '男' : '女' }}
</template>
</el-table-column>
<el-table-column prop="scope" label="所管理班级" align="center" />
<el-table-column prop="remark" label="备注" align="center" />
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="编辑" placement="top">
<el-button link type="primary" plain icon="Edit" @click="onEdit('teacher', scope.row)" />
</el-tooltip>
<el-tooltip content="分配班级" placement="top">
<el-button link type="warning" plain icon="Setting" @click="onScope('teacher', scope.row)" />
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button link type="danger" plain icon="Delete" @click="onDelete('teacher', scope.row)" />
</el-tooltip>
</template>
</el-table-column>
</el-table>
</el-card>
</el-tab-pane>
</el-tabs>
<admin-dialog v-model="dialogVisible" :mode="dialogMode" :admin="currentAdmin" :type="activeTab" @submit="onDialogSubmit" />
<scope-dialog v-model="scopeDialogVisible" :admin="currentAdmin" :type="scopeType" @submit="onScopeSubmit" />
</el-card>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import AdminDialog from './components/AdminDialog.vue';
import ScopeDialog from './components/ScopeDialog.vue';
import { ElMessage, ElMessageBox } from 'element-plus';
// 暴露组件以修复导出问题
defineExpose({});
// 导入改为使用模拟数据
// import { getAdminList, deleteAdmin, assignScope, getScopeNames } from '@/api/studentMsg/authmsg';
const activeTab = ref('school');
// 各tab独立检索表单
const schoolSearchForm = reactive({ name: '', phone: '' });
const customSearchForm = reactive({ name: '', phone: '' });
const teacherSearchForm = reactive({ name: '', phone: '' });
// 管理员数据
const schoolAdmins = ref([]);
const customAdmins = ref([]);
const teacherAdmins = ref([]);
const dialogVisible = ref(false);
const dialogMode = ref<'add' | 'edit'>('add');
const currentAdmin = ref<any>(null);
const scopeDialogVisible = ref(false);
const scopeType = ref('');
// 模拟数据
const mockData = {
school: [
{ id: 1, name: '张校长', phone: '13800138001', sex: 0, remark: '全校管理员' },
{ id: 2, name: '李主任', phone: '13800138002', sex: 1, remark: '教务处负责人' }
],
custom: [
{ id: 3, name: '王组长', phone: '13800138003', sex: 0, scope: '高一年级', remark: '年级组长' },
{ id: 4, name: '赵主管', phone: '13800138004', sex: 1, scope: '高二年级', remark: '年级负责人' }
],
teacher: [
{ id: 5, name: '刘老师', phone: '13800138005', sex: 0, scope: '高一(1)班', remark: '数学教师' },
{ id: 6, name: '陈老师', phone: '13800138006', sex: 1, scope: '高一(2)班', remark: '语文教师' }
]
};
// 获取管理员列表
async function fetchAdmins(type: string) {
// 实际项目中这里会调用API
// 此处使用模拟数据
try {
// 模拟API检索过滤
const searchForm = getSearchForm(type);
const filteredData = mockData[type].filter((item) => {
const nameMatch = !searchForm.name || item.name.includes(searchForm.name);
const phoneMatch = !searchForm.phone || item.phone.includes(searchForm.phone);
return nameMatch && phoneMatch;
});
// 更新对应类型的管理员数据
switch (type) {
case 'school':
schoolAdmins.value = filteredData;
break;
case 'custom':
customAdmins.value = filteredData;
break;
case 'teacher':
teacherAdmins.value = filteredData;
break;
}
} catch (error) {
console.error('获取管理员列表失败:', error);
ElMessage.error('获取管理员列表失败');
}
}
function getSearchForm(type: string) {
switch (type) {
case 'school':
return schoolSearchForm;
case 'custom':
return customSearchForm;
case 'teacher':
return teacherSearchForm;
default:
return schoolSearchForm;
}
}
onMounted(() => {
fetchAdmins('school');
fetchAdmins('custom');
fetchAdmins('teacher');
});
function onAdd(type: string) {
dialogMode.value = 'add';
currentAdmin.value = { id: null, name: '', phone: '', sex: 0, remark: '', scope: '' };
activeTab.value = type; // 确保当前标签页与点击的按钮一致
dialogVisible.value = true;
}
function onEdit(type: string, admin: any) {
dialogMode.value = 'edit';
currentAdmin.value = { ...admin };
activeTab.value = type; // 确保当前标签页与编辑的管理员类型一致
dialogVisible.value = true;
}
async function onDelete(type: string, admin: any) {
// 二次确认
ElMessageBox.confirm(`确定要删除管理员【${admin.name}】吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async () => {
try {
// 模拟删除成功
mockData[type] = mockData[type].filter((item) => item.id !== admin.id);
ElMessage.success('删除成功');
fetchAdmins(type); // 删除后刷新
} catch (e) {
ElMessage.error('删除失败');
}
})
.catch(() => {
// 用户取消
});
}
function onScope(type: string, admin: any) {
currentAdmin.value = { ...admin };
scopeType.value = type;
scopeDialogVisible.value = true;
}
function onDialogSubmit(admin: any) {
// 模拟添加或编辑操作
if (dialogMode.value === 'add') {
// 生成新ID
const newId = Math.max(...mockData[activeTab.value].map((item) => item.id), 0) + 1;
admin.id = newId;
mockData[activeTab.value].push(admin);
} else {
// 编辑
const index = mockData[activeTab.value].findIndex((item) => item.id === admin.id);
if (index !== -1) {
mockData[activeTab.value][index] = admin;
}
}
// 刷新列表数据
fetchAdmins(activeTab.value);
dialogVisible.value = false;
}
async function onScopeSubmit(scope: any) {
try {
// 模拟分配范围
const index = mockData[scopeType.value].findIndex((item) => item.id === currentAdmin.value.id);
if (index !== -1) {
mockData[scopeType.value][index].scope = scope.scopeName;
}
// 成功后刷新数据并提示
ElMessage.success('管理范围分配成功');
fetchAdmins(scopeType.value);
scopeDialogVisible.value = false;
} catch (error) {
ElMessage.error('管理范围分配失败');
console.error(error);
}
}
function getListByType(type: string) {
switch (type) {
case 'school':
return schoolAdmins;
case 'custom':
return customAdmins;
case 'teacher':
return teacherAdmins;
default:
return schoolAdmins;
}
}
// 过滤
function filteredAdmins(type: string) {
return getListByType(type).value;
}
function handleSearch(type: string) {
fetchAdmins(type);
}
function handleReset(type: string) {
switch (type) {
case 'school':
schoolSearchForm.name = '';
schoolSearchForm.phone = '';
break;
case 'custom':
customSearchForm.name = '';
customSearchForm.phone = '';
break;
case 'teacher':
teacherSearchForm.name = '';
teacherSearchForm.phone = '';
break;
}
fetchAdmins(type);
}
</script>
<style scoped>
.el-card {
padding: 8px !important;
}
.search-form {
display: flex;
flex-wrap: wrap;
align-items: center;
}
</style>
@@ -0,0 +1,713 @@
<template>
<div class="p-2">
<el-row :gutter="20">
<!-- 部门树 -->
<el-col :lg="4" :xs="24" style="">
<el-card shadow="hover">
<el-input v-model="deptName" placeholder="请输入院系名称" prefix-icon="Search" clearable />
<el-tree
ref="deptTreeRef"
class="mt-2"
node-key="id"
:data="deptOptions"
:props="{ label: 'label', children: 'children' }"
:expand-on-click-node="false"
:filter-node-method="filterNode"
highlight-current
default-expand-all
@node-click="handleNodeClick"
/>
</el-card>
</el-col>
<el-col :lg="20" :xs="24">
<transition enter-active-class="animate__animated animate__fadeIn" leave-active-class="animate__animated animate__fadeOut">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" inline>
<el-form-item label="学生姓名" prop="studentName">
<el-input v-model="queryParams.studentName" placeholder="请输入学生姓名" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="学号" prop="studentNo">
<el-input v-model="queryParams.studentNo" placeholder="请输入学号" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="手机号码" prop="phonenumber">
<el-input v-model="queryParams.phonenumber" placeholder="请输入手机号码" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="学生状态" clearable>
<el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="创建时间" style="width: 308px">
<el-date-picker
v-model="dateRange"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="hover">
<template #header>
<el-row :gutter="10">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd()">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button :disabled="single" icon="Edit" @click="handleUpdate()"> 修改 </el-button>
</el-col>
<el-col :span="1.5">
<el-button :disabled="multiple" icon="Delete" @click="handleDelete()"> 删除 </el-button>
</el-col>
<el-col :span="1.5">
<el-dropdown class="mt-[1px]">
<el-button>
更多
<el-icon class="el-icon--right"><arrow-down /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item icon="Download" @click="importTemplate">下载模板</el-dropdown-item>
<el-dropdown-item icon="Top" @click="handleImport">导入数据</el-dropdown-item>
<el-dropdown-item icon="Download" @click="handleExport">导出数据</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</el-col>
<right-toolbar v-model:show-search="showSearch" :columns="columns" :search="true" @query-table="getList"></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" border :data="studentList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column v-if="columns[0].visible" key="studentId" label="学生编号" align="center" prop="studentId" />
<el-table-column v-if="columns[1].visible" key="studentNo" label="学号" align="center" prop="studentNo" :show-overflow-tooltip="true" />
<el-table-column
v-if="columns[2].visible"
key="studentName"
label="姓名"
align="center"
prop="studentName"
:show-overflow-tooltip="true"
/>
<el-table-column v-if="columns[3].visible" key="deptName" label="院系" align="center" prop="deptName" :show-overflow-tooltip="true" />
<el-table-column v-if="columns[4].visible" key="majorName" label="专业" align="center" prop="majorName" :show-overflow-tooltip="true" />
<el-table-column v-if="columns[5].visible" key="className" label="班级" align="center" prop="className" :show-overflow-tooltip="true" />
<el-table-column v-if="columns[6].visible" key="phonenumber" label="手机号码" align="center" prop="phonenumber" width="120" />
<el-table-column v-if="columns[7].visible" key="status" label="状态" align="center">
<template #default="scope">
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
</template>
</el-table-column>
<el-table-column v-if="columns[8].visible" label="创建时间" align="center" prop="createTime" width="160">
<template #default="scope">
<span>{{ scope.row.createTime }}</span>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="240" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"></el-button>
</el-tooltip>
<el-tooltip content="重置密码" placement="top">
<el-button link type="primary" icon="Key" @click="handleResetPwd(scope.row)"></el-button>
</el-tooltip>
<el-tooltip content="详细信息" placement="top">
<el-button link type="primary" icon="View" @click="handleDetail(scope.row)"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
</el-card>
</el-col>
</el-row>
<!-- 添加或修改学生配置对话框 -->
<el-dialog v-model="dialog.visible" :title="dialog.title" width="600px" append-to-body @close="closeDialog">
<el-form ref="studentFormRef" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="学生姓名" prop="studentName">
<el-input v-model="form.studentName" placeholder="请输入学生姓名" maxlength="30" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="昵称" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入昵称" maxlength="30" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="归属院系" prop="deptId">
<el-tree-select
v-model="form.deptId"
:data="deptOptions"
:props="{ value: 'id', label: 'label', children: 'children' }"
value-key="id"
placeholder="请选择归属院系"
check-strictly
@change="handleDeptChange"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="专业" prop="majorId">
<el-select v-model="form.majorId" placeholder="请选择专业" @change="handleMajorChange">
<el-option v-for="item in majorOptions" :key="item.majorId" :label="item.majorName" :value="item.majorId"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="班级" prop="classId">
<el-select v-model="form.classId" placeholder="请选择班级">
<el-option v-for="item in classOptions" :key="item.classId" :label="item.className" :value="item.classId"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="手机号码" prop="phonenumber">
<el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="身份证号" prop="idCard">
<el-input v-model="form.idCard" placeholder="请输入身份证号" maxlength="18" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item v-if="form.studentId == undefined" label="学号" prop="studentNo">
<el-input v-model="form.studentNo" placeholder="请输入学号" maxlength="20" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item v-if="form.studentId == undefined" label="密码" prop="password">
<el-input v-model="form.password" placeholder="请输入密码" type="password" maxlength="20" show-password />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="学生性别">
<el-select v-model="form.sex" placeholder="请选择">
<el-option v-for="dict in sys_user_sex" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio v-for="dict in sys_normal_disable" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="地址" prop="address">
<el-input v-model="form.address" type="textarea" placeholder="请输入地址"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel()">取 消</el-button>
</div>
</template>
</el-dialog>
<!-- 学生详情对话框 -->
<el-dialog v-model="detailDialog.visible" :title="detailDialog.title" width="700px" append-to-body>
<el-descriptions :column="2" border>
<el-descriptions-item label="学生姓名">{{ detailForm.studentName }}</el-descriptions-item>
<el-descriptions-item label="学号">{{ detailForm.studentNo }}</el-descriptions-item>
<el-descriptions-item label="院系">{{ detailForm.deptName }}</el-descriptions-item>
<el-descriptions-item label="专业">{{ detailForm.majorName }}</el-descriptions-item>
<el-descriptions-item label="班级">{{ detailForm.className }}</el-descriptions-item>
<el-descriptions-item label="性别">
{{ detailForm.sex === '0' ? '男' : detailForm.sex === '1' ? '女' : '未知' }}
</el-descriptions-item>
<el-descriptions-item label="手机号码">{{ detailForm.phonenumber }}</el-descriptions-item>
<el-descriptions-item label="邮箱">{{ detailForm.email }}</el-descriptions-item>
<el-descriptions-item label="身份证号">{{ detailForm.idCard }}</el-descriptions-item>
<el-descriptions-item label="状态">
<el-tag :type="detailForm.status === '0' ? 'success' : 'danger'">
{{ detailForm.status === '0' ? '正常' : '停用' }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="地址" :span="2">{{ detailForm.address }}</el-descriptions-item>
<el-descriptions-item label="备注" :span="2">{{ detailForm.remark }}</el-descriptions-item>
</el-descriptions>
<template #footer>
<div class="dialog-footer">
<el-button @click="detailDialog.visible = false">关 闭</el-button>
</div>
</template>
</el-dialog>
<!-- 学生导入对话框 -->
<el-dialog v-model="upload.open" :title="upload.title" width="400px" append-to-body>
<el-upload
ref="uploadRef"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<el-icon class="el-icon--upload">
<i-ep-upload-filled />
</el-icon>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<template #tip>
<div class="text-center el-upload__tip">
<div class="el-upload__tip"><el-checkbox v-model="upload.updateSupport" />是否更新已经存在的学生数据</div>
<span>仅允许导入xls、xlsx格式文件。</span>
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板</el-link>
</div>
</template>
</el-upload>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import api from '@/api/studentMsg/index';
import { StudentForm, StudentQuery, StudentVO } from '@/api/studentMsg/types';
import { useRouter } from 'vue-router';
import { getCurrentInstance, ref, reactive, toRefs, watchEffect, onMounted } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import { to } from 'await-to-js';
import type { UploadFile, UploadInstance } from 'element-plus';
import type { FormInstance, TreeInstance } from 'element-plus';
interface ComponentInternalInstance {
proxy?: any;
}
const router = useRouter();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const sys_normal_disable = ref([
{ value: '0', label: '正常' },
{ value: '1', label: '停用' }
]);
const sys_user_sex = ref([
{ value: '0', label: '男' },
{ value: '1', label: '女' },
{ value: '2', label: '未知' }
]);
const studentList = ref<StudentVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<number | string>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const dateRange = ref<[string, string]>(['', '']);
const deptName = ref('');
const deptOptions = ref([]);
const majorOptions = ref([]);
const classOptions = ref([]);
// 列显隐信息
const columns = ref([
{ key: 0, label: `学生编号`, visible: false },
{ key: 1, label: `学号`, visible: true },
{ key: 2, label: `姓名`, visible: true },
{ key: 3, label: `院系`, visible: true },
{ key: 4, label: `专业`, visible: true },
{ key: 5, label: `班级`, visible: true },
{ key: 6, label: `手机号码`, visible: true },
{ key: 7, label: `状态`, visible: true },
{ key: 8, label: `创建时间`, visible: true }
]);
const deptTreeRef = ref<TreeInstance>();
const queryFormRef = ref<FormInstance>();
const studentFormRef = ref<FormInstance>();
const uploadRef = ref<UploadInstance>();
const initPassword = ref('123456');
const dialog = reactive({
visible: false,
title: ''
});
const detailDialog = reactive({
visible: false,
title: '学生详情'
});
const detailForm = reactive<StudentVO>({
studentId: '',
studentNo: '',
studentName: ''
});
// 导入参数
const upload = reactive({
// 是否显示弹出层
open: false,
// 弹出层标题
title: '',
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的数据
updateSupport: false,
// 设置上传的请求头部
headers: { Authorization: 'Bearer ' },
// 上传的地址
url: '/api/studentMsg/student/importData'
});
const initFormData: StudentForm = {
studentId: undefined,
deptId: undefined,
studentNo: '',
studentName: '',
nickName: '',
password: '',
phonenumber: '',
email: '',
idCard: '',
sex: '0',
status: '0',
majorId: undefined,
classId: undefined,
address: '',
remark: ''
};
const form = reactive<StudentForm>({
...initFormData
});
const rules = reactive({
studentName: [{ required: true, message: '学生姓名不能为空', trigger: 'blur' }],
studentNo: [{ required: true, message: '学号不能为空', trigger: 'blur' }],
password: [{ required: true, message: '密码不能为空', trigger: 'blur' }],
deptId: [{ required: true, message: '归属院系不能为空', trigger: 'blur' }],
majorId: [{ required: true, message: '专业不能为空', trigger: 'blur' }],
classId: [{ required: true, message: '班级不能为空', trigger: 'blur' }],
email: [{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }],
phonenumber: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' }],
idCard: [{ pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/, message: '请输入正确的身份证号码', trigger: 'blur' }]
});
const queryParams = reactive<StudentQuery>({
pageNum: 1,
pageSize: 10,
studentName: '',
studentNo: '',
phonenumber: '',
status: '',
deptId: undefined
});
/** 通过条件过滤节点 */
const filterNode = (value: string, data: any) => {
if (!value) return true;
return data.label.indexOf(value) !== -1;
};
/** 根据名称筛选部门树 */
watchEffect(
() => {
deptTreeRef.value?.filter(deptName.value);
},
{ flush: 'post' }
);
/** 查询学生列表 */
const getList = async () => {
loading.value = true;
const res = await api.listStudent(queryParams);
loading.value = false;
studentList.value = res.data.data.rows;
total.value = res.data.data.total;
};
/** 查询部门下拉树结构 */
const getDeptTree = async () => {
try {
const res = await api.XgDeptTreeSelect(101);
// XgDeptTreeSelect返回的数据结构与deptTreeSelect不同,需要进行适当处理
if (res.data && Array.isArray(res.data)) {
deptOptions.value = res.data;
} else {
console.warn('部门树数据格式不符合预期');
// 回退到默认处理
const backup = await api.deptTreeSelect();
deptOptions.value = backup.data.data;
}
} catch (error) {
console.error('获取部门树失败:', error);
// 如果API调用失败,可以使用默认的deptTreeSelect作为备选
const backup = await api.deptTreeSelect();
deptOptions.value = backup.data.data;
}
};
/** 节点单击事件 */
const handleNodeClick = (data: any) => {
queryParams.deptId = data.id;
handleQuery();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
dateRange.value = ['', ''];
queryFormRef.value?.resetFields();
queryParams.pageNum = 1;
queryParams.deptId = undefined;
deptTreeRef.value?.setCurrentKey(undefined);
handleQuery();
};
/** 删除按钮操作 */
const handleDelete = async (row?: StudentVO) => {
const studentIds = row?.studentId || ids.value;
const [err] = await to(ElMessageBox.confirm('是否确认删除学生编号为"' + studentIds + '"的数据项?', '提示'));
if (!err) {
await api.delStudent(studentIds);
await getList();
ElMessage.success('删除成功');
}
};
/** 学生状态修改 */
const handleStatusChange = async (row: StudentVO) => {
const text = row.status === '0' ? '启用' : '停用';
try {
await ElMessageBox.confirm('确认要"' + text + '""' + row.studentName + '"学生吗?', '提示');
await api.changeStudentStatus(row.studentId, row.status);
ElMessage.success(text + '成功');
} catch (err) {
row.status = row.status === '0' ? '1' : '0';
}
};
/** 查看详情按钮操作 */
const handleDetail = async (row: StudentVO) => {
Object.assign(detailForm, row);
detailDialog.visible = true;
};
/** 重置密码按钮操作 */
const handleResetPwd = async (row: StudentVO) => {
const [err, res] = await to(
ElMessageBox.prompt('请输入"' + row.studentName + '"的新密码', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
closeOnClickModal: false,
inputPattern: /^.{6,20}$/,
inputErrorMessage: '密码长度必须介于 6 和 20 之间'
})
);
if (!err && res) {
// 实际项目中需要调用重置密码API
ElMessage.success('修改成功,新密码是:' + res.value);
}
};
/** 选择条数 */
const handleSelectionChange = (selection: StudentVO[]) => {
ids.value = selection.map((item) => item.studentId);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 导入按钮操作 */
const handleImport = () => {
upload.title = '学生导入';
upload.open = true;
};
/** 导出按钮操作 */
const handleExport = () => {
// 实际项目中需要调用导出API
ElMessage.success('导出成功');
};
/** 下载模板操作 */
const importTemplate = () => {
// 实际项目中需要调用下载模板API
ElMessage.success('下载模板成功');
};
/**文件上传中处理 */
const handleFileUploadProgress = () => {
upload.isUploading = true;
};
/** 文件上传成功处理 */
const handleFileSuccess = (response: any) => {
upload.open = false;
upload.isUploading = false;
uploadRef.value?.clearFiles();
ElMessageBox.alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + '</div>', '导入结果', {
dangerouslyUseHTMLString: true
});
getList();
};
/** 提交上传文件 */
const submitFileForm = () => {
uploadRef.value?.submit();
};
/** 重置操作表单 */
const reset = () => {
Object.assign(form, initFormData);
studentFormRef.value?.resetFields();
majorOptions.value = [];
classOptions.value = [];
};
/** 取消按钮 */
const cancel = () => {
dialog.visible = false;
reset();
};
/** 新增按钮操作 */
const handleAdd = async () => {
reset();
dialog.visible = true;
dialog.title = '新增学生';
form.password = initPassword.value;
};
/** 修改按钮操作 */
const handleUpdate = async (row?: StudentForm) => {
reset();
const studentId = row?.studentId || ids.value[0];
const { data } = await api.getStudent(studentId);
dialog.visible = true;
dialog.title = '修改学生';
Object.assign(form, data.data.student);
majorOptions.value = data.data.majors;
classOptions.value = data.data.classes;
};
/** 院系变更事件 */
const handleDeptChange = (deptId: number) => {
form.majorId = undefined;
form.classId = undefined;
majorOptions.value = [];
classOptions.value = [];
// 根据院系ID过滤专业选项
const majors = api.getStudent().then((res) => {
return res.data.data.majors.filter((item: any) => item.deptId === deptId);
});
majors.then((data) => {
majorOptions.value = data;
});
};
/** 专业变更事件 */
const handleMajorChange = (majorId: number) => {
form.classId = undefined;
classOptions.value = [];
// 根据专业ID过滤班级选项
const classes = api.getStudent().then((res) => {
return res.data.data.classes.filter((item: any) => item.majorId === majorId);
});
classes.then((data) => {
classOptions.value = data;
});
};
/** 提交按钮 */
const submitForm = () => {
studentFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (form.studentId !== undefined) {
await api.updateStudent(form);
} else {
await api.addStudent(form);
}
ElMessage.success('操作成功');
dialog.visible = false;
await getList();
}
});
};
/**
* 关闭学生弹窗
*/
const closeDialog = () => {
dialog.visible = false;
reset();
};
onMounted(() => {
getDeptTree(); // 初始化部门数据
getList(); // 初始化列表数据
});
</script>