diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitCompetitionStudentInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitCompetitionStudentInfoController.java index 44c0cda..cf6ae80 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitCompetitionStudentInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitCompetitionStudentInfoController.java @@ -107,6 +107,15 @@ public class HitCompetitionStudentInfoController extends BaseController { public AjaxResult getStudentInfoByStuId(@PathVariable("studentId") String studentId){ return success(hitCompetitionStudentInfoService.selectHitCompetitionStudentInfoByStuId(studentId)); } + + /** + * 获取当前用户信息 + * @return + */ + @GetMapping("/getStudentInfo") + public AjaxResult getStudentInfo(){ + return success(hitCompetitionStudentInfoService.getStudentInfo()); + } /** * 根据学校及赛区查询队友信息 * @param schoolName division diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitRegistrationTeachInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitRegistrationTeachInfoController.java index 105e2a7..be70dcd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitRegistrationTeachInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitRegistrationTeachInfoController.java @@ -31,11 +31,12 @@ public class HitRegistrationTeachInfoController extends BaseController /** * 查询教师信息列表 */ - @PreAuthorize("@ss.hasPermi('HitRegistrationTeachInfo:HitRegistrationTeachInfo:list')") + @GetMapping("/list") public TableDataInfo list(HitRegistrationTeachInfo hitRegistrationTeachInfo) { startPage(); + List list = hitRegistrationTeachInfoService.selectHitRegistrationTeachInfoList(hitRegistrationTeachInfo); return getDataTable(list); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/HitCompetitionStudentInfo.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/HitCompetitionStudentInfo.java index ae4f1bd..3f3d629 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/HitCompetitionStudentInfo.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/HitCompetitionStudentInfo.java @@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import java.io.Serializable; import java.util.Date; +import com.ruoyi.common.core.domain.HitRegistrationTeachInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -61,6 +62,10 @@ public class HitCompetitionStudentInfo implements Serializable { @ApiModelProperty(value = "所属赛区") private String division; + + @TableField(exist = false) + private String divisionLabel; + @ApiModelProperty(value = "手机号") private String phoneNumber; @@ -97,6 +102,7 @@ public class HitCompetitionStudentInfo implements Serializable { private String updateBy; @TableField(exist = false) private String year; - + @TableField(exist = false) + private HitRegistrationTeachInfo ldTeacherInfo; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/IHitCompetitionStudentInfoService.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/IHitCompetitionStudentInfoService.java index b8f1d54..24c1808 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/IHitCompetitionStudentInfoService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/IHitCompetitionStudentInfoService.java @@ -70,6 +70,7 @@ public interface IHitCompetitionStudentInfoService extends IService queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(HitCompetitionStudentInfo::getStudentId, studentId); HitCompetitionStudentInfo hitCompetitionStudentInfo = hitCompetitionStudentInfoMapper.selectOne(queryWrapper); - if (hitCompetitionStudentInfo == null) { + String com_region = sysDictDataService.selectDictLabel("com_region", hitCompetitionStudentInfo.getDivision()); + hitCompetitionStudentInfo.setDivisionLabel(com_region); + if (ObjectUtils.isEmpty(hitCompetitionStudentInfo) ) { return new HitCompetitionStudentInfo(); } + return hitCompetitionStudentInfo; } + @Override + public HitCompetitionStudentInfo getStudentInfo() { + Calendar calendar = Calendar.getInstance(); + int year = calendar.get(Calendar.YEAR); + //获取当前用户信息信息 + SysUser user = SecurityUtils.getLoginUser().getUser(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(HitCompetitionStudentInfo::getUserId, user.getUserId()); + queryWrapper.likeRight(HitCompetitionStudentInfo::getCreateTime, year); + HitCompetitionStudentInfo hitCompetitionStudentInfo = hitCompetitionStudentInfoMapper.selectOne(queryWrapper); + String com_region = sysDictDataService.selectDictLabel("com_region", hitCompetitionStudentInfo.getDivision()); + hitCompetitionStudentInfo.setDivisionLabel(com_region); + if (ObjectUtils.isEmpty(hitCompetitionStudentInfo) ) { + return new HitCompetitionStudentInfo(); + } + //根据学校查询领队老师 + LambdaQueryWrapper queryWrapper1 =new LambdaQueryWrapper<>(); + queryWrapper1.eq(HitRegistrationTeachInfo::getSchoolName,hitCompetitionStudentInfo.getSchoolName()) + .likeRight(HitRegistrationTeachInfo::getCreateTime, year).eq(HitRegistrationTeachInfo::getType,1).eq(HitRegistrationTeachInfo::getStatus,1); + HitRegistrationTeachInfo hitRegistrationTeachInfo = hitRegistrationTeachInfoMapper.selectOne(queryWrapper1); + hitCompetitionStudentInfo.setLdTeacherInfo(hitRegistrationTeachInfo); + return hitCompetitionStudentInfo; + + } + @Override public List selectTeamMateBySchoolNameAndDivision(String schoolName, String division) { //获取当前学生信息信息 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitRegistrationTeachInfoServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitRegistrationTeachInfoServiceImpl.java index a542d8e..b1c91c7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitRegistrationTeachInfoServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitRegistrationTeachInfoServiceImpl.java @@ -1,5 +1,7 @@ package com.ruoyi.cms.service.impl; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -65,6 +67,11 @@ public class HitRegistrationTeachInfoServiceImpl implements IHitRegistrationTeac */ @Override public List selectHitRegistrationTeachInfoList(HitRegistrationTeachInfo hitRegistrationTeachInfo) { + + //获取当前年份 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy"); + String currentYear = LocalDate.now().format(formatter); + hitRegistrationTeachInfo.setYear(currentYear); return hitRegistrationTeachInfoMapper.selectHitRegistrationTeachInfoList(hitRegistrationTeachInfo); } diff --git a/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationTeachInfoMapper.xml b/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationTeachInfoMapper.xml index 13c278e..e910446 100644 --- a/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationTeachInfoMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationTeachInfoMapper.xml @@ -32,7 +32,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"