From f612d413477050a484c452b068e905742a261033 Mon Sep 17 00:00:00 2001 From: Guan Date: Mon, 24 Nov 2025 16:40:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=97=B6=E6=AE=B5?= =?UTF-8?q?=E8=A1=A8=EF=BC=8C=E7=94=A8=E4=BD=9C=E6=8E=92=E8=AF=BE=EF=BC=8C?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E4=BD=9C=E4=B8=BA=E8=AF=BE=E8=A1=A8=E4=BD=BF?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/like-admin/pom.xml | 2 + .../com/mdd/admin/config/JacksonConfig.java | 23 -- .../admin/controller/ClassroomController.java | 69 +++++ .../controller/ClassroomTypeController.java | 69 +++++ .../admin/controller/CourseController.java | 71 +++++ .../controller/CourseTypeController.java | 69 +++++ .../EquipmentRequirementController.java | 69 +++++ .../controller/StudentInfoController.java | 23 +- .../admin/controller/TimeSlotController.java | 71 +++++ .../admin/controller/UploadController.java | 2 +- .../com/mdd/admin/dto/CourseExcelDTO.java | 64 +++++ .../java/com/mdd/admin/dto/ExcelErrorDTO.java | 18 ++ .../com/mdd/admin/dto/TimeSlotCreateDTO.java | 16 ++ .../course/CourseExcelValidationListener.java | 176 ++++++++++++ .../CourseTypeExcelValidationListener.java | 104 ++++++++ .../course/ExcelValidationListener.java | 84 ++++++ .../mdd/admin/service/IClassroomService.java | 60 +++++ .../admin/service/IClassroomTypeService.java | 60 +++++ .../com/mdd/admin/service/ICourseService.java | 20 ++ .../mdd/admin/service/ICourseTypeService.java | 60 +++++ .../service/IEquipmentRequirementService.java | 60 +++++ .../admin/service/IStudentInfoService.java | 18 +- .../mdd/admin/service/ITimeSlotService.java | 64 +++++ .../service/impl/ClassroomServiceImpl.java | 172 ++++++++++++ .../impl/ClassroomTypeServiceImpl.java | 155 +++++++++++ .../admin/service/impl/CourseServiceImpl.java | 191 +++++++++++-- .../service/impl/CourseTypeServiceImpl.java | 146 ++++++++++ .../impl/EquipmentRequirementServiceImpl.java | 154 +++++++++++ .../service/impl/StudentInfoServiceImpl.java | 211 ++++++++++----- .../service/impl/TimeSlotServiceImpl.java | 250 ++++++++++++++++++ .../service/impl/admin/AdminServiceImpl.java | 2 +- .../impl/system/SystemMenuServiceImpl.java | 35 ++- .../validate/ClassroomCreateValidate.java | 42 +++ .../validate/ClassroomSearchValidate.java | 29 ++ .../validate/ClassroomTypeCreateValidate.java | 30 +++ .../validate/ClassroomTypeSearchValidate.java | 23 ++ .../validate/ClassroomTypeUpdateValidate.java | 39 +++ .../validate/ClassroomUpdateValidate.java | 51 ++++ .../validate/StudentInfoCreateValidate.java | 104 ++++++++ .../validate/StudentInfoSearchValidate.java | 61 +++++ ...te.java => StudentInfoUpdateValidate.java} | 76 +++--- .../TimeSlotForRowUpdateValidate.java | 34 +++ .../validate/TimeSlotInsertValidate.java | 33 +++ .../validate/TimeSlotSearchValidate.java | 29 ++ .../validate/TimeSlotSectionDelValidate.java | 19 ++ .../validate/TimeSlotUniformValidate.java | 22 ++ .../validate/TimeSlotUpdateValidate.java | 31 +++ .../admin/validate/commons/NumValidate.java | 18 ++ .../validate/course/CourseCreateValidate.java | 18 +- .../validate/course/CourseSearchValidate.java | 4 +- .../course/CourseTypeCreateValidate.java | 25 ++ .../course/CourseTypeSearchValidate.java | 17 ++ .../course/CourseTypeUpdateValidate.java | 34 +++ .../validate/course/CourseUpdateValidate.java | 8 +- .../EquipmentRequirementCreateValidate.java | 34 +++ .../EquipmentRequirementSearchValidate.java | 26 ++ .../EquipmentRequirementUpdateValidate.java | 44 +++ .../validate/major/MajorCreateValidate.java | 7 + .../student/StudentInfoSearchValidate.java | 97 ------- .../student/StudentInfoUpdateValidate.java | 101 ------- .../com/mdd/admin/vo/ClassroomDetailVo.java | 43 +++ .../com/mdd/admin/vo/ClassroomListedVo.java | 49 ++++ .../mdd/admin/vo/ClassroomTypeDetailVo.java | 31 +++ .../mdd/admin/vo/ClassroomTypeListedVo.java | 37 +++ .../vo/EquipmentRequirementDetailVo.java | 36 +++ .../vo/EquipmentRequirementListedVo.java | 42 +++ .../vo/{student => }/StudentInfoDetailVo.java | 48 ++-- .../vo/{student => }/StudentInfoListedVo.java | 56 ++-- .../com/mdd/admin/vo/TimeSlotDetailVo.java | 44 +++ .../com/mdd/admin/vo/TimeSlotListedVo.java | 50 ++++ .../mdd/admin/vo/course/CourseDetailVo.java | 7 +- .../mdd/admin/vo/course/CourseListedVo.java | 7 +- .../admin/vo/course/CourseTypeDetailVo.java | 28 ++ .../admin/vo/course/CourseTypeListedVo.java | 31 +++ .../java/com/mdd/common/entity/Classroom.java | 51 ++++ .../com/mdd/common/entity/ClassroomType.java | 42 +++ .../java/com/mdd/common/entity/Course.java | 7 +- .../mdd/common/entity/CourseEquipment.java | 30 +++ .../com/mdd/common/entity/CourseType.java | 33 +++ .../common/entity/EquipmentRequirement.java | 44 +++ .../java/com/mdd/common/entity/Major.java | 2 +- .../com/mdd/common/entity/StudentInfo.java | 37 ++- .../java/com/mdd/common/entity/TimeSlot.java | 55 ++++ .../java/com/mdd/common/enums/ErrorType.java | 13 + .../common/exception/OperateException.java | 1 + .../mdd/common/mapper/ClassroomMapper.java | 13 + .../common/mapper/ClassroomTypeMapper.java | 13 + .../common/mapper/CourseEquipmentMapper.java | 13 + .../mdd/common/mapper/CourseTypeMapper.java | 13 + .../mapper/EquipmentRequirementMapper.java | 13 + .../com/mdd/common/mapper/TimeSlotMapper.java | 13 + .../src/main/resources/application.yml | 2 +- server/pom.xml | 2 +- sql/install.sql | 132 +++++++-- 94 files changed, 4191 insertions(+), 491 deletions(-) delete mode 100644 server/like-admin/src/main/java/com/mdd/admin/config/JacksonConfig.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/controller/ClassroomController.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/controller/ClassroomTypeController.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/controller/CourseTypeController.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/controller/EquipmentRequirementController.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/controller/TimeSlotController.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/dto/CourseExcelDTO.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/dto/ExcelErrorDTO.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/dto/TimeSlotCreateDTO.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/excelListener/course/CourseExcelValidationListener.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/excelListener/course/CourseTypeExcelValidationListener.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/excelListener/course/ExcelValidationListener.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/service/IClassroomService.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/service/IClassroomTypeService.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/service/ICourseTypeService.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/service/IEquipmentRequirementService.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/service/ITimeSlotService.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/service/impl/ClassroomServiceImpl.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/service/impl/ClassroomTypeServiceImpl.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/service/impl/CourseTypeServiceImpl.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/service/impl/EquipmentRequirementServiceImpl.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/service/impl/TimeSlotServiceImpl.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomCreateValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomSearchValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomTypeCreateValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomTypeSearchValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomTypeUpdateValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomUpdateValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoCreateValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoSearchValidate.java rename server/like-admin/src/main/java/com/mdd/admin/validate/{student/StudentInfoCreateValidate.java => StudentInfoUpdateValidate.java} (63%) create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotForRowUpdateValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotInsertValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotSearchValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotSectionDelValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotUniformValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotUpdateValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/commons/NumValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseTypeCreateValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseTypeSearchValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseTypeUpdateValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/equipmentRequirement/EquipmentRequirementCreateValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/equipmentRequirement/EquipmentRequirementSearchValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/equipmentRequirement/EquipmentRequirementUpdateValidate.java delete mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/student/StudentInfoSearchValidate.java delete mode 100644 server/like-admin/src/main/java/com/mdd/admin/validate/student/StudentInfoUpdateValidate.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomDetailVo.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomListedVo.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomTypeDetailVo.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomTypeListedVo.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/vo/EquipmentRequirementDetailVo.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/vo/EquipmentRequirementListedVo.java rename server/like-admin/src/main/java/com/mdd/admin/vo/{student => }/StudentInfoDetailVo.java (71%) rename server/like-admin/src/main/java/com/mdd/admin/vo/{student => }/StudentInfoListedVo.java (67%) create mode 100644 server/like-admin/src/main/java/com/mdd/admin/vo/TimeSlotDetailVo.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/vo/TimeSlotListedVo.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseTypeDetailVo.java create mode 100644 server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseTypeListedVo.java create mode 100644 server/like-common/src/main/java/com/mdd/common/entity/Classroom.java create mode 100644 server/like-common/src/main/java/com/mdd/common/entity/ClassroomType.java create mode 100644 server/like-common/src/main/java/com/mdd/common/entity/CourseEquipment.java create mode 100644 server/like-common/src/main/java/com/mdd/common/entity/CourseType.java create mode 100644 server/like-common/src/main/java/com/mdd/common/entity/EquipmentRequirement.java create mode 100644 server/like-common/src/main/java/com/mdd/common/entity/TimeSlot.java create mode 100644 server/like-common/src/main/java/com/mdd/common/enums/ErrorType.java create mode 100644 server/like-common/src/main/java/com/mdd/common/mapper/ClassroomMapper.java create mode 100644 server/like-common/src/main/java/com/mdd/common/mapper/ClassroomTypeMapper.java create mode 100644 server/like-common/src/main/java/com/mdd/common/mapper/CourseEquipmentMapper.java create mode 100644 server/like-common/src/main/java/com/mdd/common/mapper/CourseTypeMapper.java create mode 100644 server/like-common/src/main/java/com/mdd/common/mapper/EquipmentRequirementMapper.java create mode 100644 server/like-common/src/main/java/com/mdd/common/mapper/TimeSlotMapper.java diff --git a/server/like-admin/pom.xml b/server/like-admin/pom.xml index 3555915a..1c334059 100644 --- a/server/like-admin/pom.xml +++ b/server/like-admin/pom.xml @@ -55,6 +55,8 @@ + + diff --git a/server/like-admin/src/main/java/com/mdd/admin/config/JacksonConfig.java b/server/like-admin/src/main/java/com/mdd/admin/config/JacksonConfig.java deleted file mode 100644 index 69e81b49..00000000 --- a/server/like-admin/src/main/java/com/mdd/admin/config/JacksonConfig.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.mdd.admin.config; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.PropertyNamingStrategies; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class JacksonConfig { - - @Bean - public ObjectMapper objectMapper() { - ObjectMapper objectMapper = new ObjectMapper(); - // 1. 下划线转驼峰(解决命名不一致问题) - objectMapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE); - - // 2. 忽略未知属性(解决前端多余字段的警告/异常) - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - return objectMapper; - } -} \ No newline at end of file diff --git a/server/like-admin/src/main/java/com/mdd/admin/controller/ClassroomController.java b/server/like-admin/src/main/java/com/mdd/admin/controller/ClassroomController.java new file mode 100644 index 00000000..6b2262ad --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/controller/ClassroomController.java @@ -0,0 +1,69 @@ +package com.mdd.admin.controller; + +import com.mdd.admin.aop.Log; +import com.mdd.admin.service.IClassroomService; +import com.mdd.admin.validate.commons.IdValidate; +import com.mdd.admin.validate.ClassroomCreateValidate; +import com.mdd.admin.validate.ClassroomUpdateValidate; +import com.mdd.admin.validate.ClassroomSearchValidate; +import com.mdd.admin.validate.commons.PageValidate; +import com.mdd.admin.vo.ClassroomListedVo; +import com.mdd.admin.vo.ClassroomDetailVo; +import com.mdd.common.core.AjaxResult; +import com.mdd.common.core.PageResult; +import com.mdd.common.validator.annotation.IDMust; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +@RestController +@RequestMapping("adminapi/classroom") +@Api(tags = "教室管理") +public class ClassroomController { + + @Resource + IClassroomService iClassroomService; + + @GetMapping("/list") + @ApiOperation(value="教室列表") + public AjaxResult> list(@Validated PageValidate pageValidate, + @Validated ClassroomSearchValidate searchValidate) { + PageResult list = iClassroomService.list(pageValidate, searchValidate); + return AjaxResult.success(list); + } + + @GetMapping("/detail") + @ApiOperation(value="教室详情") + public AjaxResult detail(@Validated @IDMust() @RequestParam("id") Integer id) { + ClassroomDetailVo detail = iClassroomService.detail(id); + return AjaxResult.success(detail); + } + + @Log(title = "教室新增") + @PostMapping("/add") + @ApiOperation(value="教室新增") + public AjaxResult add(@Validated @RequestBody ClassroomCreateValidate createValidate) { + iClassroomService.add(createValidate); + return AjaxResult.success(); + } + + @Log(title = "教室编辑") + @PostMapping("/edit") + @ApiOperation(value="教室编辑") + public AjaxResult edit(@Validated @RequestBody ClassroomUpdateValidate updateValidate) { + iClassroomService.edit(updateValidate); + return AjaxResult.success(); + } + + @Log(title = "教室删除") + @PostMapping("/del") + @ApiOperation(value="教室删除") + public AjaxResult del(@Validated @RequestBody IdValidate idValidate) { + iClassroomService.del(idValidate.getId()); + return AjaxResult.success(); + } + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/controller/ClassroomTypeController.java b/server/like-admin/src/main/java/com/mdd/admin/controller/ClassroomTypeController.java new file mode 100644 index 00000000..e8ae9445 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/controller/ClassroomTypeController.java @@ -0,0 +1,69 @@ +package com.mdd.admin.controller; + +import com.mdd.admin.aop.Log; +import com.mdd.admin.service.IClassroomTypeService; +import com.mdd.admin.validate.commons.IdValidate; +import com.mdd.admin.validate.ClassroomTypeCreateValidate; +import com.mdd.admin.validate.ClassroomTypeUpdateValidate; +import com.mdd.admin.validate.ClassroomTypeSearchValidate; +import com.mdd.admin.validate.commons.PageValidate; +import com.mdd.admin.vo.ClassroomTypeListedVo; +import com.mdd.admin.vo.ClassroomTypeDetailVo; +import com.mdd.common.core.AjaxResult; +import com.mdd.common.core.PageResult; +import com.mdd.common.validator.annotation.IDMust; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +@RestController +@RequestMapping("adminapi/type") +@Api(tags = "教室类型管理") +public class ClassroomTypeController { + + @Resource + IClassroomTypeService iClassroomTypeService; + + @GetMapping("/list") + @ApiOperation(value="教室类型列表") + public AjaxResult> list(@Validated PageValidate pageValidate, + @Validated ClassroomTypeSearchValidate searchValidate) { + PageResult list = iClassroomTypeService.list(pageValidate, searchValidate); + return AjaxResult.success(list); + } + + @GetMapping("/detail") + @ApiOperation(value="教室类型详情") + public AjaxResult detail(@Validated @IDMust() @RequestParam("id") Integer id) { + ClassroomTypeDetailVo detail = iClassroomTypeService.detail(id); + return AjaxResult.success(detail); + } + + @Log(title = "教室类型新增") + @PostMapping("/add") + @ApiOperation(value="教室类型新增") + public AjaxResult add(@Validated @RequestBody ClassroomTypeCreateValidate createValidate) { + iClassroomTypeService.add(createValidate); + return AjaxResult.success(); + } + + @Log(title = "教室类型编辑") + @PostMapping("/edit") + @ApiOperation(value="教室类型编辑") + public AjaxResult edit(@Validated @RequestBody ClassroomTypeUpdateValidate updateValidate) { + iClassroomTypeService.edit(updateValidate); + return AjaxResult.success(); + } + + @Log(title = "教室类型删除") + @PostMapping("/del") + @ApiOperation(value="教室类型删除") + public AjaxResult del(@Validated @RequestBody IdValidate idValidate) { + iClassroomTypeService.del(idValidate.getId()); + return AjaxResult.success(); + } + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/controller/CourseController.java b/server/like-admin/src/main/java/com/mdd/admin/controller/CourseController.java index bc0e853f..fbdb06cd 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/controller/CourseController.java +++ b/server/like-admin/src/main/java/com/mdd/admin/controller/CourseController.java @@ -1,6 +1,8 @@ package com.mdd.admin.controller; +import com.alibaba.fastjson2.JSONObject; import com.mdd.admin.aop.Log; +import com.mdd.admin.dto.ExcelErrorDTO; import com.mdd.admin.service.ICourseService; import com.mdd.admin.validate.commons.IdValidate; import com.mdd.admin.validate.course.CourseCreateValidate; @@ -11,13 +13,18 @@ import com.mdd.admin.vo.course.CourseListedVo; import com.mdd.admin.vo.course.CourseDetailVo; import com.mdd.common.core.AjaxResult; import com.mdd.common.core.PageResult; +import com.mdd.common.enums.ErrorEnum; +import com.mdd.common.exception.OperateException; +import com.mdd.common.util.UrlUtils; import com.mdd.common.validator.annotation.IDMust; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import java.util.List; @RestController @RequestMapping("adminapi/course") @@ -66,4 +73,68 @@ public class CourseController { return AjaxResult.success(); } + @Log(title = "获取课程导入模板") + @GetMapping("/template") + @ApiOperation(value = "获取课程导入模板") + public AjaxResult downloadTemplate(){ + String path = UrlUtils.toAdminAbsoluteUrl("/template/课程导入表.xlsx"); + return AjaxResult.success(2, new JSONObject() {{ + put("url", path); + }}, ErrorEnum.SHOW_MSG.getCode()); + } + + @Log(title = "上传课程导入模板") + @PostMapping("/upload.template") + @ApiOperation(value = "上传课程导入模板") + public AjaxResult uploadTemplate(@RequestParam("file")MultipartFile file) { + iCourseService.upload(file); + return AjaxResult.success("成功上传导入模板"); + } + + @Log(title = "检查导入课程信息") + @PostMapping(value = "/batch.add") + @ApiOperation(value = "检查导入课程信息") + public AjaxResult checkByExcel(@RequestParam("file") MultipartFile file) { + // 1. 基础校验:文件非空 + if (file == null || file.isEmpty()) { + throw new OperateException("上传文件不能为空"); + } + + // 2. 基础校验:文件格式 + String fileName = file.getOriginalFilename(); + if (fileName == null || (!fileName.endsWith(".xlsx") && !fileName.endsWith(".xls"))) { + throw new OperateException("只支持.xls和.xlsx格式的文件"); + } + try { + List errorList = iCourseService.checkExcel(file); + if (errorList.isEmpty()) { + List newCourseType = iCourseService.checkCourseType(file); + if(newCourseType.isEmpty()) { + iCourseService.addByExcel(file); + return AjaxResult.success("课程信息校验通过,已添加新课程"); + } + else return AjaxResult.success(202, "发现未定义的课程类型", newCourseType); + } + else { + // 有错误:返回错误列表(前端可展示每行错误) + return AjaxResult.failed(403,"课程信息校验未通过", errorList); + } + } catch (OperateException e) { + // 业务异常:返回具体原因 + return AjaxResult.failed(e.getMessage()); + } catch (Exception e) { + // 系统异常:返回通用提示 + return AjaxResult.failed("系统异常,请联系管理员" + e.getMessage()); + } + } } + + + + + + + + + + diff --git a/server/like-admin/src/main/java/com/mdd/admin/controller/CourseTypeController.java b/server/like-admin/src/main/java/com/mdd/admin/controller/CourseTypeController.java new file mode 100644 index 00000000..abf0e899 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/controller/CourseTypeController.java @@ -0,0 +1,69 @@ +package com.mdd.admin.controller; + +import com.mdd.admin.aop.Log; +import com.mdd.admin.service.ICourseTypeService; +import com.mdd.admin.validate.commons.IdValidate; +import com.mdd.admin.validate.course.CourseTypeCreateValidate; +import com.mdd.admin.validate.course.CourseTypeUpdateValidate; +import com.mdd.admin.validate.course.CourseTypeSearchValidate; +import com.mdd.admin.validate.commons.PageValidate; +import com.mdd.admin.vo.course.CourseTypeListedVo; +import com.mdd.admin.vo.course.CourseTypeDetailVo; +import com.mdd.common.core.AjaxResult; +import com.mdd.common.core.PageResult; +import com.mdd.common.validator.annotation.IDMust; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +@RestController +@RequestMapping("adminapi/course.type") +@Api(tags = "课程类型管理") +public class CourseTypeController { + + @Resource + ICourseTypeService iCourseTypeService; + + @GetMapping("/list") + @ApiOperation(value="课程类型列表") + public AjaxResult> list(@Validated PageValidate pageValidate, + @Validated CourseTypeSearchValidate searchValidate) { + PageResult list = iCourseTypeService.list(pageValidate, searchValidate); + return AjaxResult.success(list); + } + + @GetMapping("/detail") + @ApiOperation(value="课程类型详情") + public AjaxResult detail(@Validated @IDMust() @RequestParam("id") Integer id) { + CourseTypeDetailVo detail = iCourseTypeService.detail(id); + return AjaxResult.success(detail); + } + + @Log(title = "课程类型新增") + @PostMapping("/add") + @ApiOperation(value="课程类型新增") + public AjaxResult add(@Validated @RequestBody CourseTypeCreateValidate createValidate) { + iCourseTypeService.add(createValidate); + return AjaxResult.success(); + } + + @Log(title = "课程类型编辑") + @PostMapping("/edit") + @ApiOperation(value="课程类型编辑") + public AjaxResult edit(@Validated @RequestBody CourseTypeUpdateValidate updateValidate) { + iCourseTypeService.edit(updateValidate); + return AjaxResult.success(); + } + + @Log(title = "课程类型删除") + @PostMapping("/del") + @ApiOperation(value="课程类型删除") + public AjaxResult del(@Validated @RequestBody IdValidate idValidate) { + iCourseTypeService.del(idValidate.getId()); + return AjaxResult.success(); + } + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/controller/EquipmentRequirementController.java b/server/like-admin/src/main/java/com/mdd/admin/controller/EquipmentRequirementController.java new file mode 100644 index 00000000..9a483d87 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/controller/EquipmentRequirementController.java @@ -0,0 +1,69 @@ +package com.mdd.admin.controller; + +import com.mdd.admin.aop.Log; +import com.mdd.admin.service.IEquipmentRequirementService; +import com.mdd.admin.validate.commons.IdValidate; +import com.mdd.admin.validate.equipmentRequirement.EquipmentRequirementCreateValidate; +import com.mdd.admin.validate.equipmentRequirement.EquipmentRequirementUpdateValidate; +import com.mdd.admin.validate.equipmentRequirement.EquipmentRequirementSearchValidate; +import com.mdd.admin.validate.commons.PageValidate; +import com.mdd.admin.vo.EquipmentRequirementListedVo; +import com.mdd.admin.vo.EquipmentRequirementDetailVo; +import com.mdd.common.core.AjaxResult; +import com.mdd.common.core.PageResult; +import com.mdd.common.validator.annotation.IDMust; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +@RestController +@RequestMapping("adminapi/requirement") +@Api(tags = "设备要求管理") +public class EquipmentRequirementController { + + @Resource + IEquipmentRequirementService iEquipmentRequirementService; + + @GetMapping("/list") + @ApiOperation(value="设备要求列表") + public AjaxResult> list(@Validated PageValidate pageValidate, + @Validated EquipmentRequirementSearchValidate searchValidate) { + PageResult list = iEquipmentRequirementService.list(pageValidate, searchValidate); + return AjaxResult.success(list); + } + + @GetMapping("/detail") + @ApiOperation(value="设备要求详情") + public AjaxResult detail(@Validated @IDMust() @RequestParam("id") Integer id) { + EquipmentRequirementDetailVo detail = iEquipmentRequirementService.detail(id); + return AjaxResult.success(detail); + } + + @Log(title = "设备要求新增") + @PostMapping("/add") + @ApiOperation(value="设备要求新增") + public AjaxResult add(@Validated @RequestBody EquipmentRequirementCreateValidate createValidate) { + iEquipmentRequirementService.add(createValidate); + return AjaxResult.success(); + } + + @Log(title = "设备要求编辑") + @PostMapping("/edit") + @ApiOperation(value="设备要求编辑") + public AjaxResult edit(@Validated @RequestBody EquipmentRequirementUpdateValidate updateValidate) { + iEquipmentRequirementService.edit(updateValidate); + return AjaxResult.success(); + } + + @Log(title = "设备要求删除") + @PostMapping("/del") + @ApiOperation(value="设备要求删除") + public AjaxResult del(@Validated @RequestBody IdValidate idValidate) { + iEquipmentRequirementService.del(idValidate.getId()); + return AjaxResult.success(); + } + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/controller/StudentInfoController.java b/server/like-admin/src/main/java/com/mdd/admin/controller/StudentInfoController.java index 5edb2a72..c43c34cb 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/controller/StudentInfoController.java +++ b/server/like-admin/src/main/java/com/mdd/admin/controller/StudentInfoController.java @@ -3,12 +3,13 @@ package com.mdd.admin.controller; import com.mdd.admin.aop.Log; import com.mdd.admin.service.IStudentInfoService; import com.mdd.admin.validate.commons.IdValidate; -import com.mdd.admin.validate.student.StudentInfoCreateValidate; -import com.mdd.admin.validate.student.StudentInfoUpdateValidate; -import com.mdd.admin.validate.student.StudentInfoSearchValidate; +import com.mdd.admin.validate.StudentInfoCreateValidate; +import com.mdd.admin.validate.StudentInfoUpdateValidate; +import com.mdd.admin.validate.StudentInfoSearchValidate; +import com.mdd.admin.validate.commons.NumValidate; import com.mdd.admin.validate.commons.PageValidate; -import com.mdd.admin.vo.student.StudentInfoListedVo; -import com.mdd.admin.vo.student.StudentInfoDetailVo; +import com.mdd.admin.vo.StudentInfoListedVo; +import com.mdd.admin.vo.StudentInfoDetailVo; import com.mdd.common.core.AjaxResult; import com.mdd.common.core.PageResult; import com.mdd.common.validator.annotation.IDMust; @@ -66,11 +67,11 @@ public class StudentInfoController { return AjaxResult.success(); } - @PostMapping("/create.random.info/") - @ApiOperation("创建随机学生信息(测试用)") - public AjaxResult createRandomInfo(Integer num) { - iStudentInfoService.createRandomInfo(num); - return AjaxResult.success("成功创建个"+num+"个学生"); + @Log(title = "添加随机学生信息") + @PostMapping("/create.random.info") + @ApiOperation(value = "添加随机学生信息") + public AjaxResult createRandomInfo(@Validated @RequestBody NumValidate numValidate) { + iStudentInfoService.createRandomInfo(numValidate.getNum()); + return AjaxResult.success(); } - } diff --git a/server/like-admin/src/main/java/com/mdd/admin/controller/TimeSlotController.java b/server/like-admin/src/main/java/com/mdd/admin/controller/TimeSlotController.java new file mode 100644 index 00000000..628204ee --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/controller/TimeSlotController.java @@ -0,0 +1,71 @@ +package com.mdd.admin.controller; + +import com.mdd.admin.aop.Log; +import com.mdd.admin.service.ITimeSlotService; +import com.mdd.admin.validate.*; +import com.mdd.admin.vo.TimeSlotListedVo; +import com.mdd.admin.vo.TimeSlotDetailVo; +import com.mdd.common.core.AjaxResult; +import com.mdd.common.validator.annotation.IDMust; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +@RestController +@RequestMapping("adminapi/slot") +@Api(tags = "时间段管理") +public class TimeSlotController { + + @Resource + ITimeSlotService iTimeSlotService; + + @GetMapping("/list") + @ApiOperation(value="时间段列表") + public AjaxResult> list() { + List list = iTimeSlotService.list(); + return AjaxResult.success(list); + } + + @GetMapping("/detail") + @ApiOperation(value="时间段详情") + public AjaxResult detail(@Validated @IDMust() @RequestParam("id") Integer id) { + TimeSlotDetailVo detail = iTimeSlotService.detail(id); + return AjaxResult.success(detail); + } + + @Log(title = "插入节次") + @PostMapping("/insert") + @ApiOperation(value="插入节次") + public AjaxResult insert(@Validated @RequestBody TimeSlotInsertValidate insertValidate) { + iTimeSlotService.insert(insertValidate); + return AjaxResult.success(); + } + + @Log(title = "修改节次") + @PostMapping("/edit") + @ApiOperation(value="时间段编辑") + public AjaxResult edit(@Validated @RequestBody TimeSlotForRowUpdateValidate updateValidate) { + iTimeSlotService.edit(updateValidate); + return AjaxResult.success(); + } + + @Log(title = "删除节次") + @PostMapping("/del") + @ApiOperation(value="时间段删除") + public AjaxResult del(@Validated @RequestBody TimeSlotSectionDelValidate sectionDelValidate) { + iTimeSlotService.del(sectionDelValidate.getCount()); + return AjaxResult.success(); + } + + @Log(title = "统一节次时长") + @PostMapping("/uniform") + @ApiOperation(value = "统一节次时长") + public AjaxResult uniform(@Validated @RequestBody TimeSlotUniformValidate uniformValidate) { + iTimeSlotService.uniform(uniformValidate, null,1); + return AjaxResult.success(); + } +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/controller/UploadController.java b/server/like-admin/src/main/java/com/mdd/admin/controller/UploadController.java index c886c858..337d5243 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/controller/UploadController.java +++ b/server/like-admin/src/main/java/com/mdd/admin/controller/UploadController.java @@ -79,7 +79,7 @@ public class UploadController { for (MultipartFile file : files) { StorageDriver storageDriver = new StorageDriver(); - UploadFilesVo vo = storageDriver.upload(file, "image", AlbumEnum.Doc.getCode()); + UploadFilesVo vo = storageDriver.upload(file, "file", AlbumEnum.Doc.getCode()); Map album = new LinkedHashMap<>(); album.put("aid", String.valueOf(LikeAdminThreadLocal.getAdminId())); album.put("cid", cid); diff --git a/server/like-admin/src/main/java/com/mdd/admin/dto/CourseExcelDTO.java b/server/like-admin/src/main/java/com/mdd/admin/dto/CourseExcelDTO.java new file mode 100644 index 00000000..b4c6ffb4 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/dto/CourseExcelDTO.java @@ -0,0 +1,64 @@ +package com.mdd.admin.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import javax.validation.constraints.*; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Setter +@Getter +public class CourseExcelDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ExcelProperty("序号") // 对应Excel列名 + @NotNull(message = "序号不能为空") + @Min(value = 1, message = "序号必须大于0") + private Integer order; + + @ExcelProperty("课程代码") + @NotBlank(message = "课程代码不能为空") + @Size(max = 20, message = "课程代码长度不能超过20个字符") + private String courseCode; + + @ExcelProperty("课程名称") + @NotBlank(message = "课程名称不能为空") + @Size(max = 50, message = "课程名称长度不能超过50个字符") + private String courseName; + + @ExcelProperty("课程类型") + @NotBlank(message = "课程类型不能为空") + private String courseType; + + @ExcelProperty("学分") + @NotNull(message = "学分不能为空") + @DecimalMin(value = "0.5", message = "学分不能小于0.5") + @DecimalMax(value = "10.0", message = "学分不能大于10.0") + private BigDecimal credits; + + @ExcelProperty("总学时") + @NotNull(message = "总学时不能为空") + @Min(value = 1, message = "总学时必须大于0") + @Max(value = 200, message = "总学时不能超过200") + private Integer totalHours; + + @ExcelProperty("每次连上节数") + @NotNull(message = "每次连上节数不能为空") + @Min(value = 1, message = "每次连上节数必须大于0") + @Max(value = 4, message = "每次连上节数不能超过4") + private Integer durationPerSession; + + @ExcelProperty("每周次数") + @NotNull(message = "每周次数不能为空") + @Min(value = 1, message = "每周次数必须大于0") + @Max(value = 7, message = "每周次数不能超过7") + private Integer sessionsPerWeek; + + @ExcelProperty("课程描述") + @Size(max = 200, message = "课程描述长度不能超过200个字符") + private String description; + +} \ No newline at end of file diff --git a/server/like-admin/src/main/java/com/mdd/admin/dto/ExcelErrorDTO.java b/server/like-admin/src/main/java/com/mdd/admin/dto/ExcelErrorDTO.java new file mode 100644 index 00000000..3c0789cf --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/dto/ExcelErrorDTO.java @@ -0,0 +1,18 @@ +package com.mdd.admin.dto; + +import lombok.Data; +import java.io.Serializable; + +@Data +public class ExcelErrorDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** Excel实际行号(用户可见,非程序索引) */ + private Integer rowNum; + + /** Excel列名(如"课程代码") */ + private String columnName; + + /** 错误原因(如"课程代码不能为空") */ + private String errorMsg; +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/dto/TimeSlotCreateDTO.java b/server/like-admin/src/main/java/com/mdd/admin/dto/TimeSlotCreateDTO.java new file mode 100644 index 00000000..d331e138 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/dto/TimeSlotCreateDTO.java @@ -0,0 +1,16 @@ +package com.mdd.admin.dto; + +import lombok.Data; + +import java.time.LocalTime; + +@Data +public class TimeSlotCreateDTO { + private String slotCode; // 时间段代码 + private Integer dayOfWeek; // 星期几 + private LocalTime startTime; // 开始时间 + private LocalTime endTime; // 结束时间 + private String slotName; // 节次名 + private Integer section; // 节次 + private Integer isScheduled; // 是否排课 +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/excelListener/course/CourseExcelValidationListener.java b/server/like-admin/src/main/java/com/mdd/admin/excelListener/course/CourseExcelValidationListener.java new file mode 100644 index 00000000..f1ee5b9c --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/excelListener/course/CourseExcelValidationListener.java @@ -0,0 +1,176 @@ +package com.mdd.admin.excelListener.course; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; +import com.alibaba.excel.exception.ExcelAnalysisException; +import com.alibaba.excel.exception.ExcelDataConvertException; +import com.alibaba.excel.metadata.property.ExcelContentProperty; +import com.mdd.admin.dto.CourseExcelDTO; +import com.mdd.admin.dto.ExcelErrorDTO; +import lombok.Getter; + +import javax.validation.ConstraintViolation; +import javax.validation.Validator; +import java.lang.reflect.Field; +import java.util.*; + +/** + * 课程Excel数据验证监听器 + * 负责读取Excel数据并进行验证,不执行实际的数据导入 + */ +public class CourseExcelValidationListener extends AnalysisEventListener { + + /** JSR380校验器 */ + private final Validator validator; + + /** 错误信息列表 + * -- GETTER -- + * 获取所有错误信息 + */ + @Getter + private final List errorList = new ArrayList<>(); + + /** DTO字段名 -> Excel列名 映射(用于报错时显示列名) */ + private final Map fieldColumnMap; + + /** 起始行 跳过了表头 示例数据 */ + private final int start = 2; + + // 构造方法注入校验器 + public CourseExcelValidationListener(Validator validator) { + this.validator = validator; + this.fieldColumnMap = buildFieldColumnMap(); + } + + /** 反射构建DTO字段与Excel列名的映射(基于@ExcelProperty注解) */ + private Map buildFieldColumnMap() { + Map map = new HashMap<>(); + Field[] fields = CourseExcelDTO.class.getDeclaredFields(); + for (Field field : fields) { + com.alibaba.excel.annotation.ExcelProperty excelProperty = field.getAnnotation(com.alibaba.excel.annotation.ExcelProperty.class); + if (excelProperty != null && excelProperty.value().length > 0) { + map.put(field.getName(), excelProperty.value()[0]); + } + } + return map; + } + + /** 逐行校验Excel数据(核心方法) */ + @Override + public void invoke(CourseExcelDTO data, AnalysisContext context) { + // 1. 先获取当前数据行的程序索引 + int dataRowIndex = context.readRowHolder().getRowIndex(); + + // 2. 跳过示例行 + if (dataRowIndex < start) { + return; + } + if (isRowEmpty(data)) { + return; // 空行,终止当前行处理 + } + + // 1. JSR380注解规则校验(不能为空、长度限制等) + Set> violations = validator.validate(data); + for (ConstraintViolation violation : violations) { + ExcelErrorDTO error = new ExcelErrorDTO(); + error.setRowNum(dataRowIndex-1); + String fieldName = violation.getPropertyPath().toString(); // 违反规则的字段名 + error.setColumnName(fieldColumnMap.getOrDefault(fieldName, fieldName)); // 对应Excel列名 + error.setErrorMsg(violation.getMessage()); // 注解配置的错误信息 + errorList.add(error); + } + + } + + /** + * 核心:判断当前行是否为空行(所有字段均为空/空白) + * 可根据实际需求调整:比如允许部分非必填字段为空,只判断必填字段是否全空 + */ + private boolean isRowEmpty(CourseExcelDTO data) { + if (data == null) { + return true; + } + + // 遍历DTO所有核心字段,判断是否均为空(根据CourseExcelDTO字段类型适配) + return isEmpty(data.getOrder()) // Integer + && isEmpty(data.getCourseCode()) // String + && isEmpty(data.getCourseName()) // String + && isEmpty(data.getCourseType()) // String + && isEmpty(data.getCredits()) // BigDecimal + && isEmpty(data.getTotalHours()) // Integer + && isEmpty(data.getDurationPerSession()) // Integer + && isEmpty(data.getSessionsPerWeek()) // Integer + && isEmpty(data.getDescription()); // String(非必填,也参与空行判断) + } + + /** + * 通用空值判断工具方法 + * 处理:String(空白字符)、Integer/BigDecimal(null) + */ + private boolean isEmpty(T value) { + if (value == null) { + return true; + } + if (value instanceof String) { + // String类型:判断是否为空白(空格、制表符、空字符串) + return ((String) value).trim().isEmpty(); + } + // 其他类型(Integer、BigDecimal):非null即不为空 + return false; + } + + + /** 捕获Excel读取异常 */ + @Override + public void onException(Exception exception, AnalysisContext context) { + ExcelErrorDTO error = new ExcelErrorDTO(); + int rowNum = context.readRowHolder().getRowIndex(); + if (rowNum < start) return; + int actualRowNum = rowNum - 1; + error.setRowNum(actualRowNum); + + // 核心适配:处理ExcelDataConvertException(类型转换错误) + if (exception instanceof ExcelDataConvertException) { + ExcelDataConvertException dc = (ExcelDataConvertException) exception; + ExcelContentProperty contentProperty = dc.getExcelContentProperty(); + String columnName = "未知列"; + String targetTypeName = "未知类型"; + + // 从ExcelContentProperty中提取字段信息(关键) + if (contentProperty != null && contentProperty.getField() != null) { + Field field = contentProperty.getField(); + String fieldName = field.getName(); // DTO字段名 + columnName = fieldColumnMap.getOrDefault(fieldName, fieldName); // 映射为Excel列名 + targetTypeName = field.getType().getSimpleName(); // 目标类型(如Integer、BigDecimal) + } else { + // 若字段信息获取失败,用列索引提示(如第2列) + Integer columnIndex = dc.getColumnIndex(); + if (columnIndex != null) { + columnName = "第" + (columnIndex + 1) + "列"; // 列索引从0开始,+1转为用户可见列号 + } + } + + // 构建错误信息(包含单元格原始值,更友好) + String cellValue = dc.getCellData() != null ? dc.getCellData().getStringValue() : "空值"; + error.setColumnName(columnName); + error.setErrorMsg(String.format("数据类型错误:单元格值为「%s」,无法转换为%s", cellValue, targetTypeName)); + + } else if (exception instanceof ExcelAnalysisException) { + // 处理Excel读取通用异常(如格式损坏、密码保护等) + ExcelAnalysisException ae = (ExcelAnalysisException) exception; + error.setColumnName("未知列"); + error.setErrorMsg("Excel读取失败:" + ae.getMessage()); + + } else { + // 处理其他系统异常 + error.setColumnName("未知列"); + error.setErrorMsg("系统异常:" + exception.getMessage()); + } + + errorList.add(error); + } + + /** 读取完成后的收尾操作 */ + @Override + public void doAfterAllAnalysed(AnalysisContext context) {} +} \ No newline at end of file diff --git a/server/like-admin/src/main/java/com/mdd/admin/excelListener/course/CourseTypeExcelValidationListener.java b/server/like-admin/src/main/java/com/mdd/admin/excelListener/course/CourseTypeExcelValidationListener.java new file mode 100644 index 00000000..1b831f9c --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/excelListener/course/CourseTypeExcelValidationListener.java @@ -0,0 +1,104 @@ +package com.mdd.admin.excelListener.course; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; +import com.mdd.admin.dto.CourseExcelDTO; +import com.mdd.admin.dto.ExcelErrorDTO; +import com.mdd.common.entity.CourseType; +import lombok.Getter; + +import javax.annotation.Nonnull; +import java.util.*; + +public class CourseTypeExcelValidationListener extends AnalysisEventListener{ + /** DTO字段名 -> Excel列名 映射(用于报错时显示列名) + * -- GETTER -- + * 获取所有错误信息 + */ + @Getter + private final List errorList = new ArrayList<>(); + + /** + * 已存在的课程类型列表 + * */ + private final List courseTypeList; + + public CourseTypeExcelValidationListener(List courseTypeList) { + this.courseTypeList = courseTypeList; + } + + + @Override + public void invoke(CourseExcelDTO courseExcelDTO, AnalysisContext analysisContext) { + // 1. 先获取当前数据行的程序索引 + int dataRowIndex = analysisContext.readRowHolder().getRowIndex(); + + // 2. 跳过示例行 + int start = 2; + if (dataRowIndex < start) { + return; + } + if (isRowEmpty(courseExcelDTO)) { + return; // 空行,终止当前行处理 + } + + @Nonnull + String courseType = courseExcelDTO.getCourseType(); + + for(String name:courseTypeList) { + if (name.equals(courseType)) + return; + } + + ExcelErrorDTO newCourseType = new ExcelErrorDTO(); + newCourseType.setColumnName("课程名称"); + newCourseType.setRowNum(dataRowIndex-1); + newCourseType.setErrorMsg(courseType); + errorList.add(newCourseType); + } + + @Override + public void onException(Exception exception, AnalysisContext context) { + } + + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + + } + + /** + * 核心:判断当前行是否为空行(所有字段均为空/空白) + * 可根据实际需求调整:比如允许部分非必填字段为空,只判断必填字段是否全空 + */ + private boolean isRowEmpty(CourseExcelDTO data) { + if (data == null) { + return true; + } + + // 遍历DTO所有核心字段,判断是否均为空(根据CourseExcelDTO字段类型适配) + return isEmpty(data.getOrder()) // Integer + && isEmpty(data.getCourseCode()) // String + && isEmpty(data.getCourseName()) // String + && isEmpty(data.getCourseType()) // String + && isEmpty(data.getCredits()) // BigDecimal + && isEmpty(data.getTotalHours()) // Integer + && isEmpty(data.getDurationPerSession()) // Integer + && isEmpty(data.getSessionsPerWeek()) // Integer + && isEmpty(data.getDescription()); // String(非必填,也参与空行判断) + } + /** + * 通用空值判断工具方法 + * 处理:String(空白字符)、Integer/BigDecimal(null) + */ + private boolean isEmpty(T value) { + if (value == null) { + return true; + } + if (value instanceof String) { + // String类型:判断是否为空白(空格、制表符、空字符串) + return ((String) value).trim().isEmpty(); + } + // 其他类型(Integer、BigDecimal):非null即不为空 + return false; + } +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/excelListener/course/ExcelValidationListener.java b/server/like-admin/src/main/java/com/mdd/admin/excelListener/course/ExcelValidationListener.java new file mode 100644 index 00000000..0e0a3748 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/excelListener/course/ExcelValidationListener.java @@ -0,0 +1,84 @@ +package com.mdd.admin.excelListener.course; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; +import com.mdd.admin.dto.CourseExcelDTO; +import com.mdd.admin.service.impl.CourseServiceImpl; +import com.mdd.admin.validate.course.CourseCreateValidate; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +public class ExcelValidationListener extends AnalysisEventListener { + Map map = new HashMap<>(); + + CourseServiceImpl courseService; + + public ExcelValidationListener(Map map, CourseServiceImpl courseService) { + this.map = map; + this.courseService = courseService; + } + + @Override + public void invoke(CourseExcelDTO courseExcelDTO, AnalysisContext analysisContext) { + int start = 2; + int dataRowIndex = analysisContext.readRowHolder().getRowIndex(); + if (dataRowIndex < start) { + return; + } + if (isRowEmpty(courseExcelDTO)) { + return; + } + + CourseCreateValidate courseCreateValidate = new CourseCreateValidate(); + courseCreateValidate.setCourseName(courseExcelDTO.getCourseName()); + courseCreateValidate.setCourseCode(courseExcelDTO.getCourseCode()); + courseCreateValidate.setCredits(courseExcelDTO.getCredits()); + courseCreateValidate.setDescription(courseExcelDTO.getDescription()); + courseCreateValidate.setDurationPerSession(courseExcelDTO.getDurationPerSession()); + courseCreateValidate.setSessionsPerWeek(courseExcelDTO.getSessionsPerWeek()); + courseCreateValidate.setTotalHours(courseExcelDTO.getTotalHours()); + Integer courseTypeId = map.get(courseExcelDTO.getCourseType()); + courseCreateValidate.setCourseTypeId(courseTypeId); + courseCreateValidate.setEquipmentRequirements(new ArrayList<>()); + courseService.add(courseCreateValidate); + } + + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + + } + + @Override + public void onException(Exception exception, AnalysisContext context) throws Exception { + + } + + private boolean isRowEmpty(CourseExcelDTO data) { + if (data == null) { + return true; + } + + return isEmpty(data.getOrder()) // Integer + && isEmpty(data.getCourseCode()) // String + && isEmpty(data.getCourseName()) // String + && isEmpty(data.getCourseType()) // String + && isEmpty(data.getCredits()) // BigDecimal + && isEmpty(data.getTotalHours()) // Integer + && isEmpty(data.getDurationPerSession()) // Integer + && isEmpty(data.getSessionsPerWeek()) // Integer + && isEmpty(data.getDescription()); // String(非必填,也参与空行判断) + } + private boolean isEmpty(T value) { + if (value == null) { + return true; + } + if (value instanceof String) { + // String类型:判断是否为空白(空格、制表符、空字符串) + return ((String) value).trim().isEmpty(); + } + // 其他类型(Integer、BigDecimal):非null即不为空 + return false; + } +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/IClassroomService.java b/server/like-admin/src/main/java/com/mdd/admin/service/IClassroomService.java new file mode 100644 index 00000000..860b7334 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/service/IClassroomService.java @@ -0,0 +1,60 @@ +package com.mdd.admin.service; + +import com.mdd.admin.validate.commons.PageValidate; +import com.mdd.admin.validate.ClassroomCreateValidate; +import com.mdd.admin.validate.ClassroomUpdateValidate; +import com.mdd.admin.validate.ClassroomSearchValidate; +import com.mdd.admin.vo.ClassroomListedVo; +import com.mdd.admin.vo.ClassroomDetailVo; +import com.mdd.common.core.PageResult; + +/** + * 教室服务接口类 + * @author LikeAdmin + */ +public interface IClassroomService { + + /** + * 教室列表 + * + * @author LikeAdmin + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + PageResult list(PageValidate pageValidate, ClassroomSearchValidate searchValidate); + + /** + * 教室详情 + * + * @author LikeAdmin + * @param id 主键ID + * @return ClassroomDetailVo + */ + ClassroomDetailVo detail(Integer id); + + /** + * 教室新增 + * + * @author LikeAdmin + * @param createValidate 参数 + */ + void add(ClassroomCreateValidate createValidate); + + /** + * 教室编辑 + * + * @author LikeAdmin + * @param updateValidate 参数 + */ + void edit(ClassroomUpdateValidate updateValidate); + + /** + * 教室删除 + * + * @author LikeAdmin + * @param id 主键ID + */ + void del(Integer id); + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/IClassroomTypeService.java b/server/like-admin/src/main/java/com/mdd/admin/service/IClassroomTypeService.java new file mode 100644 index 00000000..2cef6ae7 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/service/IClassroomTypeService.java @@ -0,0 +1,60 @@ +package com.mdd.admin.service; + +import com.mdd.admin.validate.commons.PageValidate; +import com.mdd.admin.validate.ClassroomTypeCreateValidate; +import com.mdd.admin.validate.ClassroomTypeUpdateValidate; +import com.mdd.admin.validate.ClassroomTypeSearchValidate; +import com.mdd.admin.vo.ClassroomTypeListedVo; +import com.mdd.admin.vo.ClassroomTypeDetailVo; +import com.mdd.common.core.PageResult; + +/** + * 教室类型服务接口类 + * @author gyp + */ +public interface IClassroomTypeService { + + /** + * 教室类型列表 + * + * @author gyp + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + PageResult list(PageValidate pageValidate, ClassroomTypeSearchValidate searchValidate); + + /** + * 教室类型详情 + * + * @author gyp + * @param id 主键ID + * @return ClassroomTypeDetailVo + */ + ClassroomTypeDetailVo detail(Integer id); + + /** + * 教室类型新增 + * + * @author gyp + * @param createValidate 参数 + */ + void add(ClassroomTypeCreateValidate createValidate); + + /** + * 教室类型编辑 + * + * @author gyp + * @param updateValidate 参数 + */ + void edit(ClassroomTypeUpdateValidate updateValidate); + + /** + * 教室类型删除 + * + * @author gyp + * @param id 主键ID + */ + void del(Integer id); + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/ICourseService.java b/server/like-admin/src/main/java/com/mdd/admin/service/ICourseService.java index 1bdd0b3e..5f15012e 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/service/ICourseService.java +++ b/server/like-admin/src/main/java/com/mdd/admin/service/ICourseService.java @@ -1,5 +1,6 @@ package com.mdd.admin.service; +import com.mdd.admin.dto.ExcelErrorDTO; import com.mdd.admin.validate.commons.PageValidate; import com.mdd.admin.validate.course.CourseCreateValidate; import com.mdd.admin.validate.course.CourseUpdateValidate; @@ -7,6 +8,9 @@ import com.mdd.admin.validate.course.CourseSearchValidate; import com.mdd.admin.vo.course.CourseListedVo; import com.mdd.admin.vo.course.CourseDetailVo; import com.mdd.common.core.PageResult; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; /** * 课程服务接口类 @@ -57,4 +61,20 @@ public interface ICourseService { */ void del(Integer id); + /** + * 上传excel导入表格 + * + * @author gyp + */ + void upload(MultipartFile file); + + /** + * 批量添加excel表格信息 + * + */ + List checkExcel(MultipartFile file); + + List checkCourseType(MultipartFile file); + + void addByExcel(MultipartFile file); } diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/ICourseTypeService.java b/server/like-admin/src/main/java/com/mdd/admin/service/ICourseTypeService.java new file mode 100644 index 00000000..0bc983a8 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/service/ICourseTypeService.java @@ -0,0 +1,60 @@ +package com.mdd.admin.service; + +import com.mdd.admin.validate.commons.PageValidate; +import com.mdd.admin.validate.course.CourseTypeCreateValidate; +import com.mdd.admin.validate.course.CourseTypeUpdateValidate; +import com.mdd.admin.validate.course.CourseTypeSearchValidate; +import com.mdd.admin.vo.course.CourseTypeListedVo; +import com.mdd.admin.vo.course.CourseTypeDetailVo; +import com.mdd.common.core.PageResult; + +/** + * 课程类型服务接口类 + * @author LikeAdmin + */ +public interface ICourseTypeService { + + /** + * 课程类型列表 + * + * @author LikeAdmin + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + PageResult list(PageValidate pageValidate, CourseTypeSearchValidate searchValidate); + + /** + * 课程类型详情 + * + * @author LikeAdmin + * @param id 主键ID + * @return CourseTypeDetailVo + */ + CourseTypeDetailVo detail(Integer id); + + /** + * 课程类型新增 + * + * @author LikeAdmin + * @param createValidate 参数 + */ + void add(CourseTypeCreateValidate createValidate); + + /** + * 课程类型编辑 + * + * @author LikeAdmin + * @param updateValidate 参数 + */ + void edit(CourseTypeUpdateValidate updateValidate); + + /** + * 课程类型删除 + * + * @author LikeAdmin + * @param id 主键ID + */ + void del(Integer id); + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/IEquipmentRequirementService.java b/server/like-admin/src/main/java/com/mdd/admin/service/IEquipmentRequirementService.java new file mode 100644 index 00000000..5736f68e --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/service/IEquipmentRequirementService.java @@ -0,0 +1,60 @@ +package com.mdd.admin.service; + +import com.mdd.admin.validate.commons.PageValidate; +import com.mdd.admin.validate.equipmentRequirement.EquipmentRequirementCreateValidate; +import com.mdd.admin.validate.equipmentRequirement.EquipmentRequirementUpdateValidate; +import com.mdd.admin.validate.equipmentRequirement.EquipmentRequirementSearchValidate; +import com.mdd.admin.vo.EquipmentRequirementListedVo; +import com.mdd.admin.vo.EquipmentRequirementDetailVo; +import com.mdd.common.core.PageResult; + +/** + * 设备要求服务接口类 + * @author gyp + */ +public interface IEquipmentRequirementService { + + /** + * 设备要求列表 + * + * @author gyp + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + PageResult list(PageValidate pageValidate, EquipmentRequirementSearchValidate searchValidate); + + /** + * 设备要求详情 + * + * @author gyp + * @param id 主键ID + * @return EquipmentRequirementDetailVo + */ + EquipmentRequirementDetailVo detail(Integer id); + + /** + * 设备要求新增 + * + * @author gyp + * @param createValidate 参数 + */ + void add(EquipmentRequirementCreateValidate createValidate); + + /** + * 设备要求编辑 + * + * @author gyp + * @param updateValidate 参数 + */ + void edit(EquipmentRequirementUpdateValidate updateValidate); + + /** + * 设备要求删除 + * + * @author gyp + * @param id 主键ID + */ + void del(Integer id); + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/IStudentInfoService.java b/server/like-admin/src/main/java/com/mdd/admin/service/IStudentInfoService.java index 916fb3b2..b2099e36 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/service/IStudentInfoService.java +++ b/server/like-admin/src/main/java/com/mdd/admin/service/IStudentInfoService.java @@ -1,13 +1,15 @@ package com.mdd.admin.service; import com.mdd.admin.validate.commons.PageValidate; -import com.mdd.admin.validate.student.StudentInfoCreateValidate; -import com.mdd.admin.validate.student.StudentInfoUpdateValidate; -import com.mdd.admin.validate.student.StudentInfoSearchValidate; -import com.mdd.admin.vo.student.StudentInfoListedVo; -import com.mdd.admin.vo.student.StudentInfoDetailVo; +import com.mdd.admin.validate.StudentInfoCreateValidate; +import com.mdd.admin.validate.StudentInfoUpdateValidate; +import com.mdd.admin.validate.StudentInfoSearchValidate; +import com.mdd.admin.vo.StudentInfoListedVo; +import com.mdd.admin.vo.StudentInfoDetailVo; import com.mdd.common.core.PageResult; +import javax.validation.constraints.NotNull; + /** * 学生信息服务接口类 * @author gyp @@ -58,10 +60,10 @@ public interface IStudentInfoService { void del(Integer id); /** - * 学生信息删除 + * 添加随机学生信息 * * @author gyp - * @param num 创建随机学生数 + * @param num 人数 */ - void createRandomInfo(Integer num); + void createRandomInfo(@NotNull(message = "数量参数缺失") Integer num); } diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/ITimeSlotService.java b/server/like-admin/src/main/java/com/mdd/admin/service/ITimeSlotService.java new file mode 100644 index 00000000..350db44a --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/service/ITimeSlotService.java @@ -0,0 +1,64 @@ +package com.mdd.admin.service; + +import com.mdd.admin.dto.TimeSlotCreateDTO; +import com.mdd.admin.validate.*; +import com.mdd.admin.validate.commons.PageValidate; +import com.mdd.admin.vo.TimeSlotListedVo; +import com.mdd.admin.vo.TimeSlotDetailVo; +import com.mdd.common.core.PageResult; + +import java.time.LocalTime; +import java.util.List; + +/** + * 时间段服务接口类 + * @author gyp + */ +public interface ITimeSlotService { + + /** + * 时间段列表 + * + * @author gyp + * @return PageResult + */ + List list(); + + + /** + * 时间段详情 + * + * @author gyp + * @param id 主键ID + * @return TimeSlotDetailVo + */ + TimeSlotDetailVo detail(Integer id); + + /** + * 时间段新增 + * + * @author gyp + */ + void add(TimeSlotCreateDTO dto); + + + /** + * 时间段编辑 + * + * @author gyp + * @param updateValidate 参数 + */ + void edit(TimeSlotForRowUpdateValidate updateValidate); + + /** + * 时间段删除 + * + * @author gyp + * @param count 要删除的节次数 + */ + void del(Integer count); + + void insert(TimeSlotInsertValidate insertValidate); + + void uniform(TimeSlotUniformValidate uniformValidate, LocalTime lastEndTime, Integer section); +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/impl/ClassroomServiceImpl.java b/server/like-admin/src/main/java/com/mdd/admin/service/impl/ClassroomServiceImpl.java new file mode 100644 index 00000000..68ff5d2a --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/service/impl/ClassroomServiceImpl.java @@ -0,0 +1,172 @@ +package com.mdd.admin.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.yulichang.query.MPJQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.mdd.admin.validate.commons.PageValidate; +import com.mdd.admin.service.IClassroomService; +import com.mdd.admin.validate.ClassroomCreateValidate; +import com.mdd.admin.validate.ClassroomUpdateValidate; +import com.mdd.admin.validate.ClassroomSearchValidate; +import com.mdd.admin.vo.ClassroomListedVo; +import com.mdd.admin.vo.ClassroomDetailVo; +import com.mdd.common.config.GlobalConfig; +import com.mdd.common.core.PageResult; +import com.mdd.common.entity.Classroom; +import com.mdd.common.entity.ClassroomType; +import com.mdd.common.mapper.ClassroomMapper; +import com.mdd.common.mapper.ClassroomTypeMapper; +import com.mdd.common.util.ListUtils; +import com.mdd.common.util.TimeUtils; +import com.mdd.common.util.UrlUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import javax.annotation.Resource; +import java.util.*; + +/** + * 教室实现类 + * @author LikeAdmin + */ +@Service +public class ClassroomServiceImpl implements IClassroomService { + + @Resource + ClassroomMapper classroomMapper; + @Autowired + private ClassroomTypeMapper classroomTypeMapper; + + /** + * 教室列表 + * + * @author LikeAdmin + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + @Override + public PageResult list(PageValidate pageValidate, ClassroomSearchValidate searchValidate) { + Integer page = pageValidate.getPage_no(); + Integer limit = pageValidate.getPage_size(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.orderByDesc("id"); + + classroomMapper.setSearch(queryWrapper, searchValidate, new String[]{ + "like:classroomCode@classroom_code:str", + "like:classroomName@classroom_name:str", + "=:classroomTypeId@classroom_type_id:int", + "=:location:str", + "=:status:int", + }); + + IPage iPage = classroomMapper.selectPage(new Page<>(page, limit), queryWrapper); + + List list = new LinkedList<>(); + for(Classroom item : iPage.getRecords()) { + ClassroomListedVo vo = new ClassroomListedVo(); + BeanUtils.copyProperties(item, vo); + vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(item.getUpdateTime())); + ClassroomType classroomType = classroomTypeMapper.selectById(item.getClassroomTypeId()); + vo.setClassroomTypeName(classroomType.getTypeName()); + list.add(vo); + } + + return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list); + } + + /** + * 教室详情 + * + * @author LikeAdmin + * @param id 主键参数 + * @return Classroom + */ + @Override + public ClassroomDetailVo detail(Integer id) { + Classroom model = classroomMapper.selectOne( + new QueryWrapper() + .eq("id", id) + .last("limit 1")); + + Assert.notNull(model, "数据不存在"); + + ClassroomDetailVo vo = new ClassroomDetailVo(); + BeanUtils.copyProperties(model, vo); + ClassroomType classroomType = classroomTypeMapper.selectById(vo.getClassroomTypeId()); + vo.setClassroomTypeName(classroomType.getTypeName()); + return vo; + } + + /** + * 教室新增 + * + * @author LikeAdmin + * @param createValidate 参数 + */ + @Override + public void add(ClassroomCreateValidate createValidate) { + Classroom model = new Classroom(); + model.setClassroomCode(createValidate.getClassroomCode()); + model.setClassroomName(createValidate.getClassroomName()); + model.setClassroomTypeId(createValidate.getClassroomTypeId()); + model.setCapacity(createValidate.getCapacity()); + model.setLocation(createValidate.getLocation()); + model.setSpecialRequirements(createValidate.getSpecialRequirements()); + model.setStatus(createValidate.getStatus()); + model.setCreateTime(System.currentTimeMillis() / 1000); + model.setUpdateTime(System.currentTimeMillis() / 1000); + classroomMapper.insert(model); + } + + /** + * 教室编辑 + * + * @author LikeAdmin + * @param updateValidate 参数 + */ + @Override + public void edit(ClassroomUpdateValidate updateValidate) { + Classroom model = classroomMapper.selectOne( + new QueryWrapper() + .eq("id", updateValidate.getId()) + .last("limit 1")); + + Assert.notNull(model, "数据不存在!"); + + model.setId(updateValidate.getId()); + model.setClassroomCode(updateValidate.getClassroomCode()); + model.setClassroomName(updateValidate.getClassroomName()); + model.setClassroomTypeId(updateValidate.getClassroomTypeId()); + model.setCapacity(updateValidate.getCapacity()); + model.setLocation(updateValidate.getLocation()); + model.setSpecialRequirements(updateValidate.getSpecialRequirements()); + model.setStatus(updateValidate.getStatus()); + model.setUpdateTime(System.currentTimeMillis() / 1000); + classroomMapper.updateById(model); + } + + /** + * 教室删除 + * + * @author LikeAdmin + * @param id 主键ID + */ + @Override + public void del(Integer id) { + Classroom model = classroomMapper.selectOne( + new QueryWrapper() + .eq("id", id) + .last("limit 1")); + + Assert.notNull(model, "数据不存在!"); + + classroomMapper.delete(new QueryWrapper().eq("id", id)); + } + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/impl/ClassroomTypeServiceImpl.java b/server/like-admin/src/main/java/com/mdd/admin/service/impl/ClassroomTypeServiceImpl.java new file mode 100644 index 00000000..e3902047 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/service/impl/ClassroomTypeServiceImpl.java @@ -0,0 +1,155 @@ +package com.mdd.admin.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.yulichang.query.MPJQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.mdd.admin.validate.commons.PageValidate; +import com.mdd.admin.service.IClassroomTypeService; +import com.mdd.admin.validate.ClassroomTypeCreateValidate; +import com.mdd.admin.validate.ClassroomTypeUpdateValidate; +import com.mdd.admin.validate.ClassroomTypeSearchValidate; +import com.mdd.admin.vo.ClassroomTypeListedVo; +import com.mdd.admin.vo.ClassroomTypeDetailVo; +import com.mdd.common.config.GlobalConfig; +import com.mdd.common.core.PageResult; +import com.mdd.common.entity.ClassroomType; +import com.mdd.common.mapper.ClassroomTypeMapper; +import com.mdd.common.util.ListUtils; +import com.mdd.common.util.TimeUtils; +import com.mdd.common.util.UrlUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import javax.annotation.Resource; +import java.util.*; + +/** + * 教室类型实现类 + * @author gyp + */ +@Service +public class ClassroomTypeServiceImpl implements IClassroomTypeService { + + @Resource + ClassroomTypeMapper classroomTypeMapper; + + /** + * 教室类型列表 + * + * @author gyp + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + @Override + public PageResult list(PageValidate pageValidate, ClassroomTypeSearchValidate searchValidate) { + Integer page = pageValidate.getPage_no(); + Integer limit = pageValidate.getPage_size(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.orderByDesc("id"); + + classroomTypeMapper.setSearch(queryWrapper, searchValidate, new String[]{ + "like:typeName@type_name:str", + "like:typeCode@type_code:str", + "=:status:int", + }); + + IPage iPage = classroomTypeMapper.selectPage(new Page<>(page, limit), queryWrapper); + + List list = new LinkedList<>(); + for(ClassroomType item : iPage.getRecords()) { + ClassroomTypeListedVo vo = new ClassroomTypeListedVo(); + BeanUtils.copyProperties(item, vo); + vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(item.getUpdateTime())); + list.add(vo); + } + + return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list); + } + + /** + * 教室类型详情 + * + * @author gyp + * @param id 主键参数 + * @return ClassroomType + */ + @Override + public ClassroomTypeDetailVo detail(Integer id) { + ClassroomType model = classroomTypeMapper.selectOne( + new QueryWrapper() + .eq("id", id) + .last("limit 1")); + + Assert.notNull(model, "数据不存在"); + + ClassroomTypeDetailVo vo = new ClassroomTypeDetailVo(); + BeanUtils.copyProperties(model, vo); + return vo; + } + + /** + * 教室类型新增 + * + * @author gyp + * @param createValidate 参数 + */ + @Override + public void add(ClassroomTypeCreateValidate createValidate) { + ClassroomType model = new ClassroomType(); + model.setTypeName(createValidate.getTypeName()); + model.setTypeCode(createValidate.getTypeCode()); + model.setDescription(createValidate.getDescription()); + model.setStatus(createValidate.getStatus()); + model.setCreateTime(System.currentTimeMillis() / 1000); + model.setUpdateTime(System.currentTimeMillis() / 1000); + classroomTypeMapper.insert(model); + } + + /** + * 教室类型编辑 + * + * @author gyp + * @param updateValidate 参数 + */ + @Override + public void edit(ClassroomTypeUpdateValidate updateValidate) { + ClassroomType model = classroomTypeMapper.selectOne( + new QueryWrapper() + .eq("id", updateValidate.getId()) + .last("limit 1")); + + Assert.notNull(model, "数据不存在!"); + + model.setId(updateValidate.getId()); + model.setTypeName(updateValidate.getTypeName()); + model.setTypeCode(updateValidate.getTypeCode()); + model.setDescription(updateValidate.getDescription()); + model.setStatus(updateValidate.getStatus()); + model.setUpdateTime(System.currentTimeMillis() / 1000); + classroomTypeMapper.updateById(model); + } + + /** + * 教室类型删除 + * + * @author gyp + * @param id 主键ID + */ + @Override + public void del(Integer id) { + ClassroomType model = classroomTypeMapper.selectOne( + new QueryWrapper() + .eq("id", id) + .last("limit 1")); + + Assert.notNull(model, "数据不存在!"); + + classroomTypeMapper.delete(new QueryWrapper().eq("id", id)); + } + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/impl/CourseServiceImpl.java b/server/like-admin/src/main/java/com/mdd/admin/service/impl/CourseServiceImpl.java index 7f342c77..f75d5279 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/service/impl/CourseServiceImpl.java +++ b/server/like-admin/src/main/java/com/mdd/admin/service/impl/CourseServiceImpl.java @@ -1,67 +1,97 @@ package com.mdd.admin.service.impl; +import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.mdd.admin.dto.CourseExcelDTO; +import com.mdd.admin.dto.ExcelErrorDTO; +import com.mdd.admin.excelListener.course.CourseTypeExcelValidationListener; +import com.mdd.admin.excelListener.course.ExcelValidationListener; import com.mdd.admin.validate.commons.PageValidate; import com.mdd.admin.service.ICourseService; import com.mdd.admin.validate.course.CourseCreateValidate; +import com.mdd.admin.excelListener.course.CourseExcelValidationListener; import com.mdd.admin.validate.course.CourseUpdateValidate; import com.mdd.admin.validate.course.CourseSearchValidate; import com.mdd.admin.vo.course.CourseListedVo; import com.mdd.admin.vo.course.CourseDetailVo; import com.mdd.common.core.PageResult; import com.mdd.common.entity.Course; +import com.mdd.common.entity.CourseEquipment; +import com.mdd.common.entity.CourseType; +import com.mdd.common.exception.OperateException; +import com.mdd.common.mapper.CourseEquipmentMapper; import com.mdd.common.mapper.CourseMapper; +import com.mdd.common.mapper.CourseTypeMapper; import com.mdd.common.util.TimeUtils; +import com.mdd.common.util.YmlUtils; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.Assert; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import javax.validation.Validation; +import javax.validation.Validator; +import java.io.File; +import java.io.IOException; import java.util.*; /** * 课程实现类 * @author gyp */ +@Slf4j @Service public class CourseServiceImpl implements ICourseService { - + @Resource CourseMapper courseMapper; + @Autowired + private CourseEquipmentMapper courseEquipmentMapper; + @Autowired + private CourseTypeMapper courseTypeMapper; + @Autowired + private CourseTypeServiceImpl courseTypeServiceImpl; + @Autowired + private CourseServiceImpl courseServiceImpl; /** * 课程列表 * - * @author gyp - * @param pageValidate 分页参数 + * @param pageValidate 分页参数 * @param searchValidate 搜索参数 * @return PageResult + * @author gyp */ @Override public PageResult list(PageValidate pageValidate, CourseSearchValidate searchValidate) { - Integer page = pageValidate.getPage_no(); + Integer page = pageValidate.getPage_no(); Integer limit = pageValidate.getPage_size(); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.orderByDesc("id"); courseMapper.setSearch(queryWrapper, searchValidate, new String[]{ - "=:courseCode@course_code:str", - "like:courseName@course_name:str", - "=:courseType@course_type:int", - "=:status:int", + "=:courseCode@course_code:str", + "like:courseName@course_name:str", + "=:courseTypeId@course_type_id:int", + "=:status:int", }); IPage iPage = courseMapper.selectPage(new Page<>(page, limit), queryWrapper); List list = new LinkedList<>(); - for(Course item : iPage.getRecords()) { + for (Course item : iPage.getRecords()) { CourseListedVo vo = new CourseListedVo(); BeanUtils.copyProperties(item, vo); vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime())); vo.setUpdateTime(TimeUtils.timestampToDate(item.getUpdateTime())); + CourseType courseType = courseTypeMapper.selectById(item.getCourseTypeId()); + vo.setCourseTypeName(courseType.getTypeName()); list.add(vo); } @@ -71,94 +101,209 @@ public class CourseServiceImpl implements ICourseService { /** * 课程详情 * - * @author gyp * @param id 主键参数 * @return Course + * @author gyp */ @Override public CourseDetailVo detail(Integer id) { Course model = courseMapper.selectOne( new QueryWrapper() - .eq("id", id) - .last("limit 1")); + .eq("id", id) + .last("limit 1")); Assert.notNull(model, "数据不存在"); CourseDetailVo vo = new CourseDetailVo(); BeanUtils.copyProperties(model, vo); + CourseType courseType = courseTypeMapper.selectById(model.getCourseTypeId()); + vo.setCourseTypeName(courseType.getTypeName()); return vo; } /** * 课程新增 * - * @author gyp * @param createValidate 参数 + * @author gyp */ @Override public void add(CourseCreateValidate createValidate) { Course model = new Course(); model.setCourseCode(createValidate.getCourseCode()); model.setCourseName(createValidate.getCourseName()); - model.setCourseType(createValidate.getCourseType()); + model.setCourseTypeId(createValidate.getCourseTypeId()); model.setCredits(createValidate.getCredits()); model.setTotalHours(createValidate.getTotalHours()); model.setDurationPerSession(createValidate.getDurationPerSession()); model.setSessionsPerWeek(createValidate.getSessionsPerWeek()); - model.setEquipmentRequirements(createValidate.getEquipmentRequirements()); model.setDescription(createValidate.getDescription()); model.setStatus(createValidate.getStatus()); model.setCreateTime(System.currentTimeMillis() / 1000); model.setUpdateTime(System.currentTimeMillis() / 1000); + // 关联表绑定 + CourseEquipment courseEquipment = new CourseEquipment(); + for (Integer id : createValidate.getEquipmentRequirements()) { + courseEquipment.setId(id); + courseEquipment.setCourseId(model.getId()); + courseEquipment.setCreateTime(System.currentTimeMillis() / 1000); + courseEquipmentMapper.insert(courseEquipment); + } courseMapper.insert(model); } /** * 课程编辑 * - * @author gyp * @param updateValidate 参数 + * @author gyp */ @Override public void edit(CourseUpdateValidate updateValidate) { Course model = courseMapper.selectOne( new QueryWrapper() - .eq("id", updateValidate.getId()) - .last("limit 1")); + .eq("id", updateValidate.getId()) + .last("limit 1")); Assert.notNull(model, "数据不存在!"); model.setId(updateValidate.getId()); model.setCourseCode(updateValidate.getCourseCode()); model.setCourseName(updateValidate.getCourseName()); - model.setCourseType(updateValidate.getCourseType()); + model.setCourseTypeId(updateValidate.getCourseTypeId()); model.setCredits(updateValidate.getCredits()); model.setTotalHours(updateValidate.getTotalHours()); model.setDurationPerSession(updateValidate.getDurationPerSession()); model.setSessionsPerWeek(updateValidate.getSessionsPerWeek()); - model.setEquipmentRequirements(updateValidate.getEquipmentRequirements()); model.setDescription(updateValidate.getDescription()); model.setStatus(updateValidate.getStatus()); model.setUpdateTime(System.currentTimeMillis() / 1000); + // 关联表绑定,先清除原本的关联 + courseEquipmentMapper.delete(new QueryWrapper().eq("course_id", model.getId())); + + for (Integer id : updateValidate.getEquipmentRequirements()) { + CourseEquipment courseEquipment = new CourseEquipment(); + courseEquipment.setEquipmentRequirementId(id); + courseEquipment.setCourseId(model.getId()); + courseEquipment.setCreateTime(System.currentTimeMillis() / 1000); + courseEquipmentMapper.insert(courseEquipment); + } courseMapper.updateById(model); } /** * 课程删除 * - * @author gyp * @param id 主键ID + * @author gyp */ @Override public void del(Integer id) { Course model = courseMapper.selectOne( new QueryWrapper() - .eq("id", id) - .last("limit 1")); + .eq("id", id) + .last("limit 1")); Assert.notNull(model, "数据不存在!"); courseMapper.delete(new QueryWrapper().eq("id", id)); } + @Override + public void upload(MultipartFile file) { + // 校验文件是否为空 + if (file == null || file.isEmpty()) { + throw new OperateException("上传文件不能为空"); + } + + // 校验文件类型 + String originalFilename = file.getOriginalFilename(); + // 若文件名不为空且后缀既不是xlsx也不是xls + if (originalFilename != null && !originalFilename.endsWith(".xlsx") && !originalFilename.endsWith(".xls")) { + throw new OperateException("只支持.xls和xlsx格式的文件"); + } + + // 保存到指定地址 + String folderPath = "/template/"; + String path = folderPath + "课程导入表.xlsx"; + String filePath = YmlUtils.get("like.upload-directory") + path; + File folder = new File(YmlUtils.get("like.upload-directory") + folderPath); + + if (!folder.exists()) { + if (!folder.mkdirs()) { + throw new OperateException("创建文件夹失败"); + } + } + + try { + File destFile = new File(filePath); + file.transferTo(destFile); + } catch (IOException e) { + throw new OperateException("文件保存失败: " + e.getMessage()); + } catch (Exception e) { + throw new OperateException("上传过程发生错误: " + e.getMessage()); + } + } + + @Override + public List checkExcel(MultipartFile file) { + // 初始化校验器和监听器 + Validator validator = Validation.buildDefaultValidatorFactory().getValidator(); + CourseExcelValidationListener listener = new CourseExcelValidationListener(validator); + + // 读取Excel并执行校验(headRowNumber=1:跳过表头,示例数据由Listener检测跳过) + try { + EasyExcel.read(file.getInputStream(), CourseExcelDTO.class, listener) + .headRowNumber(1) + .sheet(0) // 读取第一个sheet + .doRead(); + } catch (Exception e) { + throw new OperateException("Excel读取失败:" + e.getMessage()); + } + + // 返回收集的错误列表 + return listener.getErrorList(); + } + + @Override + public List checkCourseType(MultipartFile file) { + // 初始化监听器 + List courseTypeList = new ArrayList<>(); + List courseTypes = courseTypeServiceImpl.courseTypeMapper.selectList(null); + for (CourseType courseType : courseTypes) { + courseTypeList.add(courseType.getTypeName()); + } + CourseTypeExcelValidationListener listener = new CourseTypeExcelValidationListener(courseTypeList); + // 读取Excel并执行校验(headRowNumber=1:跳过表头,示例数据由Listener检测跳过) + try { + EasyExcel.read(file.getInputStream(), CourseExcelDTO.class, listener) + .headRowNumber(1) + .sheet(0) // 读取第一个sheet + .doRead(); + } catch (Exception e) { + throw new OperateException("Excel读取失败:" + e.getMessage()); + } + // 返回发现的新课程类型 + return listener.getErrorList(); + } + + @Override + public void addByExcel(MultipartFile file) { + // 初始化监听器 + Map map = new HashMap<>(); + List courseTypes = courseTypeServiceImpl.courseTypeMapper.selectList(null); + for (CourseType courseType : courseTypes) { + map.put(courseType.getTypeName(), courseType.getId()); + } + ExcelValidationListener listener = new ExcelValidationListener(map, courseServiceImpl); + // 读取Excel并添加课程(headRowNumber=1:跳过表头,示例数据由Listener检测跳过) + try { + EasyExcel.read(file.getInputStream(), CourseExcelDTO.class, listener) + .headRowNumber(1) + .sheet(0) // 读取第一个sheet + .doRead(); + } catch (Exception e) { + throw new OperateException("Excel读取失败:" + e.getMessage()); + } + } } diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/impl/CourseTypeServiceImpl.java b/server/like-admin/src/main/java/com/mdd/admin/service/impl/CourseTypeServiceImpl.java new file mode 100644 index 00000000..56581f97 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/service/impl/CourseTypeServiceImpl.java @@ -0,0 +1,146 @@ +package com.mdd.admin.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.mdd.admin.validate.commons.PageValidate; +import com.mdd.admin.service.ICourseTypeService; +import com.mdd.admin.validate.course.CourseTypeCreateValidate; +import com.mdd.admin.validate.course.CourseTypeUpdateValidate; +import com.mdd.admin.validate.course.CourseTypeSearchValidate; +import com.mdd.admin.vo.course.CourseTypeListedVo; +import com.mdd.admin.vo.course.CourseTypeDetailVo; +import com.mdd.common.core.PageResult; +import com.mdd.common.entity.CourseType; +import com.mdd.common.mapper.CourseTypeMapper; +import com.mdd.common.util.TimeUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import javax.annotation.Resource; +import java.util.*; + +/** + * 课程类型实现类 + * @author LikeAdmin + */ +@Service +public class CourseTypeServiceImpl implements ICourseTypeService { + + @Resource + CourseTypeMapper courseTypeMapper; + + /** + * 课程类型列表 + * + * @author LikeAdmin + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + @Override + public PageResult list(PageValidate pageValidate, CourseTypeSearchValidate searchValidate) { + Integer page = pageValidate.getPage_no(); + Integer limit = pageValidate.getPage_size(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.orderByDesc("sort_order"); + + courseTypeMapper.setSearch(queryWrapper, searchValidate, new String[]{ + "like:typeName@type_name:str", + }); + + IPage iPage = courseTypeMapper.selectPage(new Page<>(page, limit), queryWrapper); + + List list = new LinkedList<>(); + for(CourseType item : iPage.getRecords()) { + CourseTypeListedVo vo = new CourseTypeListedVo(); + BeanUtils.copyProperties(item, vo); + vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime())); + list.add(vo); + } + + return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list); + } + + /** + * 课程类型详情 + * + * @author LikeAdmin + * @param id 主键参数 + * @return CourseType + */ + @Override + public CourseTypeDetailVo detail(Integer id) { + CourseType model = courseTypeMapper.selectOne( + new QueryWrapper() + .eq("id", id) + .last("limit 1")); + + Assert.notNull(model, "数据不存在"); + + CourseTypeDetailVo vo = new CourseTypeDetailVo(); + BeanUtils.copyProperties(model, vo); + return vo; + } + + /** + * 课程类型新增 + * + * @author LikeAdmin + * @param createValidate 参数 + */ + @Override + public void add(CourseTypeCreateValidate createValidate) { + CourseType model = new CourseType(); + model.setTypeName(createValidate.getTypeName()); + model.setDescription(createValidate.getDescription()); + model.setSortOrder(createValidate.getSortOrder()); + model.setCreateTime(System.currentTimeMillis() / 1000); + courseTypeMapper.insert(model); + model.setSortOrder(model.getId()); + courseTypeMapper.updateById(model); + } + + /** + * 课程类型编辑 + * + * @author LikeAdmin + * @param updateValidate 参数 + */ + @Override + public void edit(CourseTypeUpdateValidate updateValidate) { + CourseType model = courseTypeMapper.selectOne( + new QueryWrapper() + .eq("id", updateValidate.getId()) + .last("limit 1")); + + Assert.notNull(model, "数据不存在!"); + + model.setId(updateValidate.getId()); + model.setTypeName(updateValidate.getTypeName()); + model.setDescription(updateValidate.getDescription()); + model.setSortOrder(updateValidate.getSortOrder()); + courseTypeMapper.updateById(model); + } + + /** + * 课程类型删除 + * + * @author LikeAdmin + * @param id 主键ID + */ + @Override + public void del(Integer id) { + CourseType model = courseTypeMapper.selectOne( + new QueryWrapper() + .eq("id", id) + .last("limit 1")); + + Assert.notNull(model, "数据不存在!"); + + courseTypeMapper.delete(new QueryWrapper().eq("id", id)); + } + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/impl/EquipmentRequirementServiceImpl.java b/server/like-admin/src/main/java/com/mdd/admin/service/impl/EquipmentRequirementServiceImpl.java new file mode 100644 index 00000000..4a5b3a22 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/service/impl/EquipmentRequirementServiceImpl.java @@ -0,0 +1,154 @@ +package com.mdd.admin.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.mdd.admin.validate.commons.PageValidate; +import com.mdd.admin.service.IEquipmentRequirementService; +import com.mdd.admin.validate.equipmentRequirement.EquipmentRequirementCreateValidate; +import com.mdd.admin.validate.equipmentRequirement.EquipmentRequirementUpdateValidate; +import com.mdd.admin.validate.equipmentRequirement.EquipmentRequirementSearchValidate; +import com.mdd.admin.vo.EquipmentRequirementListedVo; +import com.mdd.admin.vo.EquipmentRequirementDetailVo; +import com.mdd.common.core.PageResult; +import com.mdd.common.entity.EquipmentRequirement; +import com.mdd.common.mapper.EquipmentRequirementMapper; +import com.mdd.common.util.TimeUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import javax.annotation.Resource; +import java.util.*; + +/** + * 设备要求实现类 + * @author gyp + */ +@Service +public class EquipmentRequirementServiceImpl implements IEquipmentRequirementService { + + @Resource + EquipmentRequirementMapper equipmentRequirementMapper; + + /** + * 设备要求列表 + * + * @author gyp + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + @Override + public PageResult list(PageValidate pageValidate, EquipmentRequirementSearchValidate searchValidate) { + Integer page = pageValidate.getPage_no(); + Integer limit = pageValidate.getPage_size(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.orderByDesc("id"); + + equipmentRequirementMapper.setSearch(queryWrapper, searchValidate, new String[]{ + "like:equipmentName@equipment_name:str", + "=:equipmentCode@equipment_code:str", + "=:equipmentType@equipment_type:int", + "=:status:int", + }); + + IPage iPage = equipmentRequirementMapper.selectPage(new Page<>(page, limit), queryWrapper); + + List list = new LinkedList<>(); + for(EquipmentRequirement item : iPage.getRecords()) { + EquipmentRequirementListedVo vo = new EquipmentRequirementListedVo(); + BeanUtils.copyProperties(item, vo); + vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(item.getUpdateTime())); + list.add(vo); + } + + return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list); + } + + /** + * 设备要求详情 + * + * @author gyp + * @param id 主键参数 + * @return EquipmentRequirement + */ + @Override + public EquipmentRequirementDetailVo detail(Integer id) { + EquipmentRequirement model = equipmentRequirementMapper.selectOne( + new QueryWrapper() + .eq("id", id) + .last("limit 1")); + + Assert.notNull(model, "数据不存在"); + + EquipmentRequirementDetailVo vo = new EquipmentRequirementDetailVo(); + BeanUtils.copyProperties(model, vo); + return vo; + } + + /** + * 设备要求新增 + * + * @author gyp + * @param createValidate 参数 + */ + @Override + public void add(EquipmentRequirementCreateValidate createValidate) { + EquipmentRequirement model = new EquipmentRequirement(); + model.setEquipmentName(createValidate.getEquipmentName()); + model.setEquipmentCode(createValidate.getEquipmentCode()); + model.setEquipmentType(createValidate.getEquipmentType()); + model.setDescription(createValidate.getDescription()); + model.setStatus(createValidate.getStatus()); + model.setCreateTime(System.currentTimeMillis() / 1000); + model.setUpdateTime(System.currentTimeMillis() / 1000); + equipmentRequirementMapper.insert(model); + } + + /** + * 设备要求编辑 + * + * @author gyp + * @param updateValidate 参数 + */ + @Override + public void edit(EquipmentRequirementUpdateValidate updateValidate) { + EquipmentRequirement model = equipmentRequirementMapper.selectOne( + new QueryWrapper() + .eq("id", updateValidate.getId()) + .last("limit 1")); + + Assert.notNull(model, "数据不存在!"); + + model.setId(updateValidate.getId()); + model.setEquipmentName(updateValidate.getEquipmentName()); + model.setEquipmentCode(updateValidate.getEquipmentCode()); + model.setEquipmentType(updateValidate.getEquipmentType()); + model.setDescription(updateValidate.getDescription()); + model.setStatus(updateValidate.getStatus()); + model.setUpdateTime(System.currentTimeMillis() / 1000); + equipmentRequirementMapper.updateById(model); + } + + /** + * 设备要求删除 + * + * @author gyp + * @param id 主键ID + */ + @Override + public void del(Integer id) { + EquipmentRequirement model = equipmentRequirementMapper.selectOne( + new QueryWrapper() + .eq("id", id) + .last("limit 1")); + + Assert.notNull(model, "数据不存在!"); + + equipmentRequirementMapper.delete(new QueryWrapper().eq("id", id)); + } + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/impl/StudentInfoServiceImpl.java b/server/like-admin/src/main/java/com/mdd/admin/service/impl/StudentInfoServiceImpl.java index f8553524..283a434c 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/service/impl/StudentInfoServiceImpl.java +++ b/server/like-admin/src/main/java/com/mdd/admin/service/impl/StudentInfoServiceImpl.java @@ -1,22 +1,35 @@ package com.mdd.admin.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.github.yulichang.query.MPJQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mdd.admin.validate.commons.PageValidate; import com.mdd.admin.service.IStudentInfoService; -import com.mdd.admin.validate.student.StudentInfoCreateValidate; -import com.mdd.admin.validate.student.StudentInfoUpdateValidate; -import com.mdd.admin.validate.student.StudentInfoSearchValidate; -import com.mdd.admin.vo.student.StudentInfoListedVo; -import com.mdd.admin.vo.student.StudentInfoDetailVo; +import com.mdd.admin.validate.StudentInfoCreateValidate; +import com.mdd.admin.validate.StudentInfoUpdateValidate; +import com.mdd.admin.validate.StudentInfoSearchValidate; +import com.mdd.admin.vo.StudentInfoListedVo; +import com.mdd.admin.vo.StudentInfoDetailVo; +import com.mdd.common.config.GlobalConfig; import com.mdd.common.core.PageResult; +import com.mdd.common.entity.Class; +import com.mdd.common.entity.College; +import com.mdd.common.entity.Major; import com.mdd.common.entity.StudentInfo; +import com.mdd.common.entity.admin.Admin; import com.mdd.common.entity.user.User; +import com.mdd.common.mapper.ClassMapper; +import com.mdd.common.mapper.CollegeMapper; +import com.mdd.common.mapper.MajorMapper; import com.mdd.common.mapper.StudentInfoMapper; +import com.mdd.common.mapper.admin.AdminMapper; import com.mdd.common.mapper.user.UserMapper; import com.mdd.common.util.*; +import io.netty.util.internal.ThreadLocalRandom; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.Assert; @@ -24,7 +37,6 @@ import javax.annotation.Resource; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.*; -import java.util.concurrent.ThreadLocalRandom; /** * 学生信息实现类 @@ -35,9 +47,16 @@ public class StudentInfoServiceImpl implements IStudentInfoService { @Resource StudentInfoMapper studentInfoMapper; - - @Resource - UserMapper userMapper; + @Autowired + private CollegeMapper collegeMapper; + @Autowired + private MajorMapper majorMapper; + @Autowired + private ClassMapper classMapper; + @Autowired + private AdminMapper adminMapper; + @Autowired + private UserMapper userMapper; /** * 学生信息列表 @@ -56,45 +75,45 @@ public class StudentInfoServiceImpl implements IStudentInfoService { queryWrapper.orderByDesc("id"); studentInfoMapper.setSearch(queryWrapper, searchValidate, new String[]{ - "=:userId@user_id:int", - "like:name@name:str", - "=:gender@gender:int", - "=:studentNumber@student_number:str", - "=:college:str", - "=:major:str", - "like:className@class_name:str", - "=:grade:str", - "=:enrollmentYear@enrollment_year:str", - "=:expectedGraduationYear@expected_graduation_year:str", - "=:studentStatus@student_status:str", - "=:idCard@id_card:str", - "=:birthday:str", - "=:politicalStatus@political_status:str", - "=:nativePlace@native_place:str", - "=:homeAddress@home_address:str", - "=:emergencyContact@emergency_contact:str", - "=:emergencyPhone@emergency_phone:str", - "=:dormitory:str", - "=:counselorId@counselor_id:str", - "=:totalCredits@total_credits:str", - "=:gpa:str", - "=:scholarshipLevel@scholarship_level:str", - "=:academicWarnings@academic_warnings:str", - "=:isVerified@is_verified:str", - "=:verifiedBy@verified_by:", - "=:verifiedTime@verified_time:str", + "like:name:str", + "=:gender:int", + "like:studentNumber@student_number:str", + "=:collegeId@college_id:int", + "=:majorId@major_id:int", + "=:classId@class_id:int", + "=:grade:int", + "=:enrollmentYear@enrollment_year:int", + "=:studentStatus@student_status:int", + "=:politicalStatus@political_status:int", + "like:dormitory:str", + "=:counselorId@counselor_id:int", + "=:academicWarnings@academic_warnings:int", + "=:isVerified@is_verified:int", + "=:verifiedBy@verified_by:int", }); + IPage iPage = studentInfoMapper.selectPage(new Page<>(page, limit), queryWrapper); List list = new LinkedList<>(); for(StudentInfo item : iPage.getRecords()) { StudentInfoListedVo vo = new StudentInfoListedVo(); BeanUtils.copyProperties(item, vo); - User user = userMapper.selectOne(new QueryWrapper().eq("id", vo.getUserId())); - vo.setName(user.getRealName()); - vo.setGender(user.getSex().toString()); + vo.setVerifiedTime(TimeUtils.timestampToDate(item.getVerifiedTime())); vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime())); vo.setUpdateTime(TimeUtils.timestampToDate(item.getUpdateTime())); + + College college = collegeMapper.selectById(item.getCollegeId()); + Major major = majorMapper.selectById(item.getMajorId()); + Class clazz = classMapper.selectById(item.getClassId()); + Admin counselor = adminMapper.selectById(item.getCounselorId()); + Admin verifier = adminMapper.selectById(item.getVerifiedBy()); + + vo.setCollegeName(college.getCollegeName()); + vo.setMajorName(major.getMajorName()); + vo.setClassName(clazz.getClassName()); + vo.setCounselorName(counselor.getName()); + vo.setVerifierName(verifier.getName()); + list.add(vo); } @@ -119,11 +138,6 @@ public class StudentInfoServiceImpl implements IStudentInfoService { StudentInfoDetailVo vo = new StudentInfoDetailVo(); BeanUtils.copyProperties(model, vo); - - User user = userMapper.selectOne(new QueryWrapper().eq("id", model.getUserId())); - vo.setName(user.getRealName()); - vo.setGender(user.getSex().toString()); - return vo; } @@ -136,14 +150,13 @@ public class StudentInfoServiceImpl implements IStudentInfoService { @Override public void add(StudentInfoCreateValidate createValidate) { StudentInfo model = new StudentInfo(); + model.setName(createValidate.getName()); + model.setGender(createValidate.getGender()); model.setUserId(createValidate.getUserId()); - User user = userMapper.selectOne(new QueryWrapper().eq("id", model.getUserId())); - model.setName(user.getRealName()); - model.setGender(user.getSex()); model.setStudentNumber(createValidate.getStudentNumber()); - model.setCollege(createValidate.getCollege()); - model.setMajor(createValidate.getMajor()); - model.setClassName(createValidate.getClassName()); + model.setCollegeId(createValidate.getCollegeId()); + model.setMajorId(createValidate.getMajorId()); + model.setClassId(createValidate.getClassId()); model.setGrade(createValidate.getGrade()); model.setEnrollmentYear(createValidate.getEnrollmentYear()); model.setExpectedGraduationYear(createValidate.getExpectedGraduationYear()); @@ -157,10 +170,6 @@ public class StudentInfoServiceImpl implements IStudentInfoService { model.setEmergencyPhone(createValidate.getEmergencyPhone()); model.setDormitory(createValidate.getDormitory()); model.setCounselorId(createValidate.getCounselorId()); - model.setTotalCredits(createValidate.getTotalCredits()); - model.setGpa(createValidate.getGpa()); - model.setScholarshipLevel(createValidate.getScholarshipLevel()); - model.setAcademicWarnings(createValidate.getAcademicWarnings()); model.setIsVerified(createValidate.getIsVerified()); model.setVerifiedBy(createValidate.getVerifiedBy()); model.setVerifiedTime(createValidate.getVerifiedTime()); @@ -185,14 +194,13 @@ public class StudentInfoServiceImpl implements IStudentInfoService { Assert.notNull(model, "数据不存在!"); model.setId(updateValidate.getId()); + model.setName(updateValidate.getName()); + model.setGender(updateValidate.getGender()); model.setUserId(updateValidate.getUserId()); - User user = userMapper.selectOne(new QueryWrapper().eq("id", model.getUserId())); - model.setName(user.getRealName()); - model.setGender(user.getSex()); model.setStudentNumber(updateValidate.getStudentNumber()); - model.setCollege(updateValidate.getCollege()); - model.setMajor(updateValidate.getMajor()); - model.setClassName(updateValidate.getClassName()); + model.setCollegeId(updateValidate.getCollegeId()); + model.setMajorId(updateValidate.getMajorId()); + model.setClassId(updateValidate.getClassId()); model.setGrade(updateValidate.getGrade()); model.setEnrollmentYear(updateValidate.getEnrollmentYear()); model.setExpectedGraduationYear(updateValidate.getExpectedGraduationYear()); @@ -208,7 +216,6 @@ public class StudentInfoServiceImpl implements IStudentInfoService { model.setCounselorId(updateValidate.getCounselorId()); model.setTotalCredits(updateValidate.getTotalCredits()); model.setGpa(updateValidate.getGpa()); - model.setScholarshipLevel(updateValidate.getScholarshipLevel()); model.setAcademicWarnings(updateValidate.getAcademicWarnings()); model.setIsVerified(updateValidate.getIsVerified()); model.setVerifiedBy(updateValidate.getVerifiedBy()); @@ -237,6 +244,7 @@ public class StudentInfoServiceImpl implements IStudentInfoService { @Override public void createRandomInfo(Integer num) { + if (num == null) throw new NullPointerException("未发送数量"); for (int i = 0; i < num; i++) { // 生成随机姓名 String name = SimpleRandomGenerator.randomName(); @@ -252,25 +260,85 @@ public class StudentInfoServiceImpl implements IStudentInfoService { // 生成学生信息 StudentInfoCreateValidate createValidate = new StudentInfoCreateValidate(); createValidate.setUserId(userId); + createValidate.setName(name); + createValidate.setGender(SimpleRandomGenerator.extractGenderFromIdCard(idCard)); createValidate.setStudentNumber(account); - createValidate.setCollege("测试学院"); - createValidate.setMajor("测试专业"); - createValidate.setClassName("测试25001"); - createValidate.setGrade("1"); - createValidate.setEnrollmentYear("2022"); - createValidate.setExpectedGraduationYear("2026"); - createValidate.setStudentStatus("1"); + Class clazz = getRandomEntity(classMapper); + if (clazz == null) {throw new RuntimeException("为随机学生分配班级信息错误");} + createValidate.setClassId(clazz.getId()); + createValidate.setMajorId(clazz.getMajorId()); + createValidate.setCollegeId(clazz.getCollegeId()); + Integer enrollmentYear = clazz.getEnrollmentYear(); + createValidate.setGrade(calculateGrade(enrollmentYear)); + createValidate.setEnrollmentYear(enrollmentYear); + createValidate.setExpectedGraduationYear(enrollmentYear + 4); + createValidate.setStudentStatus(1); createValidate.setIdCard(idCard); createValidate.setBirthday(SimpleRandomGenerator.extractBirthdayFromIdCard(idCard)); - createValidate.setPoliticalStatus("3"); - createValidate.setIsVerified("1"); - createValidate.setVerifiedBy("1"); + createValidate.setPoliticalStatus(random.nextInt(3) + 1); + createValidate.setIsVerified(1); + createValidate.setVerifiedBy(1); + createValidate.setVerifiedTime(System.currentTimeMillis() / 1000); + createValidate.setCounselorId(clazz.getHeadTeacherId()); // 创建学生信息 add(createValidate); } } + private > T getRandomEntity(M mapper) { + try { + QueryWrapper wrapper = new QueryWrapper<>(); + List entityList = mapper.selectList(wrapper); + + // 检查列表是否为空 + if (entityList == null || entityList.isEmpty()) { + return null; + } + + // 生成随机索引 + Random random = new Random(); + int randomIndex = random.nextInt(entityList.size()); + return entityList.get(randomIndex); + + } catch (Exception e) { + return null; + } + } + + /** + * 根据班级入学年份计算当前年级 + * @param enrollmentYear 班级入学年份 + * @return 当前年级(1-4 对应大一到大四) + */ + private Integer calculateGrade(Integer enrollmentYear) { + if (enrollmentYear == null) { + return null; + } + + // 获取当前年份 + Calendar calendar = Calendar.getInstance(); + int currentYear = calendar.get(Calendar.YEAR); + int currentMonth = calendar.get(Calendar.MONTH) + 1; // 月份从0开始,需要+1 + + // 计算年级 + int grade = currentYear - enrollmentYear; + + // 调整:如果当前月份在9月之前(秋季学期开始前),年级减1 + if (currentMonth < 9) { + grade--; + } + + // 确保年级在合理范围内(1-4) + if (grade < 1) { + grade = 1; // 最小为大一 + } else if (grade > 4) { + grade = 4; // 最大为大四 + } + + return grade; + } + private Integer createRandomUser(String name, String idCard, Integer sn) { User user = new User(); user.setNickname(name); @@ -292,6 +360,7 @@ public class StudentInfoServiceImpl implements IStudentInfoService { User user2 = userMapper.selectOne(new QueryWrapper().eq("account", user.getAccount())); return user2.getId(); } + } class SimpleRandomGenerator { diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/impl/TimeSlotServiceImpl.java b/server/like-admin/src/main/java/com/mdd/admin/service/impl/TimeSlotServiceImpl.java new file mode 100644 index 00000000..d749b5f5 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/service/impl/TimeSlotServiceImpl.java @@ -0,0 +1,250 @@ +package com.mdd.admin.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.mdd.admin.dto.TimeSlotCreateDTO; +import com.mdd.admin.validate.TimeSlotForRowUpdateValidate; +import com.mdd.admin.service.ITimeSlotService; +import com.mdd.admin.validate.TimeSlotInsertValidate; +import com.mdd.admin.validate.TimeSlotSearchValidate; +import com.mdd.admin.validate.TimeSlotUniformValidate; +import com.mdd.admin.vo.TimeSlotListedVo; +import com.mdd.admin.vo.TimeSlotDetailVo; +import com.mdd.common.core.PageResult; +import com.mdd.common.entity.TimeSlot; +import com.mdd.common.mapper.TimeSlotMapper; +import com.mdd.common.util.TimeUtils; +import org.checkerframework.checker.guieffect.qual.UIPackage; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import javax.annotation.Resource; +import java.time.Duration; +import java.time.LocalTime; +import java.util.*; + +/** + * 时间段实现类 + * @author gyp + */ +@Service +public class TimeSlotServiceImpl implements ITimeSlotService { + + @Resource + TimeSlotMapper timeSlotMapper; + + /** + * 时间段列表 + * + * @author gyp + * @return PageResult + */ + @Override + public List list() { + List list = timeSlotMapper.selectList(null); + List result = new LinkedList<>(); + for(TimeSlot item : list) { + TimeSlotListedVo vo = new TimeSlotListedVo(); + BeanUtils.copyProperties(item, vo); + vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(item.getUpdateTime())); + result.add(vo); + } + return result; + } + + /** + * 时间段详情 + * + * @author gyp + * @param id 主键参数 + * @return TimeSlot + */ + @Override + public TimeSlotDetailVo detail(Integer id) { + TimeSlot model = timeSlotMapper.selectOne( + new QueryWrapper() + .eq("id", id) + .last("limit 1")); + + Assert.notNull(model, "数据不存在"); + + TimeSlotDetailVo vo = new TimeSlotDetailVo(); + BeanUtils.copyProperties(model, vo); + return vo; + } + + /** + * 时间段新增 + * + * @author gyp + */ + @Override + public void add(TimeSlotCreateDTO dto) { + TimeSlot model = new TimeSlot(); + BeanUtils.copyProperties(dto, model); + model.setCreateTime(System.currentTimeMillis() / 1000); + model.setUpdateTime(System.currentTimeMillis() / 1000); + timeSlotMapper.insert(model); + } + + /** + * 节次编辑 + * 修改节次开始时间和修改节次时长,保证修改后上节次结束时间与早于等于下节次的开始时间 + * + * @author gyp + * @param updateValidate 参数 + */ + @Override + public void edit(TimeSlotForRowUpdateValidate updateValidate) { + if (updateValidate.getSection() == null) { + throw new RuntimeException("未选择编辑节次"); + } + // 提取所有为该节次的时间段 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.orderByDesc("day_of_week"); + timeSlotMapper.setSearch(queryWrapper, updateValidate, new String[]{"=:section@section:int",}); + List timeSlots = timeSlotMapper.selectList(queryWrapper); + // 递归修改所有节次 + recursiveEditing(timeSlots, updateValidate); + + } + private void recursiveEditing(List timeSlots, TimeSlotForRowUpdateValidate updateValidate) { + for(TimeSlot timeSlot : timeSlots) { + timeSlot.setUpdateTime(System.currentTimeMillis() / 1000); + timeSlot.setStartTime(updateValidate.getStartTime()); + timeSlot.setEndTime(updateValidate.getEndTime()); + timeSlot.setIsScheduled(updateValidate.getIsScheduled()); + timeSlotMapper.updateById(timeSlot); + } + // 修改完成后,提取下个节次的所有时间段 + TimeSlotForRowUpdateValidate updateValidate2 = new TimeSlotForRowUpdateValidate(); + updateValidate2.setSection(updateValidate.getSection()+1); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.orderByDesc("day_of_week"); + timeSlotMapper.setSearch(queryWrapper, updateValidate2, new String[]{"=:section@section:int",}); + List timeSlots2 = timeSlotMapper.selectList(queryWrapper); + + if(timeSlots2.isEmpty()) return; // 没有下一时间段,跳出递归 + + LocalTime a = updateValidate.getEndTime(); // 当前节次结束时间 + LocalTime b = timeSlots2.get(0).getStartTime(); // 下一节次开始时间 + LocalTime c = timeSlots2.get(0).getEndTime(); // 下一节次结束时间 + // 若当前结束时间比下一开始时间晚,进入递归 + if(a.isAfter(b)) { + long min = Duration.between(b,a).toMinutes(); + updateValidate2.setStartTime(b.plusMinutes(min)); + updateValidate2.setEndTime(c.plusMinutes(min)); + updateValidate2.setIsScheduled(timeSlots2.get(0).getIsScheduled()); + recursiveEditing(timeSlots2, updateValidate2); + } + } + + /** + * 时间段删除 + * + * @author gyp + */ + @Override + public void del(Integer count) { + Integer index = getDailySectionCount(); // 当前节次数 + for(int i = 0; i < count; i++) { + int section = index-i; // 要删除的节次 + if(section < 1) break; // 若要删除的节次已经小于1,则无可删除,提取结束循环 + timeSlotMapper.delete(new QueryWrapper().eq("section", section)); + } + } + + @Override + public void insert(TimeSlotInsertValidate insertValidate) { + int num = 0; + if(insertValidate.getNum() != null) num = insertValidate.getNum(); + LocalTime startTime = insertValidate.getStartTime(); + Integer duration = insertValidate.getDuration(); + Integer intervalDuration = insertValidate.getIntervalDuration(); + int index = getDailySectionCount(); + for (int i = 0; i < num; i++) { // 连续添加节次行数 + // 当前开始时间 = 初始开始时间 + 循环次数 * (上课时长+下课时长) + LocalTime curStartTime = startTime.plusMinutes((long) i *(duration+intervalDuration)); + for (int j = 0; j < 7; j++) { // 添加一行节次(7次即每周有7天) + TimeSlotCreateDTO dto = new TimeSlotCreateDTO(); + dto.setSection(index+1+i); // 设置当前时间段的节次 + dto.setDayOfWeek(j+1); // 设置星期几 + dto.setSlotCode(getSlotCode(dto)); // 设置时间段代码(节次+星期几) + dto.setSlotName(dto.getSlotCode()); // 没想好命名 + dto.setIsScheduled(insertValidate.getIsScheduled());// 是否参与排课 + dto.setStartTime(curStartTime); + dto.setEndTime(dto.getStartTime().plusMinutes(insertValidate.getDuration()));// 结束时间 + add(dto); + } + } + } + + @Override + public void uniform(TimeSlotUniformValidate uniformValidate, LocalTime lastEndTime, Integer section) { + // 获取当前节次开始与结束时间 + TimeSlot timeSlot = timeSlotMapper.selectOne( + new QueryWrapper().eq("section", section).eq("day_of_week", 1)); + if(timeSlot == null) return; + LocalTime startTime = timeSlot.getStartTime(); + LocalTime endTime = timeSlot.getEndTime(); + // 判断是否要修改当前节次的开始时间 + if(lastEndTime != null && Duration.between(lastEndTime, startTime).toMinutes() < uniformValidate.getIntervalDuration()) { + startTime = lastEndTime.plusMinutes(uniformValidate.getIntervalDuration()); + } + // 获取间隔时间差 + Integer duration = (int)Duration.between(startTime,endTime).toMinutes(); + // 计算需要修改的时间差 + int diffVal = uniformValidate.getDuration() - duration; + // 修改当前节的结束时间 + endTime = endTime.plusMinutes(diffVal); + // 调用edit方法更新 + TimeSlotForRowUpdateValidate updateValidate = new TimeSlotForRowUpdateValidate(); + updateValidate.setSection(timeSlot.getSection()); + updateValidate.setStartTime(startTime); + updateValidate.setEndTime(endTime); + updateValidate.setIsScheduled(timeSlot.getIsScheduled()); + edit(updateValidate); + // 递归修改 + uniform(uniformValidate, endTime, section+1); + } + + /** + * 设置时间段代码(星期几+节次) + * */ + private String getSlotCode(TimeSlotCreateDTO dto) { + Integer dayOfWeek = dto.getDayOfWeek(); + Integer section = dto.getSection(); + String code = section.toString(); + if(section < 10) code = "0"+section; + String dayOfWeekStr; + switch (dayOfWeek) { + case 1: dayOfWeekStr = "mon"; break; + case 2: dayOfWeekStr = "tue"; break; + case 3: dayOfWeekStr = "wed"; break; + case 4: dayOfWeekStr = "thu"; break; + case 5: dayOfWeekStr = "fri"; break; + case 6: dayOfWeekStr = "sat"; break; + case 7: dayOfWeekStr = "sun"; break; + default: dayOfWeekStr = ""; + } + return code + dayOfWeekStr; + } + + /** + * 查询一共有多少个有效节次 + * @return 周一的时间段数量(无数据返回 0) + */ + private Integer getDailySectionCount() { + // 构建查询条件:1. 周一(day_of_week=1);2. 未逻辑删除(delete_time IS NULL) + QueryWrapper queryWrapper = new QueryWrapper() + .eq("day_of_week", 1) // 表结构注释:1=周一 + .isNull("delete_time"); // 过滤已删除的无效数据 + + long count = timeSlotMapper.selectCount(queryWrapper); + + return (int) count; + } +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/impl/admin/AdminServiceImpl.java b/server/like-admin/src/main/java/com/mdd/admin/service/impl/admin/AdminServiceImpl.java index 1138caf5..742c5cdf 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/service/impl/admin/AdminServiceImpl.java +++ b/server/like-admin/src/main/java/com/mdd/admin/service/impl/admin/AdminServiceImpl.java @@ -527,7 +527,7 @@ public class AdminServiceImpl implements IAdminService { AdminMySelfVo ret = new AdminMySelfVo(); // 当前管理员角色拥有的菜单 ret.setMenu(systemMenuService.selectMenuByRoleId(roleIds)); - // 当前管理员橘色拥有的按钮权限 + // 当前管理员角色拥有的按钮权限 ret.setPermissions(iAuthService.getBtnAuthByRoleId(id)); SystemAuthAdminDetailVo admin = detail(id); AuthMySelfVo user = new AuthMySelfVo(); diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/impl/system/SystemMenuServiceImpl.java b/server/like-admin/src/main/java/com/mdd/admin/service/impl/system/SystemMenuServiceImpl.java index 54d9e6dc..066baa3a 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/service/impl/system/SystemMenuServiceImpl.java +++ b/server/like-admin/src/main/java/com/mdd/admin/service/impl/system/SystemMenuServiceImpl.java @@ -71,7 +71,36 @@ public class SystemMenuServiceImpl implements ISystemMenuService { } JSONArray jsonArray = JSONArray.parseArray(JSONArray.toJSONString(lists)); - return ListUtils.listToTree(jsonArray, "id", "pid", "children"); + JSONArray r = ListUtils.listToTree(jsonArray, "id", "pid", "children"); + return r; + } + + /** + * 递归遍历树形结构,设置hasChildren字段 + * @param nodes 节点数组 + * @param childFieldName 子节点字段名 + */ + private static void setHasChildrenField(JSONArray nodes, String childFieldName) { + for (Object nodeObj : nodes) { + JSONObject node = (JSONObject) nodeObj; + + // 检查当前节点是否有子节点 + if (node.containsKey(childFieldName)) { + JSONArray children = node.getJSONArray(childFieldName); + if (children != null && !children.isEmpty()) { + // 有子节点,设置hasChildren为true + node.put("hasChildren", true); + // 递归处理子节点 + setHasChildrenField(children, childFieldName); + } else { + // 有children字段但为空,设置为false + node.put("hasChildren", false); + } + } else { + // 没有children字段,设置为0 + node.put("hasChildren", false); + } + } } /** @@ -128,8 +157,8 @@ public class SystemMenuServiceImpl implements ISystemMenuService { } JSONArray jsonArray = JSONArray.parseArray(JSONArray.toJSONString(lists)); - - return ListUtils.listToTree(jsonArray, "id", "pid", "children"); + JSONArray r = ListUtils.listToTree(jsonArray, "id", "pid", "children"); + return r; } /** diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomCreateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomCreateValidate.java new file mode 100644 index 00000000..c7ae8262 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomCreateValidate.java @@ -0,0 +1,42 @@ +package com.mdd.admin.validate; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import javax.validation.constraints.*; + +@Data +@ApiModel("教室创建参数") +public class ClassroomCreateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "classroomCode参数缺失") + @ApiModelProperty(value = "教室编号") + private String classroomCode; + + @NotNull(message = "classroomName参数缺失") + @ApiModelProperty(value = "教室名称") + private String classroomName; + + @NotNull(message = "classroomTypeId参数缺失") + @ApiModelProperty(value = "教室类型ID") + private Integer classroomTypeId; + + @NotNull(message = "capacity参数缺失") + @ApiModelProperty(value = "教室容量(座位数)") + private Integer capacity; + + @NotNull(message = "location参数缺失") + @ApiModelProperty(value = "教室位置") + private String location; + + @ApiModelProperty(value = "特殊要求说明") + private String specialRequirements; + + @NotNull(message = "status参数缺失") + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomSearchValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomSearchValidate.java new file mode 100644 index 00000000..4b9cb148 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomSearchValidate.java @@ -0,0 +1,29 @@ +package com.mdd.admin.validate; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; + +@Data +@ApiModel("教室搜素参数") +public class ClassroomSearchValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "教室编号") + private String classroomCode; + + @ApiModelProperty(value = "教室名称") + private String classroomName; + + @ApiModelProperty(value = "教室类型ID") + private Integer classroomTypeId; + + @ApiModelProperty(value = "教室位置") + private String location; + + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomTypeCreateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomTypeCreateValidate.java new file mode 100644 index 00000000..8c7b3978 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomTypeCreateValidate.java @@ -0,0 +1,30 @@ +package com.mdd.admin.validate; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import javax.validation.constraints.*; + +@Data +@ApiModel("教室类型创建参数") +public class ClassroomTypeCreateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "typeName参数缺失") + @ApiModelProperty(value = "类型名称(如:普通教室、实验室、多媒体教室、体育场等)") + private String typeName; + + @NotNull(message = "typeCode参数缺失") + @ApiModelProperty(value = "类型编码") + private String typeCode; + + @ApiModelProperty(value = "类型描述") + private String description; + + @NotNull(message = "status参数缺失") + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomTypeSearchValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomTypeSearchValidate.java new file mode 100644 index 00000000..b808d258 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomTypeSearchValidate.java @@ -0,0 +1,23 @@ +package com.mdd.admin.validate; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; + +@Data +@ApiModel("教室类型搜素参数") +public class ClassroomTypeSearchValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "类型名称(如:普通教室、实验室、多媒体教室、体育场等)") + private String typeName; + + @ApiModelProperty(value = "类型编码") + private String typeCode; + + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomTypeUpdateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomTypeUpdateValidate.java new file mode 100644 index 00000000..8c065c05 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomTypeUpdateValidate.java @@ -0,0 +1,39 @@ +package com.mdd.admin.validate; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import javax.validation.constraints.*; +import com.mdd.common.validator.annotation.IDMust; + +/** + * 教室类型参数 + * @author gyp + */ +@Data +@ApiModel("教室类型更新参数") +public class ClassroomTypeUpdateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @IDMust(message = "id参数必传且需大于0") + @ApiModelProperty(value = "") + private Integer id; + + @NotNull(message = "typeName参数缺失") + @ApiModelProperty(value = "类型名称(如:普通教室、实验室、多媒体教室、体育场等)") + private String typeName; + + @NotNull(message = "typeCode参数缺失") + @ApiModelProperty(value = "类型编码") + private String typeCode; + + @ApiModelProperty(value = "类型描述") + private String description; + + @NotNull(message = "status参数缺失") + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomUpdateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomUpdateValidate.java new file mode 100644 index 00000000..195c8cf1 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/ClassroomUpdateValidate.java @@ -0,0 +1,51 @@ +package com.mdd.admin.validate; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import javax.validation.constraints.*; +import com.mdd.common.validator.annotation.IDMust; + +/** + * 教室参数 + * @author LikeAdmin + */ +@Data +@ApiModel("教室更新参数") +public class ClassroomUpdateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @IDMust(message = "id参数必传且需大于0") + @ApiModelProperty(value = "") + private Integer id; + + @NotNull(message = "classroomCode参数缺失") + @ApiModelProperty(value = "教室编号") + private String classroomCode; + + @NotNull(message = "classroomName参数缺失") + @ApiModelProperty(value = "教室名称") + private String classroomName; + + @NotNull(message = "classroomTypeId参数缺失") + @ApiModelProperty(value = "教室类型ID") + private Integer classroomTypeId; + + @NotNull(message = "capacity参数缺失") + @ApiModelProperty(value = "教室容量(座位数)") + private Integer capacity; + + @NotNull(message = "location参数缺失") + @ApiModelProperty(value = "教室位置") + private String location; + + @ApiModelProperty(value = "特殊要求说明") + private String specialRequirements; + + @NotNull(message = "status参数缺失") + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoCreateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoCreateValidate.java new file mode 100644 index 00000000..a286c5d5 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoCreateValidate.java @@ -0,0 +1,104 @@ +package com.mdd.admin.validate; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import java.math.BigDecimal; +import java.math.BigDecimal; +import javax.validation.constraints.*; + +@Data +@ApiModel("学生信息创建参数") +public class StudentInfoCreateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "name参数缺失") + @ApiModelProperty(value = "姓名") + private String name; + + @NotNull(message = "gender参数缺失") + @ApiModelProperty(value = "性别 1-男 2-女") + private Integer gender; + + @NotNull(message = "userId参数缺失") + @ApiModelProperty(value = "关联用户ID") + private Integer userId; + + @NotNull(message = "studentNumber参数缺失") + @ApiModelProperty(value = "学号") + private String studentNumber; + + @NotNull(message = "collegeId参数缺失") + @ApiModelProperty(value = "学院ID") + private Integer collegeId; + + @NotNull(message = "majorId参数缺失") + @ApiModelProperty(value = "专业ID") + private Integer majorId; + + @NotNull(message = "classId参数缺失") + @ApiModelProperty(value = "班级ID") + private Integer classId; + + @NotNull(message = "grade参数缺失") + @ApiModelProperty(value = "年级") + private Integer grade; + + @NotNull(message = "enrollmentYear参数缺失") + @ApiModelProperty(value = "入学年份") + private Integer enrollmentYear; + + @NotNull(message = "expectedGraduationYear参数缺失") + @ApiModelProperty(value = "预计毕业年份") + private Integer expectedGraduationYear; + + @NotNull(message = "studentStatus参数缺失") + @ApiModelProperty(value = "学生状态: [1=在读, 2=休学, 3=毕业, 4=退学]") + private Integer studentStatus; + + @NotNull(message = "idCard参数缺失") + @ApiModelProperty(value = "身份证号") + private String idCard; + + @NotNull(message = "birthday参数缺失") + @ApiModelProperty(value = "出生日期") + private String birthday; + + @NotNull(message = "politicalStatus参数缺失") + @ApiModelProperty(value = "政治面貌: [1=党员, 2=团员, 3=群众]") + private Integer politicalStatus; + + @NotNull(message = "nativePlace参数缺失") + @ApiModelProperty(value = "籍贯") + private String nativePlace; + + @ApiModelProperty(value = "家庭住址") + private String homeAddress; + + @ApiModelProperty(value = "紧急联系人") + private String emergencyContact; + + @ApiModelProperty(value = "紧急联系电话") + private String emergencyPhone; + + @ApiModelProperty(value = "宿舍号") + private String dormitory; + + @ApiModelProperty(value = "辅导员用户ID") + private Integer counselorId; + + @NotNull(message = "isVerified参数缺失") + @ApiModelProperty(value = "是否认证: [0=未认证, 1=已认证]") + private Integer isVerified; + + @NotNull(message = "verifiedBy参数缺失") + @ApiModelProperty(value = "认证人ID") + private Integer verifiedBy; + + @NotNull(message = "verifiedTime参数缺失") + @ApiModelProperty(value = "认证时间") + private Long verifiedTime; + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoSearchValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoSearchValidate.java new file mode 100644 index 00000000..85307aa2 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoSearchValidate.java @@ -0,0 +1,61 @@ +package com.mdd.admin.validate; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import java.math.BigDecimal; +import java.math.BigDecimal; + +@Data +@ApiModel("学生信息搜素参数") +public class StudentInfoSearchValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "姓名") + private String name; + + @ApiModelProperty(value = "性别 1-男 2-女") + private Integer gender; + + @ApiModelProperty(value = "学号") + private String studentNumber; + + @ApiModelProperty(value = "学院ID") + private Integer collegeId; + + @ApiModelProperty(value = "专业ID") + private Integer majorId; + + @ApiModelProperty(value = "班级ID") + private Integer classId; + + @ApiModelProperty(value = "年级") + private Integer grade; + + @ApiModelProperty(value = "入学年份") + private Integer enrollmentYear; + + @ApiModelProperty(value = "学生状态: [1=在读, 2=休学, 3=毕业, 4=退学]") + private Integer studentStatus; + + @ApiModelProperty(value = "政治面貌: [1=党员, 2=团员, 3=群众]") + private Integer politicalStatus; + + @ApiModelProperty(value = "宿舍号") + private String dormitory; + + @ApiModelProperty(value = "辅导员用户ID") + private Integer counselorId; + + @ApiModelProperty(value = "学业预警: [0=无, 1=一级预警, 2=二级预警, 3=三级预警]") + private Integer academicWarnings; + + @ApiModelProperty(value = "是否认证: [0=未认证, 1=已认证]") + private Integer isVerified; + + @ApiModelProperty(value = "认证人ID") + private Integer verifiedBy; + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/student/StudentInfoCreateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoUpdateValidate.java similarity index 63% rename from server/like-admin/src/main/java/com/mdd/admin/validate/student/StudentInfoCreateValidate.java rename to server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoUpdateValidate.java index a6589ebd..c8d55951 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/validate/student/StudentInfoCreateValidate.java +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoUpdateValidate.java @@ -1,18 +1,36 @@ -package com.mdd.admin.validate.student; +package com.mdd.admin.validate; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; -import java.math.BigDecimal; import javax.validation.constraints.*; +import java.math.BigDecimal; +import java.math.BigDecimal; +import com.mdd.common.validator.annotation.IDMust; +/** + * 学生信息参数 + * @author gyp + */ @Data -@ApiModel("学生信息创建参数") -public class StudentInfoCreateValidate implements Serializable { +@ApiModel("学生信息更新参数") +public class StudentInfoUpdateValidate implements Serializable { private static final long serialVersionUID = 1L; + @IDMust(message = "id参数必传且需大于0") + @ApiModelProperty(value = "主键") + private Integer id; + + @NotNull(message = "name参数缺失") + @ApiModelProperty(value = "姓名") + private String name; + + @NotNull(message = "gender参数缺失") + @ApiModelProperty(value = "性别 1-男 2-女") + private Integer gender; + @NotNull(message = "userId参数缺失") @ApiModelProperty(value = "关联用户ID") private Integer userId; @@ -21,33 +39,33 @@ public class StudentInfoCreateValidate implements Serializable { @ApiModelProperty(value = "学号") private String studentNumber; - @NotNull(message = "college参数缺失") - @ApiModelProperty(value = "学院") - private String college; + @NotNull(message = "collegeId参数缺失") + @ApiModelProperty(value = "学院ID") + private Integer collegeId; - @NotNull(message = "major参数缺失") - @ApiModelProperty(value = "专业") - private String major; + @NotNull(message = "majorId参数缺失") + @ApiModelProperty(value = "专业ID") + private Integer majorId; - @NotNull(message = "className参数缺失") - @ApiModelProperty(value = "班级") - private String className; + @NotNull(message = "classId参数缺失") + @ApiModelProperty(value = "班级ID") + private Integer classId; @NotNull(message = "grade参数缺失") @ApiModelProperty(value = "年级") - private String grade; + private Integer grade; @NotNull(message = "enrollmentYear参数缺失") @ApiModelProperty(value = "入学年份") - private String enrollmentYear; + private Integer enrollmentYear; @NotNull(message = "expectedGraduationYear参数缺失") @ApiModelProperty(value = "预计毕业年份") - private String expectedGraduationYear; + private Integer expectedGraduationYear; @NotNull(message = "studentStatus参数缺失") @ApiModelProperty(value = "学生状态: [1=在读, 2=休学, 3=毕业, 4=退学]") - private String studentStatus; + private Integer studentStatus; @NotNull(message = "idCard参数缺失") @ApiModelProperty(value = "身份证号") @@ -59,58 +77,46 @@ public class StudentInfoCreateValidate implements Serializable { @NotNull(message = "politicalStatus参数缺失") @ApiModelProperty(value = "政治面貌: [1=党员, 2=团员, 3=群众]") - private String politicalStatus; + private Integer politicalStatus; @NotNull(message = "nativePlace参数缺失") @ApiModelProperty(value = "籍贯") private String nativePlace; - @NotNull(message = "homeAddress参数缺失") @ApiModelProperty(value = "家庭住址") private String homeAddress; - @NotNull(message = "emergencyContact参数缺失") @ApiModelProperty(value = "紧急联系人") private String emergencyContact; - @NotNull(message = "emergencyPhone参数缺失") @ApiModelProperty(value = "紧急联系电话") private String emergencyPhone; - @NotNull(message = "dormitory参数缺失") @ApiModelProperty(value = "宿舍号") private String dormitory; - @NotNull(message = "counselorId参数缺失") @ApiModelProperty(value = "辅导员用户ID") - private String counselorId; + private Integer counselorId; - @NotNull(message = "totalCredits参数缺失") @ApiModelProperty(value = "总学分") private BigDecimal totalCredits; - @NotNull(message = "gpa参数缺失") @ApiModelProperty(value = "平均绩点") private BigDecimal gpa; - @NotNull(message = "scholarshipLevel参数缺失") - @ApiModelProperty(value = "奖学金等级: [0=无, 1=一等奖, 2=二等奖, 3=三等奖]") - private String scholarshipLevel; - - @NotNull(message = "academicWarnings参数缺失") @ApiModelProperty(value = "学业预警: [0=无, 1=一级预警, 2=二级预警, 3=三级预警]") - private String academicWarnings; + private Integer academicWarnings; @NotNull(message = "isVerified参数缺失") @ApiModelProperty(value = "是否认证: [0=未认证, 1=已认证]") - private String isVerified; + private Integer isVerified; @NotNull(message = "verifiedBy参数缺失") @ApiModelProperty(value = "认证人ID") - private String verifiedBy; + private Integer verifiedBy; @NotNull(message = "verifiedTime参数缺失") @ApiModelProperty(value = "认证时间") - private String verifiedTime; + private Long verifiedTime; } diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotForRowUpdateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotForRowUpdateValidate.java new file mode 100644 index 00000000..d98bb7b0 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotForRowUpdateValidate.java @@ -0,0 +1,34 @@ +package com.mdd.admin.validate; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.models.auth.In; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.LocalTime; + +/** + * 时间段参数 + * @author gyp + */ +@Data +@ApiModel("某节时间段更新参数") +public class TimeSlotForRowUpdateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "所选节次不为空") + @ApiModelProperty(value = "要修改的节次") + private Integer section; + + @ApiModelProperty(value = "该节次开始时间") + private LocalTime startTime; + + @ApiModelProperty(value = "该节次结束时间") + private LocalTime endTime; + + @ApiModelProperty(value = "是否排课") + private Integer isScheduled; +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotInsertValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotInsertValidate.java new file mode 100644 index 00000000..79b9b28d --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotInsertValidate.java @@ -0,0 +1,33 @@ +package com.mdd.admin.validate; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import java.time.LocalTime; +import javax.validation.constraints.*; + +@Data +@ApiModel("时间表创建参数") +public class TimeSlotInsertValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "开始时间不为空") + @ApiModelProperty(value = "开始时间") + private LocalTime startTime; + + @NotNull(message = "节次时长不为空") + @ApiModelProperty(value = "每节课时长(分钟)") + private Integer duration; + + @NotNull(message = "未决定节次是否参与排课") + @ApiModelProperty(value = "是否参与排课") + private Integer isScheduled; + + @ApiModelProperty(value = "连续插入节次数") + private Integer num; + + @ApiModelProperty(value = "每节课间隔时长(分钟)") + private Integer intervalDuration; +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotSearchValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotSearchValidate.java new file mode 100644 index 00000000..199a7af8 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotSearchValidate.java @@ -0,0 +1,29 @@ +package com.mdd.admin.validate; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; + +@Data +@ApiModel("时间段搜素参数") +public class TimeSlotSearchValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "时间段代码") + private String slotCode; + + @ApiModelProperty(value = "星期几:1-周一,2-周二,3-周三,4-周四,5-周五,6-周六,7-周日") + private Integer dayOfWeek; + + @ApiModelProperty(value = "时间段名称") + private String slotName; + + @ApiModelProperty(value = "时间段类型:1-上午,2-下午,3-晚上") + private Integer slotType; + + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotSectionDelValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotSectionDelValidate.java new file mode 100644 index 00000000..7608548c --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotSectionDelValidate.java @@ -0,0 +1,19 @@ +package com.mdd.admin.validate; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel("TimeSlotSectionDelValidate删除节次数参数") +public class TimeSlotSectionDelValidate implements Serializable { + private static final long serialVersionUID = 1L; + + @NotNull(message = "删除节次数不为空") + @ApiModelProperty(value = "要删除的节次数") + private Integer count; +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotUniformValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotUniformValidate.java new file mode 100644 index 00000000..3e838d5b --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotUniformValidate.java @@ -0,0 +1,22 @@ +package com.mdd.admin.validate; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel("TimeSlotSectionDelValidate删除节次数参数") +public class TimeSlotUniformValidate implements Serializable { + private static final long serialVersionUID = 1L; + + @NotNull(message = "节次统一时长不为空") + @ApiModelProperty(value = "统一节次时长") + private Integer duration; + + @NotNull + @ApiModelProperty(value = "统一最小节次间隔") + private Integer intervalDuration; +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotUpdateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotUpdateValidate.java new file mode 100644 index 00000000..70691407 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/TimeSlotUpdateValidate.java @@ -0,0 +1,31 @@ +package com.mdd.admin.validate; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import javax.validation.constraints.*; +import com.mdd.common.validator.annotation.IDMust; + +/** + * 时间段参数 + * @author gyp + */ +@Data +@ApiModel("时间表更新参数") +public class TimeSlotUpdateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "每天节次不为空") + @ApiModelProperty(value = "每天节次") + private Integer num; + + @NotNull(message = "每节课时长不为空(分钟)") + @ApiModelProperty(value = "每节课时长") + private Integer duration; + + @NotNull(message = "每节课间隔时长不为空") + @ApiModelProperty(value = "每节课间隔时长(分钟)") + private Integer intervalDuration; +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/commons/NumValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/commons/NumValidate.java new file mode 100644 index 00000000..c88e8776 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/commons/NumValidate.java @@ -0,0 +1,18 @@ +package com.mdd.admin.validate.commons; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel("数量参数") +public class NumValidate implements Serializable { + private static final long serialVersionUID = 1L; + + @NotNull(message = "数量参数缺失") + @ApiModelProperty(value = "数量", required = true) + private Integer num; +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseCreateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseCreateValidate.java index bf0ef788..acc14416 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseCreateValidate.java +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseCreateValidate.java @@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; +import java.util.List; @Data @ApiModel("课程创建参数") @@ -12,19 +13,19 @@ public class CourseCreateValidate implements Serializable { private static final long serialVersionUID = 1L; - @ApiModelProperty(value = "课程代码") + @ApiModelProperty(value = "课程代码(必填,唯一标识)") private String courseCode; - @ApiModelProperty(value = "课程名称") + @ApiModelProperty(value = "课程名称(必填,全称)") private String courseName; - @ApiModelProperty(value = "课程类型:1-理论课,2-实验课,3-研讨课,4-体育课,5-实践课") - private Integer courseType; + @ApiModelProperty(value = "课程类型ID") + private Integer courseTypeId; - @ApiModelProperty(value = "学分") + @ApiModelProperty(value = "学分(必填,支持小数)") private BigDecimal credits; - @ApiModelProperty(value = "总学时") + @ApiModelProperty(value = "总学时(必填,整数)") private Integer totalHours; @ApiModelProperty(value = "每次连上节数") @@ -33,13 +34,12 @@ public class CourseCreateValidate implements Serializable { @ApiModelProperty(value = "每周次数") private Integer sessionsPerWeek; - @ApiModelProperty(value = "设备要求") - private String equipmentRequirements; + @ApiModelProperty(value = "设备要求(多设备用逗号分隔)") + private List equipmentRequirements; @ApiModelProperty(value = "课程描述") private String description; @ApiModelProperty(value = "状态:1-启用,0-禁用") private Integer status; - } diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseSearchValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseSearchValidate.java index 03bf4b96..b67c5d8e 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseSearchValidate.java +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseSearchValidate.java @@ -17,8 +17,8 @@ public class CourseSearchValidate implements Serializable { @ApiModelProperty(value = "课程名称") private String courseName; - @ApiModelProperty(value = "课程类型:1-理论课,2-实验课,3-研讨课,4-体育课,5-实践课") - private Integer courseType; + @ApiModelProperty(value = "课程类型ID") + private Integer courseTypeId; @ApiModelProperty(value = "状态:1-启用,0-禁用") private Integer status; diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseTypeCreateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseTypeCreateValidate.java new file mode 100644 index 00000000..be7131bd --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseTypeCreateValidate.java @@ -0,0 +1,25 @@ +package com.mdd.admin.validate.course; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import javax.validation.constraints.*; + +@Data +@ApiModel("课程类型创建参数") +public class CourseTypeCreateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "typeName参数缺失") + @ApiModelProperty(value = "类型名称") + private String typeName; + + @ApiModelProperty(value = "类型描述") + private String description; + + @ApiModelProperty(value = "排序") + private Integer sortOrder; + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseTypeSearchValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseTypeSearchValidate.java new file mode 100644 index 00000000..fc672787 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseTypeSearchValidate.java @@ -0,0 +1,17 @@ +package com.mdd.admin.validate.course; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; + +@Data +@ApiModel("课程类型搜素参数") +public class CourseTypeSearchValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "类型名称") + private String typeName; + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseTypeUpdateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseTypeUpdateValidate.java new file mode 100644 index 00000000..f5ec0601 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseTypeUpdateValidate.java @@ -0,0 +1,34 @@ +package com.mdd.admin.validate.course; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import javax.validation.constraints.*; +import com.mdd.common.validator.annotation.IDMust; + +/** + * 课程类型参数 + * @author LikeAdmin + */ +@Data +@ApiModel("课程类型更新参数") +public class CourseTypeUpdateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @IDMust(message = "id参数必传且需大于0") + @ApiModelProperty(value = "") + private Integer id; + + @NotNull(message = "typeName参数缺失") + @ApiModelProperty(value = "类型名称") + private String typeName; + + @ApiModelProperty(value = "类型描述") + private String description; + + @ApiModelProperty(value = "排序") + private Integer sortOrder; + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseUpdateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseUpdateValidate.java index fefc5d0c..184fd1db 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseUpdateValidate.java +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/course/CourseUpdateValidate.java @@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; +import java.util.List; + import com.mdd.common.validator.annotation.IDMust; /** @@ -27,8 +29,8 @@ public class CourseUpdateValidate implements Serializable { @ApiModelProperty(value = "课程名称") private String courseName; - @ApiModelProperty(value = "课程类型:1-理论课,2-实验课,3-研讨课,4-体育课,5-实践课") - private Integer courseType; + @ApiModelProperty(value = "课程类型") + private Integer courseTypeId; @ApiModelProperty(value = "学分") private BigDecimal credits; @@ -43,7 +45,7 @@ public class CourseUpdateValidate implements Serializable { private Integer sessionsPerWeek; @ApiModelProperty(value = "设备要求") - private String equipmentRequirements; + private List equipmentRequirements; @ApiModelProperty(value = "课程描述") private String description; diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/equipmentRequirement/EquipmentRequirementCreateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/equipmentRequirement/EquipmentRequirementCreateValidate.java new file mode 100644 index 00000000..af43a721 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/equipmentRequirement/EquipmentRequirementCreateValidate.java @@ -0,0 +1,34 @@ +package com.mdd.admin.validate.equipmentRequirement; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import javax.validation.constraints.*; + +@Data +@ApiModel("设备要求创建参数") +public class EquipmentRequirementCreateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "equipmentName参数缺失") + @ApiModelProperty(value = "设备名称") + private String equipmentName; + + @NotNull(message = "equipmentCode参数缺失") + @ApiModelProperty(value = "设备编码") + private String equipmentCode; + + @NotNull(message = "equipmentType参数缺失") + @ApiModelProperty(value = "设备类型:1-基础设备,2-专业设备,3-特殊设备") + private Integer equipmentType; + + @ApiModelProperty(value = "设备描述") + private String description; + + @NotNull(message = "status参数缺失") + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/equipmentRequirement/EquipmentRequirementSearchValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/equipmentRequirement/EquipmentRequirementSearchValidate.java new file mode 100644 index 00000000..ed6f977a --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/equipmentRequirement/EquipmentRequirementSearchValidate.java @@ -0,0 +1,26 @@ +package com.mdd.admin.validate.equipmentRequirement; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; + +@Data +@ApiModel("设备要求搜素参数") +public class EquipmentRequirementSearchValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "设备名称") + private String equipmentName; + + @ApiModelProperty(value = "设备编码") + private String equipmentCode; + + @ApiModelProperty(value = "设备类型:1-基础设备,2-专业设备,3-特殊设备") + private Integer equipmentType; + + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/equipmentRequirement/EquipmentRequirementUpdateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/equipmentRequirement/EquipmentRequirementUpdateValidate.java new file mode 100644 index 00000000..8d67da59 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/equipmentRequirement/EquipmentRequirementUpdateValidate.java @@ -0,0 +1,44 @@ +package com.mdd.admin.validate.equipmentRequirement; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import javax.validation.constraints.*; + +import com.mdd.common.validator.annotation.IDMust; + +/** + * 设备要求参数 + * @author gyp + */ +@Data +@ApiModel("设备要求更新参数") +public class EquipmentRequirementUpdateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @IDMust(message = "id参数必传且需大于0") + @ApiModelProperty(value = "") + private Integer id; + + @NotNull(message = "equipmentName参数缺失") + @ApiModelProperty(value = "设备名称") + private String equipmentName; + + @NotNull(message = "equipmentCode参数缺失") + @ApiModelProperty(value = "设备编码") + private String equipmentCode; + + @NotNull(message = "equipmentType参数缺失") + @ApiModelProperty(value = "设备类型:1-基础设备,2-专业设备,3-特殊设备") + private Integer equipmentType; + + @ApiModelProperty(value = "设备描述") + private String description; + + @NotNull(message = "status参数缺失") + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/major/MajorCreateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/major/MajorCreateValidate.java index 5e7d59ff..d85881ab 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/validate/major/MajorCreateValidate.java +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/major/MajorCreateValidate.java @@ -3,6 +3,8 @@ package com.mdd.admin.validate.major; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; + +import javax.validation.constraints.NotNull; import java.io.Serializable; import java.math.BigDecimal; @@ -13,23 +15,28 @@ public class MajorCreateValidate implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "专业代码") + @NotNull(message = "专业代码不为空") private String majorCode; + @NotNull(message = "专业名称不为空") @ApiModelProperty(value = "专业名称") private String majorName; @ApiModelProperty(value = "专业英文名") private String majorEnglishName; + @NotNull(message = "所属学院不为空") @ApiModelProperty(value = "所属学院ID") private Integer collegeId; + @NotNull(message = "专业类型不为空") @ApiModelProperty(value = "专业类型: [1=本科, 2=硕士, 3=博士, 4=专科]") private Integer majorType; @ApiModelProperty(value = "学科门类") private String disciplineCategory; + @NotNull(message = "学年制不为空") @ApiModelProperty(value = "学制(年)") private Integer studyDuration; diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/student/StudentInfoSearchValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/student/StudentInfoSearchValidate.java deleted file mode 100644 index d4585552..00000000 --- a/server/like-admin/src/main/java/com/mdd/admin/validate/student/StudentInfoSearchValidate.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.mdd.admin.validate.student; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.models.auth.In; -import lombok.Data; -import java.io.Serializable; -import java.math.BigDecimal; - -@Data -@ApiModel("学生信息搜素参数") -public class StudentInfoSearchValidate implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(value = "关联用户ID") - private String userId; - - @ApiModelProperty(value = "姓名") - private String name; - - @ApiModelProperty(value = "性别") - private Integer gender; - - @ApiModelProperty(value = "学号") - private String studentNumber; - - @ApiModelProperty(value = "学院") - private String college; - - @ApiModelProperty(value = "专业") - private String major; - - @ApiModelProperty(value = "班级") - private String className; - - @ApiModelProperty(value = "年级") - private String grade; - - @ApiModelProperty(value = "入学年份") - private String enrollmentYear; - - @ApiModelProperty(value = "预计毕业年份") - private String expectedGraduationYear; - - @ApiModelProperty(value = "学生状态: [1=在读, 2=休学, 3=毕业, 4=退学]") - private String studentStatus; - - @ApiModelProperty(value = "身份证号") - private String idCard; - - @ApiModelProperty(value = "出生日期") - private String birthday; - - @ApiModelProperty(value = "政治面貌: [1=党员, 2=团员, 3=群众]") - private String politicalStatus; - - @ApiModelProperty(value = "籍贯") - private String nativePlace; - - @ApiModelProperty(value = "家庭住址") - private String homeAddress; - - @ApiModelProperty(value = "紧急联系人") - private String emergencyContact; - - @ApiModelProperty(value = "紧急联系电话") - private String emergencyPhone; - - @ApiModelProperty(value = "宿舍号") - private String dormitory; - - @ApiModelProperty(value = "辅导员用户ID") - private String counselorId; - - @ApiModelProperty(value = "总学分") - private BigDecimal totalCredits; - - @ApiModelProperty(value = "平均绩点") - private BigDecimal gpa; - - @ApiModelProperty(value = "奖学金等级: [0=无, 1=一等奖, 2=二等奖, 3=三等奖]") - private String scholarshipLevel; - - @ApiModelProperty(value = "学业预警: [0=无, 1=一级预警, 2=二级预警, 3=三级预警]") - private String academicWarnings; - - @ApiModelProperty(value = "是否认证: [0=未认证, 1=已认证]") - private String isVerified; - - @ApiModelProperty(value = "认证人ID") - private String verifiedBy; - - @ApiModelProperty(value = "认证时间") - private String verifiedTime; - -} diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/student/StudentInfoUpdateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/student/StudentInfoUpdateValidate.java deleted file mode 100644 index a966bd6b..00000000 --- a/server/like-admin/src/main/java/com/mdd/admin/validate/student/StudentInfoUpdateValidate.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.mdd.admin.validate.student; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import java.io.Serializable; -import javax.validation.constraints.*; -import java.math.BigDecimal; -import com.mdd.common.validator.annotation.IDMust; - -/** - * 学生信息参数 - * @author gyp - */ -@Data -@ApiModel("学生信息更新参数") -public class StudentInfoUpdateValidate implements Serializable { - - private static final long serialVersionUID = 1L; - - @IDMust(message = "id参数必传且需大于0") - @ApiModelProperty(value = "主键") - private Integer id; - - @NotNull(message = "userId参数缺失") - @ApiModelProperty(value = "关联用户ID") - private Integer userId; - - @ApiModelProperty(value = "学号") - private String studentNumber; - - @ApiModelProperty(value = "学院") - private String college; - - @ApiModelProperty(value = "专业") - private String major; - - @ApiModelProperty(value = "班级") - private String className; - - @ApiModelProperty(value = "年级") - private String grade; - - @ApiModelProperty(value = "入学年份") - private String enrollmentYear; - - @ApiModelProperty(value = "预计毕业年份") - private String expectedGraduationYear; - - @ApiModelProperty(value = "学生状态: [1=在读, 2=休学, 3=毕业, 4=退学]") - private String studentStatus; - - @ApiModelProperty(value = "身份证号") - private String idCard; - - @ApiModelProperty(value = "出生日期") - private String birthday; - - @ApiModelProperty(value = "政治面貌: [1=党员, 2=团员, 3=群众]") - private String politicalStatus; - - @ApiModelProperty(value = "籍贯") - private String nativePlace; - - @ApiModelProperty(value = "家庭住址") - private String homeAddress; - - @ApiModelProperty(value = "紧急联系人") - private String emergencyContact; - - @ApiModelProperty(value = "紧急联系电话") - private String emergencyPhone; - - @ApiModelProperty(value = "宿舍号") - private String dormitory; - - @ApiModelProperty(value = "辅导员用户ID") - private String counselorId; - - @ApiModelProperty(value = "总学分") - private BigDecimal totalCredits; - - @ApiModelProperty(value = "平均绩点") - private BigDecimal gpa; - - @ApiModelProperty(value = "奖学金等级: [0=无, 1=一等奖, 2=二等奖, 3=三等奖]") - private String scholarshipLevel; - - @ApiModelProperty(value = "学业预警: [0=无, 1=一级预警, 2=二级预警, 3=三级预警]") - private String academicWarnings; - - @ApiModelProperty(value = "是否认证: [0=未认证, 1=已认证]") - private String isVerified; - - @ApiModelProperty(value = "认证人ID") - private String verifiedBy; - - @ApiModelProperty(value = "认证时间") - private String verifiedTime; - -} diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomDetailVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomDetailVo.java new file mode 100644 index 00000000..142422e3 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomDetailVo.java @@ -0,0 +1,43 @@ +package com.mdd.admin.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("教室详情Vo") +public class ClassroomDetailVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "教室编号") + private String classroomCode; + + @ApiModelProperty(value = "教室名称") + private String classroomName; + + @ApiModelProperty(value = "教室类型ID") + private Integer classroomTypeId; + + @ApiModelProperty(value = "教室类型名称") + private String classroomTypeName; + + @ApiModelProperty(value = "教室容量(座位数)") + private Integer capacity; + + @ApiModelProperty(value = "教室位置") + private String location; + + @ApiModelProperty(value = "特殊要求说明") + private String specialRequirements; + + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomListedVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomListedVo.java new file mode 100644 index 00000000..8027a605 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomListedVo.java @@ -0,0 +1,49 @@ +package com.mdd.admin.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("教室列表Vo") +public class ClassroomListedVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "教室编号") + private String classroomCode; + + @ApiModelProperty(value = "教室名称") + private String classroomName; + + @ApiModelProperty(value = "教室类型ID") + private Integer classroomTypeId; + + @ApiModelProperty(value = "教师类型名称") + private String classroomTypeName; + + @ApiModelProperty(value = "教室容量(座位数)") + private Integer capacity; + + @ApiModelProperty(value = "教室位置") + private String location; + + @ApiModelProperty(value = "特殊要求说明") + private String specialRequirements; + + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "修改时间") + private String updateTime; + + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomTypeDetailVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomTypeDetailVo.java new file mode 100644 index 00000000..cb71c64c --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomTypeDetailVo.java @@ -0,0 +1,31 @@ +package com.mdd.admin.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("教室类型详情Vo") +public class ClassroomTypeDetailVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "类型名称(如:普通教室、实验室、多媒体教室、体育场等)") + private String typeName; + + @ApiModelProperty(value = "类型编码") + private String typeCode; + + @ApiModelProperty(value = "类型描述") + private String description; + + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomTypeListedVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomTypeListedVo.java new file mode 100644 index 00000000..d8153e8e --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/ClassroomTypeListedVo.java @@ -0,0 +1,37 @@ +package com.mdd.admin.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("教室类型列表Vo") +public class ClassroomTypeListedVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "类型名称(如:普通教室、实验室、多媒体教室、体育场等)") + private String typeName; + + @ApiModelProperty(value = "类型编码") + private String typeCode; + + @ApiModelProperty(value = "类型描述") + private String description; + + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "修改时间") + private String updateTime; + + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/EquipmentRequirementDetailVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/EquipmentRequirementDetailVo.java new file mode 100644 index 00000000..752613a4 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/EquipmentRequirementDetailVo.java @@ -0,0 +1,36 @@ +package com.mdd.admin.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.Date; + +@Data +@ApiModel("设备要求详情Vo") +public class EquipmentRequirementDetailVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "设备名称") + private String equipmentName; + + @ApiModelProperty(value = "设备编码") + private String equipmentCode; + + @ApiModelProperty(value = "设备类型:1-基础设备,2-专业设备,3-特殊设备") + private Integer equipmentType; + + @ApiModelProperty(value = "设备描述") + private String description; + + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/EquipmentRequirementListedVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/EquipmentRequirementListedVo.java new file mode 100644 index 00000000..3b29a168 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/EquipmentRequirementListedVo.java @@ -0,0 +1,42 @@ +package com.mdd.admin.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.Date; + +@Data +@ApiModel("设备要求列表Vo") +public class EquipmentRequirementListedVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "设备名称") + private String equipmentName; + + @ApiModelProperty(value = "设备编码") + private String equipmentCode; + + @ApiModelProperty(value = "设备类型:1-基础设备,2-专业设备,3-特殊设备") + private Integer equipmentType; + + @ApiModelProperty(value = "设备描述") + private String description; + + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + + @ApiModelProperty(value = "") + private String createTime; + + @ApiModelProperty(value = "") + private String updateTime; + + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/student/StudentInfoDetailVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/StudentInfoDetailVo.java similarity index 71% rename from server/like-admin/src/main/java/com/mdd/admin/vo/student/StudentInfoDetailVo.java rename to server/like-admin/src/main/java/com/mdd/admin/vo/StudentInfoDetailVo.java index 589c62da..fee7db11 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/vo/student/StudentInfoDetailVo.java +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/StudentInfoDetailVo.java @@ -1,4 +1,4 @@ -package com.mdd.admin.vo.student; +package com.mdd.admin.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -6,6 +6,7 @@ import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; +import java.math.BigDecimal; @Data @ApiModel("学生信息详情Vo") @@ -16,38 +17,38 @@ public class StudentInfoDetailVo implements Serializable { @ApiModelProperty(value = "主键") private Integer id; - @ApiModelProperty(value = "关联用户ID") - private Integer userId; - @ApiModelProperty(value = "姓名") private String name; - @ApiModelProperty(value = "性别") - private String gender; + @ApiModelProperty(value = "性别 1-男 2-女") + private Integer gender; + + @ApiModelProperty(value = "关联用户ID") + private Integer userId; @ApiModelProperty(value = "学号") private String studentNumber; - @ApiModelProperty(value = "学院") - private String college; + @ApiModelProperty(value = "学院ID") + private Integer collegeId; - @ApiModelProperty(value = "专业") - private String major; + @ApiModelProperty(value = "专业ID") + private Integer majorId; - @ApiModelProperty(value = "班级") - private String className; + @ApiModelProperty(value = "班级ID") + private Integer classId; @ApiModelProperty(value = "年级") - private String grade; + private Integer grade; @ApiModelProperty(value = "入学年份") - private String enrollmentYear; + private Integer enrollmentYear; @ApiModelProperty(value = "预计毕业年份") - private String expectedGraduationYear; + private Integer expectedGraduationYear; @ApiModelProperty(value = "学生状态: [1=在读, 2=休学, 3=毕业, 4=退学]") - private String studentStatus; + private Integer studentStatus; @ApiModelProperty(value = "身份证号") private String idCard; @@ -56,7 +57,7 @@ public class StudentInfoDetailVo implements Serializable { private String birthday; @ApiModelProperty(value = "政治面貌: [1=党员, 2=团员, 3=群众]") - private String politicalStatus; + private Integer politicalStatus; @ApiModelProperty(value = "籍贯") private String nativePlace; @@ -74,7 +75,7 @@ public class StudentInfoDetailVo implements Serializable { private String dormitory; @ApiModelProperty(value = "辅导员用户ID") - private String counselorId; + private Integer counselorId; @ApiModelProperty(value = "总学分") private BigDecimal totalCredits; @@ -82,20 +83,17 @@ public class StudentInfoDetailVo implements Serializable { @ApiModelProperty(value = "平均绩点") private BigDecimal gpa; - @ApiModelProperty(value = "奖学金等级: [0=无, 1=一等奖, 2=二等奖, 3=三等奖]") - private String scholarshipLevel; - @ApiModelProperty(value = "学业预警: [0=无, 1=一级预警, 2=二级预警, 3=三级预警]") - private String academicWarnings; + private Integer academicWarnings; @ApiModelProperty(value = "是否认证: [0=未认证, 1=已认证]") - private String isVerified; + private Integer isVerified; @ApiModelProperty(value = "认证人ID") - private String verifiedBy; + private Integer verifiedBy; @ApiModelProperty(value = "认证时间") - private String verifiedTime; + private Long verifiedTime; } diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/student/StudentInfoListedVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/StudentInfoListedVo.java similarity index 67% rename from server/like-admin/src/main/java/com/mdd/admin/vo/student/StudentInfoListedVo.java rename to server/like-admin/src/main/java/com/mdd/admin/vo/StudentInfoListedVo.java index 8ccae079..189522fb 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/vo/student/StudentInfoListedVo.java +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/StudentInfoListedVo.java @@ -1,4 +1,4 @@ -package com.mdd.admin.vo.student; +package com.mdd.admin.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -6,6 +6,7 @@ import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; +import java.math.BigDecimal; @Data @ApiModel("学生信息列表Vo") @@ -16,38 +17,44 @@ public class StudentInfoListedVo implements Serializable { @ApiModelProperty(value = "主键") private Integer id; - @ApiModelProperty(value = "关联用户ID") - private Integer userId; - @ApiModelProperty(value = "姓名") private String name; - @ApiModelProperty(value = "性别") - private String gender; + @ApiModelProperty(value = "性别 1-男 2-女") + private Integer gender; @ApiModelProperty(value = "学号") private String studentNumber; - @ApiModelProperty(value = "学院") - private String college; + @ApiModelProperty(value = "学院ID") + private Integer collegeId; - @ApiModelProperty(value = "专业") - private String major; + @ApiModelProperty(value = "学院名称") + private String collegeName; - @ApiModelProperty(value = "班级") + @ApiModelProperty(value = "专业ID") + private Integer majorId; + + @ApiModelProperty(value = "专业名称") + private String majorName; + + @ApiModelProperty(value = "班级ID") + private Integer classId; + + @ApiModelProperty(value = "班级名称") private String className; @ApiModelProperty(value = "年级") - private String grade; + private Integer grade; @ApiModelProperty(value = "入学年份") - private String enrollmentYear; + private Integer enrollmentYear; @ApiModelProperty(value = "预计毕业年份") - private String expectedGraduationYear; + private Integer expectedGraduationYear; @ApiModelProperty(value = "学生状态: [1=在读, 2=休学, 3=毕业, 4=退学]") - private String studentStatus; + private Integer studentStatus; @ApiModelProperty(value = "身份证号") private String idCard; @@ -56,7 +63,7 @@ public class StudentInfoListedVo implements Serializable { private String birthday; @ApiModelProperty(value = "政治面貌: [1=党员, 2=团员, 3=群众]") - private String politicalStatus; + private Integer politicalStatus; @ApiModelProperty(value = "籍贯") private String nativePlace; @@ -74,7 +81,10 @@ public class StudentInfoListedVo implements Serializable { private String dormitory; @ApiModelProperty(value = "辅导员用户ID") - private String counselorId; + private Integer counselorId; + + @ApiModelProperty(value = "辅导员姓名") + private String counselorName; @ApiModelProperty(value = "总学分") private BigDecimal totalCredits; @@ -82,17 +92,17 @@ public class StudentInfoListedVo implements Serializable { @ApiModelProperty(value = "平均绩点") private BigDecimal gpa; - @ApiModelProperty(value = "奖学金等级: [0=无, 1=一等奖, 2=二等奖, 3=三等奖]") - private String scholarshipLevel; - @ApiModelProperty(value = "学业预警: [0=无, 1=一级预警, 2=二级预警, 3=三级预警]") - private String academicWarnings; + private Integer academicWarnings; @ApiModelProperty(value = "是否认证: [0=未认证, 1=已认证]") - private String isVerified; + private Integer isVerified; @ApiModelProperty(value = "认证人ID") - private String verifiedBy; + private Integer verifierId; + + @ApiModelProperty(value = "认证人姓名") + private String verifierName; @ApiModelProperty(value = "认证时间") private String verifiedTime; diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/TimeSlotDetailVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/TimeSlotDetailVo.java new file mode 100644 index 00000000..f7f15ca0 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/TimeSlotDetailVo.java @@ -0,0 +1,44 @@ +package com.mdd.admin.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalTime; + +@Data +@ApiModel("时间段详情Vo") +public class TimeSlotDetailVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "时间段代码") + private String slotCode; + + @ApiModelProperty(value = "星期几:1-周一,2-周二,3-周三,4-周四,5-周五,6-周六,7-周日") + private Integer dayOfWeek; + + @ApiModelProperty(value = "开始时间") + private LocalTime startTime; + + @ApiModelProperty(value = "结束时间") + private LocalTime endTime; + + @ApiModelProperty(value = "时间段名称") + private String slotName; + + @ApiModelProperty(value = "时间段类型:1-上午,2-下午,3-晚上") + private Integer slotType; + + @ApiModelProperty(value = "排序") + private Integer slotOrder; + + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/TimeSlotListedVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/TimeSlotListedVo.java new file mode 100644 index 00000000..057a9734 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/TimeSlotListedVo.java @@ -0,0 +1,50 @@ +package com.mdd.admin.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalTime; + +@Data +@ApiModel("时间段列表Vo") +public class TimeSlotListedVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "时间段代码") + private String slotCode; + + @ApiModelProperty(value = "星期几:1-周一,2-周二,3-周三,4-周四,5-周五,6-周六,7-周日") + private Integer dayOfWeek; + + @ApiModelProperty(value = "开始时间") + private LocalTime startTime; + + @ApiModelProperty(value = "结束时间") + private LocalTime endTime; + + @ApiModelProperty(value = "时间段名称") + private String slotName; + + @ApiModelProperty(value = "节次:1-第一节,2-第二节,3-第三节") + private Integer section; + + @ApiModelProperty(value = "排序") + private Integer slotOrder; + + @ApiModelProperty(value = "是否参与排课:1-是,0-否") + private Integer isScheduled; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "更新时间") + private String updateTime; + + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseDetailVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseDetailVo.java index 0cdbaaea..6e43af6a 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseDetailVo.java +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseDetailVo.java @@ -22,8 +22,11 @@ public class CourseDetailVo implements Serializable { @ApiModelProperty(value = "课程名称") private String courseName; - @ApiModelProperty(value = "课程类型:1-理论课,2-实验课,3-研讨课,4-体育课,5-实践课") - private Integer courseType; + @ApiModelProperty(value = "课程类型ID") + private Integer courseTypeId; + + @ApiModelProperty(value = "课程类型名") + private String courseTypeName; @ApiModelProperty(value = "学分") private BigDecimal credits; diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseListedVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseListedVo.java index 69ac8e88..e49b59e4 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseListedVo.java +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseListedVo.java @@ -22,8 +22,11 @@ public class CourseListedVo implements Serializable { @ApiModelProperty(value = "课程名称") private String courseName; - @ApiModelProperty(value = "课程类型:1-理论课,2-实验课,3-研讨课,4-体育课,5-实践课") - private Integer courseType; + @ApiModelProperty(value = "课程类型ID") + private Integer courseTypeId; + + @ApiModelProperty(value = "课程类型名") + private String courseTypeName; @ApiModelProperty(value = "学分") private BigDecimal credits; diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseTypeDetailVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseTypeDetailVo.java new file mode 100644 index 00000000..17d58c3f --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseTypeDetailVo.java @@ -0,0 +1,28 @@ +package com.mdd.admin.vo.course; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("课程类型详情Vo") +public class CourseTypeDetailVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "类型名称") + private String typeName; + + @ApiModelProperty(value = "类型描述") + private String description; + + @ApiModelProperty(value = "排序") + private Integer sortOrder; + + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseTypeListedVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseTypeListedVo.java new file mode 100644 index 00000000..c6b469c9 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/course/CourseTypeListedVo.java @@ -0,0 +1,31 @@ +package com.mdd.admin.vo.course; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("课程类型列表Vo") +public class CourseTypeListedVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "类型名称") + private String typeName; + + @ApiModelProperty(value = "类型描述") + private String description; + + @ApiModelProperty(value = "排序") + private Integer sortOrder; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + +} diff --git a/server/like-common/src/main/java/com/mdd/common/entity/Classroom.java b/server/like-common/src/main/java/com/mdd/common/entity/Classroom.java new file mode 100644 index 00000000..cf54790f --- /dev/null +++ b/server/like-common/src/main/java/com/mdd/common/entity/Classroom.java @@ -0,0 +1,51 @@ +package com.mdd.common.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("教室实体") +public class Classroom implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value="id", type= IdType.AUTO) + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "教室编号") + private String classroomCode; + + @ApiModelProperty(value = "教室名称") + private String classroomName; + + @ApiModelProperty(value = "教室类型ID") + private Integer classroomTypeId; + + @ApiModelProperty(value = "教室容量(座位数)") + private Integer capacity; + + @ApiModelProperty(value = "教室位置") + private String location; + + @ApiModelProperty(value = "特殊要求说明") + private String specialRequirements; + + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + + @ApiModelProperty(value = "创建时间") + private Long createTime; + + @ApiModelProperty(value = "修改时间") + private Long updateTime; + + @ApiModelProperty(value = "删除时间") + private Long deleteTime; + +} \ No newline at end of file diff --git a/server/like-common/src/main/java/com/mdd/common/entity/ClassroomType.java b/server/like-common/src/main/java/com/mdd/common/entity/ClassroomType.java new file mode 100644 index 00000000..202c7cb5 --- /dev/null +++ b/server/like-common/src/main/java/com/mdd/common/entity/ClassroomType.java @@ -0,0 +1,42 @@ +package com.mdd.common.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("教室类型实体") +public class ClassroomType implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value="id", type= IdType.AUTO) + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "类型名称(如:普通教室、实验室、多媒体教室、体育场等)") + private String typeName; + + @ApiModelProperty(value = "类型编码") + private String typeCode; + + @ApiModelProperty(value = "类型描述") + private String description; + + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + + @ApiModelProperty(value = "创建时间") + private Long createTime; + + @ApiModelProperty(value = "修改时间") + private Long updateTime; + + @ApiModelProperty(value = "删除时间") + private Long deleteTime; + +} \ No newline at end of file diff --git a/server/like-common/src/main/java/com/mdd/common/entity/Course.java b/server/like-common/src/main/java/com/mdd/common/entity/Course.java index 526418fd..c0044fc5 100644 --- a/server/like-common/src/main/java/com/mdd/common/entity/Course.java +++ b/server/like-common/src/main/java/com/mdd/common/entity/Course.java @@ -25,8 +25,8 @@ public class Course implements Serializable { @ApiModelProperty(value = "课程名称") private String courseName; - @ApiModelProperty(value = "课程类型:1-理论课,2-实验课,3-研讨课,4-体育课,5-实践课") - private Integer courseType; + @ApiModelProperty(value = "课程类型ID") + private Integer courseTypeId; @ApiModelProperty(value = "学分") private BigDecimal credits; @@ -40,9 +40,6 @@ public class Course implements Serializable { @ApiModelProperty(value = "每周次数") private Integer sessionsPerWeek; - @ApiModelProperty(value = "设备要求") - private String equipmentRequirements; - @ApiModelProperty(value = "课程描述") private String description; diff --git a/server/like-common/src/main/java/com/mdd/common/entity/CourseEquipment.java b/server/like-common/src/main/java/com/mdd/common/entity/CourseEquipment.java new file mode 100644 index 00000000..e28fd6c2 --- /dev/null +++ b/server/like-common/src/main/java/com/mdd/common/entity/CourseEquipment.java @@ -0,0 +1,30 @@ +package com.mdd.common.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("课程设备关联实体") +public class CourseEquipment implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value="id", type= IdType.AUTO) + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "课程ID") + private Integer courseId; + + @ApiModelProperty(value = "设备要求ID") + private Integer equipmentRequirementId; + + @ApiModelProperty(value = "创建时间") + private Long createTime; + +} \ No newline at end of file diff --git a/server/like-common/src/main/java/com/mdd/common/entity/CourseType.java b/server/like-common/src/main/java/com/mdd/common/entity/CourseType.java new file mode 100644 index 00000000..5e8f3708 --- /dev/null +++ b/server/like-common/src/main/java/com/mdd/common/entity/CourseType.java @@ -0,0 +1,33 @@ +package com.mdd.common.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("课程类型实体") +public class CourseType implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value="id", type= IdType.AUTO) + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "类型名称") + private String typeName; + + @ApiModelProperty(value = "类型描述") + private String description; + + @ApiModelProperty(value = "排序") + private Integer sortOrder; + + @ApiModelProperty(value = "创建时间") + private Long createTime; + +} \ No newline at end of file diff --git a/server/like-common/src/main/java/com/mdd/common/entity/EquipmentRequirement.java b/server/like-common/src/main/java/com/mdd/common/entity/EquipmentRequirement.java new file mode 100644 index 00000000..e63c634a --- /dev/null +++ b/server/like-common/src/main/java/com/mdd/common/entity/EquipmentRequirement.java @@ -0,0 +1,44 @@ +package com.mdd.common.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.Date; + +@Data +@ApiModel("设备要求实体") +public class EquipmentRequirement implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value="id", type= IdType.AUTO) + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "设备名称") + private String equipmentName; + + @ApiModelProperty(value = "设备编码") + private String equipmentCode; + + @ApiModelProperty(value = "设备类型:1-基础设备,2-专业设备,3-特殊设备") + private Integer equipmentType; + + @ApiModelProperty(value = "设备描述") + private String description; + + @ApiModelProperty(value = "状态:1-启用,0-禁用") + private Integer status; + + @ApiModelProperty(value = "") + private Long createTime; + + @ApiModelProperty(value = "") + private Long updateTime; + +} \ No newline at end of file diff --git a/server/like-common/src/main/java/com/mdd/common/entity/Major.java b/server/like-common/src/main/java/com/mdd/common/entity/Major.java index 28aef7fa..33712465 100644 --- a/server/like-common/src/main/java/com/mdd/common/entity/Major.java +++ b/server/like-common/src/main/java/com/mdd/common/entity/Major.java @@ -61,7 +61,7 @@ public class Major implements Serializable { @ApiModelProperty(value = "招生状态: [1=正常招生, 2=暂停招生, 3=停止招生]") private Integer enrollmentStatus; - @ApiModelProperty(value = "专业状态: [1=正常, 2=停用]") + @ApiModelProperty(value = "专业状态: [1=正常, 0=停用]") private Integer majorStatus; @ApiModelProperty(value = "排序") diff --git a/server/like-common/src/main/java/com/mdd/common/entity/StudentInfo.java b/server/like-common/src/main/java/com/mdd/common/entity/StudentInfo.java index 9c15ad66..2563c223 100644 --- a/server/like-common/src/main/java/com/mdd/common/entity/StudentInfo.java +++ b/server/like-common/src/main/java/com/mdd/common/entity/StudentInfo.java @@ -23,7 +23,7 @@ public class StudentInfo implements Serializable { @ApiModelProperty(value = "姓名") private String name; - @ApiModelProperty(value = "性别") + @ApiModelProperty(value = "性别 1-男 2-女") private Integer gender; @ApiModelProperty(value = "关联用户ID") @@ -32,26 +32,26 @@ public class StudentInfo implements Serializable { @ApiModelProperty(value = "学号") private String studentNumber; - @ApiModelProperty(value = "学院") - private String college; + @ApiModelProperty(value = "学院ID") + private Integer collegeId; - @ApiModelProperty(value = "专业") - private String major; + @ApiModelProperty(value = "专业ID") + private Integer majorId; - @ApiModelProperty(value = "班级") - private String className; + @ApiModelProperty(value = "班级ID") + private Integer classId; @ApiModelProperty(value = "年级") - private String grade; + private Integer grade; @ApiModelProperty(value = "入学年份") - private String enrollmentYear; + private Integer enrollmentYear; @ApiModelProperty(value = "预计毕业年份") - private String expectedGraduationYear; + private Integer expectedGraduationYear; @ApiModelProperty(value = "学生状态: [1=在读, 2=休学, 3=毕业, 4=退学]") - private String studentStatus; + private Integer studentStatus; @ApiModelProperty(value = "身份证号") private String idCard; @@ -60,7 +60,7 @@ public class StudentInfo implements Serializable { private String birthday; @ApiModelProperty(value = "政治面貌: [1=党员, 2=团员, 3=群众]") - private String politicalStatus; + private Integer politicalStatus; @ApiModelProperty(value = "籍贯") private String nativePlace; @@ -78,7 +78,7 @@ public class StudentInfo implements Serializable { private String dormitory; @ApiModelProperty(value = "辅导员用户ID") - private String counselorId; + private Integer counselorId; @ApiModelProperty(value = "总学分") private BigDecimal totalCredits; @@ -86,20 +86,17 @@ public class StudentInfo implements Serializable { @ApiModelProperty(value = "平均绩点") private BigDecimal gpa; - @ApiModelProperty(value = "奖学金等级: [0=无, 1=一等奖, 2=二等奖, 3=三等奖]") - private String scholarshipLevel; - @ApiModelProperty(value = "学业预警: [0=无, 1=一级预警, 2=二级预警, 3=三级预警]") - private String academicWarnings; + private Integer academicWarnings; @ApiModelProperty(value = "是否认证: [0=未认证, 1=已认证]") - private String isVerified; + private Integer isVerified; @ApiModelProperty(value = "认证人ID") - private String verifiedBy; + private Integer verifiedBy; @ApiModelProperty(value = "认证时间") - private String verifiedTime; + private Long verifiedTime; @ApiModelProperty(value = "创建时间") private Long createTime; diff --git a/server/like-common/src/main/java/com/mdd/common/entity/TimeSlot.java b/server/like-common/src/main/java/com/mdd/common/entity/TimeSlot.java new file mode 100644 index 00000000..bf2348cc --- /dev/null +++ b/server/like-common/src/main/java/com/mdd/common/entity/TimeSlot.java @@ -0,0 +1,55 @@ +package com.mdd.common.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalTime; + +@Data +@ApiModel("时间段实体") +public class TimeSlot implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value="id", type= IdType.AUTO) + @ApiModelProperty(value = "") + private Integer id; + + @ApiModelProperty(value = "时间段代码") + private String slotCode; + + @ApiModelProperty(value = "星期几:1-周一,2-周二,3-周三,4-周四,5-周五,6-周六,7-周日") + private Integer dayOfWeek; + + @ApiModelProperty(value = "开始时间") + private LocalTime startTime; + + @ApiModelProperty(value = "结束时间") + private LocalTime endTime; + + @ApiModelProperty(value = "时间段名称") + private String slotName; + + @ApiModelProperty(value = "节次") + private Integer section; + + @ApiModelProperty(value = "排序") + private Integer slotOrder; + + @ApiModelProperty(value = "是否参与排课") + private Integer isScheduled; + + @ApiModelProperty(value = "创建时间") + private Long createTime; + + @ApiModelProperty(value = "更新时间") + private Long updateTime; + + @ApiModelProperty(value = "删除时间") + private Long deleteTime; + +} \ No newline at end of file diff --git a/server/like-common/src/main/java/com/mdd/common/enums/ErrorType.java b/server/like-common/src/main/java/com/mdd/common/enums/ErrorType.java new file mode 100644 index 00000000..54612d42 --- /dev/null +++ b/server/like-common/src/main/java/com/mdd/common/enums/ErrorType.java @@ -0,0 +1,13 @@ +package com.mdd.common.enums; + +/** + * EasyExcel监听器错误类型枚举 + */ +public enum ErrorType { + REQUIRED_FIELD, // 必填字段为空 + TYPE_CONVERSION, // 类型转换错误 + VALUE_RANGE, // 值范围错误 + LENGTH_EXCEEDED, // 长度超限 + BUSINESS_RULE, // 业务规则错误 + FORMAT_ERROR // 格式错误 +} \ No newline at end of file diff --git a/server/like-common/src/main/java/com/mdd/common/exception/OperateException.java b/server/like-common/src/main/java/com/mdd/common/exception/OperateException.java index f9489bcb..cc711d0c 100644 --- a/server/like-common/src/main/java/com/mdd/common/exception/OperateException.java +++ b/server/like-common/src/main/java/com/mdd/common/exception/OperateException.java @@ -18,4 +18,5 @@ public class OperateException extends BaseException { public OperateException(String msg, Integer errCode, Integer showCode) { super(errCode, msg, showCode); } + } diff --git a/server/like-common/src/main/java/com/mdd/common/mapper/ClassroomMapper.java b/server/like-common/src/main/java/com/mdd/common/mapper/ClassroomMapper.java new file mode 100644 index 00000000..d35118ed --- /dev/null +++ b/server/like-common/src/main/java/com/mdd/common/mapper/ClassroomMapper.java @@ -0,0 +1,13 @@ +package com.mdd.common.mapper; + +import com.mdd.common.core.basics.IBaseMapper; +import com.mdd.common.entity.Classroom; +import org.apache.ibatis.annotations.Mapper; + +/** + * 教室Mapper + * @author LikeAdmin + */ +@Mapper +public interface ClassroomMapper extends IBaseMapper { +} diff --git a/server/like-common/src/main/java/com/mdd/common/mapper/ClassroomTypeMapper.java b/server/like-common/src/main/java/com/mdd/common/mapper/ClassroomTypeMapper.java new file mode 100644 index 00000000..715145c1 --- /dev/null +++ b/server/like-common/src/main/java/com/mdd/common/mapper/ClassroomTypeMapper.java @@ -0,0 +1,13 @@ +package com.mdd.common.mapper; + +import com.mdd.common.core.basics.IBaseMapper; +import com.mdd.common.entity.ClassroomType; +import org.apache.ibatis.annotations.Mapper; + +/** + * 教室类型Mapper + * @author gyp + */ +@Mapper +public interface ClassroomTypeMapper extends IBaseMapper { +} diff --git a/server/like-common/src/main/java/com/mdd/common/mapper/CourseEquipmentMapper.java b/server/like-common/src/main/java/com/mdd/common/mapper/CourseEquipmentMapper.java new file mode 100644 index 00000000..4dffcc59 --- /dev/null +++ b/server/like-common/src/main/java/com/mdd/common/mapper/CourseEquipmentMapper.java @@ -0,0 +1,13 @@ +package com.mdd.common.mapper; + +import com.mdd.common.core.basics.IBaseMapper; +import com.mdd.common.entity.CourseEquipment; +import org.apache.ibatis.annotations.Mapper; + +/** + * 课程设备关联Mapper + * @author LikeAdmin + */ +@Mapper +public interface CourseEquipmentMapper extends IBaseMapper { +} diff --git a/server/like-common/src/main/java/com/mdd/common/mapper/CourseTypeMapper.java b/server/like-common/src/main/java/com/mdd/common/mapper/CourseTypeMapper.java new file mode 100644 index 00000000..eaf83e2a --- /dev/null +++ b/server/like-common/src/main/java/com/mdd/common/mapper/CourseTypeMapper.java @@ -0,0 +1,13 @@ +package com.mdd.common.mapper; + +import com.mdd.common.core.basics.IBaseMapper; +import com.mdd.common.entity.CourseType; +import org.apache.ibatis.annotations.Mapper; + +/** + * 课程类型Mapper + * @author LikeAdmin + */ +@Mapper +public interface CourseTypeMapper extends IBaseMapper { +} diff --git a/server/like-common/src/main/java/com/mdd/common/mapper/EquipmentRequirementMapper.java b/server/like-common/src/main/java/com/mdd/common/mapper/EquipmentRequirementMapper.java new file mode 100644 index 00000000..9210d3ad --- /dev/null +++ b/server/like-common/src/main/java/com/mdd/common/mapper/EquipmentRequirementMapper.java @@ -0,0 +1,13 @@ +package com.mdd.common.mapper; + +import com.mdd.common.core.basics.IBaseMapper; +import com.mdd.common.entity.EquipmentRequirement; +import org.apache.ibatis.annotations.Mapper; + +/** + * 设备要求Mapper + * @author gyp + */ +@Mapper +public interface EquipmentRequirementMapper extends IBaseMapper { +} diff --git a/server/like-common/src/main/java/com/mdd/common/mapper/TimeSlotMapper.java b/server/like-common/src/main/java/com/mdd/common/mapper/TimeSlotMapper.java new file mode 100644 index 00000000..2d2f59e3 --- /dev/null +++ b/server/like-common/src/main/java/com/mdd/common/mapper/TimeSlotMapper.java @@ -0,0 +1,13 @@ +package com.mdd.common.mapper; + +import com.mdd.common.core.basics.IBaseMapper; +import com.mdd.common.entity.TimeSlot; +import org.apache.ibatis.annotations.Mapper; + +/** + * 时间段Mapper + * @author gyp + */ +@Mapper +public interface TimeSlotMapper extends IBaseMapper { +} diff --git a/server/like-front/src/main/resources/application.yml b/server/like-front/src/main/resources/application.yml index b317c8a6..0220a6d7 100644 --- a/server/like-front/src/main/resources/application.yml +++ b/server/like-front/src/main/resources/application.yml @@ -1,7 +1,7 @@ # 项目配置 like: # 上传目录 - upload-directory: /www/uploads/likeadmin-java/ + upload-directory: D:/www/uploads/likeadmin-java/ # Swagger配置 swagger: # 是否开启swagger diff --git a/server/pom.xml b/server/pom.xml index 47ef643e..c2d73489 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -44,7 +44,7 @@ 6.1.2 1.32.0 1.32.0 - 3.1.3 + 3.3.4 2.3.2 7.17.0 diff --git a/sql/install.sql b/sql/install.sql index 9724350b..3df95a25 100644 --- a/sql/install.sql +++ b/sql/install.sql @@ -1219,19 +1219,19 @@ SET FOREIGN_KEY_CHECKS = 1; CREATE TABLE `la_student_info` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', - `name` varchar(50) NOT NULL DEFAULT '姓名错误' COMMENT '姓名', - `gender` tinyint unsigned NOT NULL DEFAULT '' COMMENT '性别 1-男 2-女', - `user_id` int unsigned NOT NULL DEFAULT '0' COMMENT '关联用户ID', - `student_number` varchar(32) NOT NULL DEFAULT '' COMMENT '学号', - `college` varchar(100) NOT NULL DEFAULT '' COMMENT '学院', - `major` varchar(100) NOT NULL DEFAULT '' COMMENT '专业', - `class_name` varchar(50) NOT NULL DEFAULT '' COMMENT '班级', - `grade` varchar(20) NOT NULL DEFAULT '' COMMENT '年级', + `name` varchar(50) DEFAULT NULL COMMENT '姓名', + `gender` tinyint unsigned DEFAULT NULL COMMENT '性别 1-男 2-女', + `user_id` int unsigned NOT NULL COMMENT '关联用户ID', + `student_number` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '学号', + `college_id` int unsigned NOT NULL COMMENT '学院ID', + `major_id` int unsigned NOT NULL COMMENT '专业ID', + `class_id` int unsigned NOT NULL COMMENT '班级ID', + `grade` tinyint unsigned NOT NULL COMMENT '年级', `enrollment_year` int unsigned NOT NULL DEFAULT '0' COMMENT '入学年份', `expected_graduation_year` int unsigned NOT NULL DEFAULT '0' COMMENT '预计毕业年份', `student_status` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '学生状态: [1=在读, 2=休学, 3=毕业, 4=退学]', `id_card` varchar(20) NOT NULL DEFAULT '' COMMENT '身份证号', - `birthday` int unsigned NOT NULL DEFAULT '0' COMMENT '出生日期', + `birthday` varchar(20) NOT NULL DEFAULT '0' COMMENT '出生日期', `political_status` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '政治面貌: [1=党员, 2=团员, 3=群众]', `native_place` varchar(100) NOT NULL DEFAULT '' COMMENT '籍贯', `home_address` varchar(200) NOT NULL DEFAULT '' COMMENT '家庭住址', @@ -1241,7 +1241,6 @@ CREATE TABLE `la_student_info` ( `counselor_id` int unsigned NOT NULL DEFAULT '0' COMMENT '辅导员用户ID', `total_credits` decimal(5,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '总学分', `gpa` decimal(3,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '平均绩点', - `scholarship_level` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '奖学金等级: [0=无, 1=一等奖, 2=二等奖, 3=三等奖]', `academic_warnings` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '学业预警: [0=无, 1=一级预警, 2=二级预警, 3=三级预警]', `is_verified` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否认证: [0=未认证, 1=已认证]', `verified_by` int unsigned NOT NULL DEFAULT '0' COMMENT '认证人ID', @@ -1253,10 +1252,10 @@ CREATE TABLE `la_student_info` ( UNIQUE KEY `student_number` (`student_number`) USING BTREE COMMENT '学号唯一', UNIQUE KEY `user_id` (`user_id`) USING BTREE COMMENT '用户ID唯一', UNIQUE KEY `id_card` (`id_card`) USING BTREE COMMENT '身份证号唯一', - KEY `college_major` (`college`,`major`) USING BTREE COMMENT '学院专业索引', - KEY `class_name` (`class_name`) USING BTREE COMMENT '班级索引', + KEY `college_major` (`college_id`,`major_id`) USING BTREE COMMENT '学院专业索引', + KEY `class_name` (`class_id`) USING BTREE COMMENT '班级索引', KEY `enrollment_year` (`enrollment_year`) USING BTREE COMMENT '入学年份索引' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='学生信息表'; +) ENGINE=InnoDB AUTO_INCREMENT=274 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='学生信息表'; CREATE TABLE `la_college` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', @@ -1367,12 +1366,11 @@ CREATE TABLE `la_course` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT, `course_code` varchar(50) NOT NULL DEFAULT '' COMMENT '课程代码', `course_name` varchar(100) NOT NULL DEFAULT '' COMMENT '课程名称', - `course_type` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '课程类型:1-理论课,2-实验课,3-研讨课,4-体育课,5-实践课', + `course_type_id` int unsigned NOT NULL COMMENT '课程类型ID', `credits` decimal(3,1) NOT NULL DEFAULT '0.0' COMMENT '学分', `total_hours` int unsigned NOT NULL DEFAULT '0' COMMENT '总学时', `duration_per_session` int unsigned NOT NULL DEFAULT '2' COMMENT '每次连上节数', `sessions_per_week` int unsigned NOT NULL DEFAULT '1' COMMENT '每周次数', - `equipment_requirements` json DEFAULT NULL COMMENT '设备要求', `description` text COMMENT '课程描述', `status` tinyint unsigned DEFAULT '1' COMMENT '状态:1-启用,0-禁用', `create_time` int NOT NULL COMMENT '创建时间', @@ -1380,10 +1378,26 @@ CREATE TABLE `la_course` ( `delete_time` int DEFAULT NULL COMMENT '删除时间', PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `uk_course_code` (`course_code`) USING BTREE, - KEY `idx_course_type` (`course_type`) USING BTREE, + KEY `idx_course_type` (`course_type_id`) USING BTREE, KEY `idx_status` (`status`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='课程表'; +CREATE TABLE `la_course_type` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `type_name` varchar(50) NOT NULL DEFAULT '' COMMENT '类型名称', + `description` varchar(200) DEFAULT '' COMMENT '类型描述', + `sort_order` int unsigned NOT NULL DEFAULT '0' COMMENT '排序', + `create_time` int NOT NULL COMMENT '创建时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='课程类型表'; + +ALTER TABLE `la_course` + ADD CONSTRAINT `fk_course_course_type` + FOREIGN KEY (`course_type_id`) + REFERENCES `la_course_type` (`id`) + ON DELETE RESTRICT + ON UPDATE CASCADE; + CREATE TABLE `la_curriculum_version` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `major_id` int unsigned NOT NULL COMMENT '专业ID', @@ -1399,6 +1413,7 @@ CREATE TABLE `la_curriculum_version` ( KEY `idx_current` (`is_current`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='培养方案版本表'; + CREATE TABLE `la_time_slot` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `slot_code` varchar(50) NOT NULL DEFAULT '' COMMENT '时间段代码', @@ -1406,18 +1421,17 @@ CREATE TABLE `la_time_slot` ( `start_time` time NOT NULL COMMENT '开始时间', `end_time` time NOT NULL COMMENT '结束时间', `slot_name` varchar(50) NOT NULL DEFAULT '' COMMENT '时间段名称', - `slot_type` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '时间段类型:1-上午,2-下午,3-晚上', + `section` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '节次', `slot_order` int unsigned NOT NULL DEFAULT '0' COMMENT '排序', - `status` tinyint unsigned DEFAULT '1' COMMENT '状态:1-启用,0-禁用', + `is_scheduled` tinyint unsigned DEFAULT '1' COMMENT '是否参与排课:0-不参与,1-参与', `create_time` int NOT NULL COMMENT '创建时间', `update_time` int DEFAULT NULL COMMENT '更新时间', `delete_time` int DEFAULT NULL COMMENT '删除时间', PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `uk_slot_code` (`slot_code`) USING BTREE, - UNIQUE KEY `uk_day_time` (`day_of_week`, `start_time`, `end_time`) USING BTREE, - KEY `idx_day_order` (`day_of_week`, `slot_order`) USING BTREE, - KEY `idx_slot_type` (`slot_type`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='时间段表'; + KEY `idx_day_order` (`day_of_week`,`slot_order`) USING BTREE, + KEY `idx_slot_type` (`section`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=257 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='时间段表'; CREATE TABLE `la_semester_config` ( `id` int unsigned NOT NULL AUTO_INCREMENT, @@ -1488,4 +1502,76 @@ CREATE TABLE `la_teacher_unavailable` ( UNIQUE KEY `uk_teacher_time` (`teacher_id`,`time_slot_id`,`semester_id`) USING BTREE, KEY `idx_time_slot` (`time_slot_id`) USING BTREE, KEY `idx_semester` (`semester_id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='教师不可用时间表'; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='教师不可用时间表'; + +CREATE TABLE `la_equipment_requirement` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `equipment_name` varchar(100) NOT NULL COMMENT '设备名称', + `equipment_code` varchar(50) NOT NULL COMMENT '设备编码', + `equipment_type` tinyint(1) NOT NULL COMMENT '设备类型:1-基础设备,2-专业设备,3-特殊设备', + `description` text COMMENT '设备描述', + `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:1-启用,0-禁用', + `create_time` int DEFAULT CURRENT_TIMESTAMP, + `update_time` int DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_equipment_code` (`equipment_code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='设备要求表'; + +CREATE TABLE `la_course_equipment` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `course_id` bigint unsigned NOT NULL COMMENT '课程ID', + `equipment_requirement_id` bigint unsigned NOT NULL COMMENT '设备要求ID', + `create_time` int NOT NULL COMMENT '创建时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `uk_course_equipment` (`course_id`, `equipment_requirement_id`) USING BTREE, + KEY `idx_equipment_id` (`equipment_requirement_id`) USING BTREE, + CONSTRAINT `fk_course_equipment_course` FOREIGN KEY (`course_id`) REFERENCES `la_course` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_course_equipment_equipment` FOREIGN KEY (`equipment_requirement_id`) REFERENCES `la_equipment_requirement` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='课程设备关联表'; + +CREATE TABLE `la_classroom_type` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `type_name` varchar(50) NOT NULL DEFAULT '' COMMENT '类型名称(如:普通教室、实验室、多媒体教室、体育场等)', + `type_code` varchar(50) NOT NULL DEFAULT '' COMMENT '类型编码', + `description` text COMMENT '类型描述', + `status` tinyint unsigned DEFAULT '1' COMMENT '状态:1-启用,0-禁用', + `create_time` int NOT NULL COMMENT '创建时间', + `update_time` int DEFAULT NULL COMMENT '修改时间', + `delete_time` int DEFAULT NULL COMMENT '删除时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `uk_type_code` (`type_code`) USING BTREE, + KEY `idx_status` (`status`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='教室类型表'; + +CREATE TABLE `la_classroom` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `classroom_code` varchar(50) NOT NULL DEFAULT '' COMMENT '教室编号', + `classroom_name` varchar(100) NOT NULL DEFAULT '' COMMENT '教室名称', + `classroom_type_id` bigint unsigned NOT NULL COMMENT '教室类型ID', + `capacity` int unsigned NOT NULL DEFAULT '0' COMMENT '教室容量(座位数)', + `location` varchar(200) NOT NULL DEFAULT '' COMMENT '教室位置', + `special_requirements` text COMMENT '特殊要求说明', + `status` tinyint unsigned DEFAULT '1' COMMENT '状态:1-启用,0-禁用', + `create_time` int NOT NULL COMMENT '创建时间', + `update_time` int DEFAULT NULL COMMENT '修改时间', + `delete_time` int DEFAULT NULL COMMENT '删除时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `uk_classroom_code` (`classroom_code`) USING BTREE, + KEY `idx_classroom_type_id` (`classroom_type_id`) USING BTREE, + KEY `idx_location` (`location`(50)) USING BTREE, + KEY `idx_status` (`status`) USING BTREE, + CONSTRAINT `fk_classroom_type` FOREIGN KEY (`classroom_type_id`) REFERENCES `la_classroom_type` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='教室表'; + +CREATE TABLE `la_classroom_equipment` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `classroom_id` bigint unsigned NOT NULL COMMENT '教室ID', + `equipment_requirement_id` bigint unsigned NOT NULL COMMENT '设备要求ID', + `create_time` int NOT NULL COMMENT '创建时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `uk_classroom_equipment` (`classroom_id`, `equipment_requirement_id`) USING BTREE, + KEY `idx_equipment_id` (`equipment_requirement_id`) USING BTREE, + CONSTRAINT `fk_classroom_equipment_classroom` FOREIGN KEY (`classroom_id`) REFERENCES `la_classroom` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_classroom_equipment_equipment` FOREIGN KEY (`equipment_requirement_id`) REFERENCES `la_equipment_requirement` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='教室设备关系表'; +