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 62fa4f5..378d707 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 @@ -2,6 +2,7 @@ package com.ruoyi.cms.controller; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.cms.domain.vo.HitCompetitionStudentInfoImportVo; import com.ruoyi.common.annotation.Log; @@ -58,8 +59,7 @@ public class HitCompetitionStudentInfoController extends BaseController { */ @GetMapping("/list") - public TableDataInfo list(HitCompetitionStudentInfo hitCompetitionStudentInfo) - { + public TableDataInfo list(HitCompetitionStudentInfo hitCompetitionStudentInfo) { startPage(); List<HitCompetitionStudentInfo> list = hitCompetitionStudentInfoService.selectHitCompetitionStudentInfoList(hitCompetitionStudentInfo); return getDataTable(list); @@ -71,8 +71,7 @@ public class HitCompetitionStudentInfoController extends BaseController { @Log(title = "大赛学生", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, HitCompetitionStudentInfo hitCompetitionStudentInfo) - { + public void export(HttpServletResponse response, HitCompetitionStudentInfo hitCompetitionStudentInfo) { List<HitCompetitionStudentInfo> list = hitCompetitionStudentInfoService.selectHitCompetitionStudentInfoListExport(hitCompetitionStudentInfo); ExcelUtil<HitCompetitionStudentInfo> util = new ExcelUtil<HitCompetitionStudentInfo>(HitCompetitionStudentInfo.class); util.exportExcel(response, list, "大赛学生数据"); @@ -82,8 +81,7 @@ public class HitCompetitionStudentInfoController extends BaseController { * 获取大赛学生详细信息 */ @GetMapping(value = "/byId/{id}") - public AjaxResult getInfo(@PathVariable("id") String id) - { + public AjaxResult getInfo(@PathVariable("id") String id) { return success(hitCompetitionStudentInfoService.selectHitCompetitionStudentInfoById(id)); } @@ -93,8 +91,7 @@ public class HitCompetitionStudentInfoController extends BaseController { @Log(title = "大赛学生", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody HitCompetitionStudentInfo hitCompetitionStudentInfo) - { + public AjaxResult add(@RequestBody HitCompetitionStudentInfo hitCompetitionStudentInfo) { return toAjax(hitCompetitionStudentInfoService.insertHitCompetitionStudentInfo(hitCompetitionStudentInfo)); } @@ -104,18 +101,17 @@ public class HitCompetitionStudentInfoController extends BaseController { @Log(title = "大赛学生", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody HitCompetitionStudentInfo hitCompetitionStudentInfo) - { + public AjaxResult edit(@RequestBody HitCompetitionStudentInfo hitCompetitionStudentInfo) { return toAjax(hitCompetitionStudentInfoService.updateHitCompetitionStudentInfo(hitCompetitionStudentInfo)); } + /** * 修改大赛学生编辑 */ @Log(title = "大赛学生", businessType = BusinessType.UPDATE) @PutMapping("editInfo") - public AjaxResult editInfo(@RequestBody HitCompetitionStudentInfo hitCompetitionStudentInfo) - { + public AjaxResult editInfo(@RequestBody HitCompetitionStudentInfo hitCompetitionStudentInfo) { return toAjax(hitCompetitionStudentInfoService.updateHitCompetitionStudentInfoUpdate(hitCompetitionStudentInfo)); } @@ -125,60 +121,65 @@ public class HitCompetitionStudentInfoController extends BaseController { @Log(title = "大赛学生", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable String[] ids) - { + public AjaxResult remove(@PathVariable String[] ids) { return toAjax(hitCompetitionStudentInfoService.deleteHitCompetitionStudentInfoByIds(ids)); } + /** * 根据学号查询学生信息 + * * @param studentId * @return */ @GetMapping("/{studentId}") - public AjaxResult getStudentInfoByStuId(@PathVariable("studentId") String studentId){ + public AjaxResult getStudentInfoByStuId(@PathVariable("studentId") String studentId) { return success(hitCompetitionStudentInfoService.selectHitCompetitionStudentInfoByStuId(studentId)); } /** * 获取当前用户信息 + * * @return */ @GetMapping("/getStudentInfo") - public AjaxResult getStudentInfo(){ + public AjaxResult getStudentInfo() { return success(hitCompetitionStudentInfoService.getStudentInfo()); } + /** * 根据学校及赛区查询队友信息 + * * @param schoolName division */ - @GetMapping( "/getTeamMateInfo") - public AjaxResult getTeamMateBySchoolNameAndDivision(@RequestParam String schoolName,@RequestParam String division) { + @GetMapping("/getTeamMateInfo") + public AjaxResult getTeamMateBySchoolNameAndDivision(@RequestParam String schoolName, @RequestParam String division) { return success(hitCompetitionStudentInfoService.selectTeamMateBySchoolNameAndDivision(schoolName, division)); } /** * 查询当前用户是否有队伍 + * * @return teamId * @return teamName * @return teamMateId */ @GetMapping("/getTeam") - public AjaxResult getTeamMateInfoByStuId(){ + public AjaxResult getTeamMateInfoByStuId() { return AjaxResult.success(hitCompetitionStudentInfoService.selectTeamMateInfoByStuId()); } @Log(title = "修改个人赛时间", businessType = BusinessType.UPDATE) @PutMapping("/updateTime") - public AjaxResult updateTime(@RequestBody LocalDateTime time) { - System.out.println("接收到的时间"+time); + public AjaxResult updateTime(@RequestBody LocalDateTime time) { + System.out.println("接收到的时间" + time); SysJob job = new SysJob(); job.setInvokeTarget("hitTask.scheduleTask"); //将time转化为cron表达式,包含年 job.setRemark("修改个人赛时间"); job.setStatus("0"); job.setJobId(4L); - job.setCronExpression("0 "+time.getSecond()+" "+time.getMinute()+" "+time.getHour()+" * * ?"); + job.setCronExpression("0 " + time.getSecond() + " " + time.getMinute() + " " + time.getHour() + " * * ?"); try { sysJobController.edit(job); } catch (SchedulerException e) { @@ -191,18 +192,17 @@ public class HitCompetitionStudentInfoController extends BaseController { /** * 导入个人分数数据模板 + * * @param response */ @PostMapping("/importTemplate") - public void importTemplate(HttpServletResponse response) - { + public void importTemplate(HttpServletResponse response) { ExcelUtil<HitCompetitionStudentInfoImportVo> util = new ExcelUtil<>(HitCompetitionStudentInfoImportVo.class); util.importTemplateExcel(response, "用户数据"); } @PostMapping("/importData") - public AjaxResult importData(MultipartFile file) throws Exception - { + public AjaxResult importData(MultipartFile file) throws Exception { ExcelUtil<HitCompetitionStudentInfoImportVo> util = new ExcelUtil<>(HitCompetitionStudentInfoImportVo.class); List<HitCompetitionStudentInfoImportVo> hitList = util.importExcel(file.getInputStream()); String message = hitCompetitionStudentInfoService.importData(hitList); @@ -210,9 +210,8 @@ public class HitCompetitionStudentInfoController extends BaseController { } @PostMapping("/uploadDsFile") - public AjaxResult importDsFile(@RequestParam("file")MultipartFile file,String phoneNumber){ - try - { + public AjaxResult importDsFile(@RequestParam("file") MultipartFile file, String phoneNumber) { + try { // 上传文件路径 String filePath = RuoYiConfig.getUploadPath(); // 上传并返回新文件名称 @@ -231,10 +230,23 @@ public class HitCompetitionStudentInfoController extends BaseController { } return success("上传失败"); - } - catch (Exception e) - { + } catch (Exception e) { return AjaxResult.error(e.getMessage()); } } + + /** + * 查询大赛学生信息 + * + * @param info 请求参数 + * @return + */ + @GetMapping("/queryStudentInfo") + public AjaxResult queryStudentInfo(HitCompetitionStudentInfo info) { + info.setUserId(getUserId()); + if (ObjectUtil.isEmpty(info.getYear())) { + info.setYear(DateUtil.format(DateUtil.date(), "yyyy")); + } + return success(hitCompetitionStudentInfoService.selectHitCompetitionStudentInfo(info)); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/HitRegInfo.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/HitRegInfo.java index 88c1741..d337dd0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/HitRegInfo.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/HitRegInfo.java @@ -89,6 +89,8 @@ public class HitRegInfo extends BaseEntity private HitRegistrationTeachInfo ldTeacher; @TableField(exist = false) private List<HitCompetitionStudentInfo> studentUserss =new ArrayList<>(); + @TableField(exist = false) + private String year; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/mapper/HitCompetitionStudentInfoMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/mapper/HitCompetitionStudentInfoMapper.java index 9f03eec..3fa36df 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/mapper/HitCompetitionStudentInfoMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/mapper/HitCompetitionStudentInfoMapper.java @@ -3,6 +3,7 @@ package com.ruoyi.cms.mapper; import com.ruoyi.cms.domain.HitCompetitionStudentInfo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.common.core.domain.HitRegistrationTeachInfo; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -24,7 +25,7 @@ public interface HitCompetitionStudentInfoMapper extends BaseMapper<HitCompetiti public HitCompetitionStudentInfo selectHitCompetitionStudentInfoById(String id); - public HitCompetitionStudentInfo selectHitCompetitionStudentInfoByUserId(Long userId); + public HitCompetitionStudentInfo selectHitCompetitionStudentInfoByUserId(@Param("userId") Long userId, @Param("year") String year); /** * 查询大赛学生列表 @@ -68,6 +69,7 @@ public interface HitCompetitionStudentInfoMapper extends BaseMapper<HitCompetiti /** * 将学校不足15名的参赛人员全部设置为可以参加地区选拔 + * * @return */ public int updateStudentByLessThan(); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/mapper/HitRegistrationTeachInfoMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/mapper/HitRegistrationTeachInfoMapper.java index 5156dc8..9a6826f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/mapper/HitRegistrationTeachInfoMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/mapper/HitRegistrationTeachInfoMapper.java @@ -29,7 +29,7 @@ public interface HitRegistrationTeachInfoMapper extends BaseMapper<HitRegistrat * @param id 教师信息主键 * @return 教师信息 */ - public HitRegistrationTeachInfo selectHitRegistrationTeachInfoByUserId(Long userId); + public HitRegistrationTeachInfo selectHitRegistrationTeachInfoByUserId(@Param("userId") Long userId,@Param("year") String year); /** * 查询教师信息列表 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 c500897..933f2aa 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 @@ -32,6 +32,7 @@ public interface IHitCompetitionStudentInfoService extends IService<HitCompetiti * @return 大赛学生集合 */ public List<HitCompetitionStudentInfo> selectHitCompetitionStudentInfoList(HitCompetitionStudentInfo hitCompetitionStudentInfo); + /** * 导出查询大赛学生列表 * @@ -55,6 +56,7 @@ public interface IHitCompetitionStudentInfoService extends IService<HitCompetiti * @return 结果 */ public int updateHitCompetitionStudentInfo(HitCompetitionStudentInfo hitCompetitionStudentInfo); + /** * 修改大赛学生 * @@ -81,14 +83,17 @@ public interface IHitCompetitionStudentInfoService extends IService<HitCompetiti /** * 根据学号查询大赛学生信息 + * * @param studentId * @return */ HitCompetitionStudentInfo selectHitCompetitionStudentInfoByStuId(String studentId); + HitCompetitionStudentInfo getStudentInfo(); /** * 根据学校名称和组别查询队友信息 + * * @param schoolName * @param division * @return @@ -97,14 +102,24 @@ public interface IHitCompetitionStudentInfoService extends IService<HitCompetiti /** * 根据学号查询队友信息 + * * @return */ TeamsVo selectTeamMateInfoByStuId(); /** * 导入数据 + * * @param hitList * @return */ String importData(List<HitCompetitionStudentInfoImportVo> hitList); + + /** + * 查询学生大赛报名信息 + * + * @param info 请求参数 + * @return + */ + HitCompetitionStudentInfo selectHitCompetitionStudentInfo(HitCompetitionStudentInfo info); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/CmsCategoryServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/CmsCategoryServiceImpl.java index 0556b86..c4ad94c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/CmsCategoryServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/CmsCategoryServiceImpl.java @@ -215,7 +215,6 @@ public class CmsCategoryServiceImpl extends ServiceImpl<CmsCategoryMapper, CmsCa /** * 获取栏目下的子栏目及文章 - * */ @Override public List<CMSCategoryVo> selectCmsCategoryAndContentTreeList(CmsCategoryQuery categoryQuery) { @@ -287,7 +286,7 @@ public class CmsCategoryServiceImpl extends ServiceImpl<CmsCategoryMapper, CmsCa * 按ID查询所有文章 */ @Override - public List<CmsContent> getLeavesContentList(Long id){ + public List<CmsContent> getLeavesContentList(Long id) { return contentMapper.selectList(new QueryWrapper<CmsContent>().and(item -> { item.eq("category_id", id) .eq("del_flag", 0); @@ -298,7 +297,7 @@ public class CmsCategoryServiceImpl extends ServiceImpl<CmsCategoryMapper, CmsCa * 获取某个栏目的子栏目 */ @Override - public List<CmsCategory> getCategoryIdByParentId(Long id){ - return baseMapper.selectList(new QueryWrapper<CmsCategory>().eq("parent_id", id).orderByAsc("category_sort")); + public List<CmsCategory> getCategoryIdByParentId(Long id) { + return baseMapper.selectList(new QueryWrapper<CmsCategory>().eq("parent_id", id).eq("is_disable", 0).eq("del_flag", 0).orderByAsc("category_sort")); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitCompetitionStudentInfoServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitCompetitionStudentInfoServiceImpl.java index 7076b40..1d6b684 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitCompetitionStudentInfoServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitCompetitionStudentInfoServiceImpl.java @@ -66,8 +66,6 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti private static final Logger log = LoggerFactory.getLogger(HitCompetitionStudentInfoServiceImpl.class); - - /** * 查询大赛学生 * @@ -75,8 +73,7 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti * @return 大赛学生 */ @Override - public HitCompetitionStudentInfo selectHitCompetitionStudentInfoById(String id) - { + public HitCompetitionStudentInfo selectHitCompetitionStudentInfoById(String id) { return hitCompetitionStudentInfoMapper.selectHitCompetitionStudentInfoById(id); } @@ -87,20 +84,22 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti * @return 大赛学生 */ @Override - public List<HitCompetitionStudentInfo> selectHitCompetitionStudentInfoList(HitCompetitionStudentInfo hitCompetitionStudentInfo) - { - Calendar calendar = Calendar.getInstance(); - int year = calendar.get(Calendar.YEAR); - hitCompetitionStudentInfo.setYear(String.valueOf(year)); + public List<HitCompetitionStudentInfo> selectHitCompetitionStudentInfoList(HitCompetitionStudentInfo hitCompetitionStudentInfo) { + if (StringUtils.isEmpty(hitCompetitionStudentInfo.getYear())) { + Calendar calendar = Calendar.getInstance(); + int year = calendar.get(Calendar.YEAR); + hitCompetitionStudentInfo.setYear(String.valueOf(year)); + } //当前教师的学校 LoginUser loginUser = SecurityUtils.getLoginUser(); - HitRegistrationTeachInfo hitRegistrationTeachInfo = hitRegistrationTeachInfoMapper.selectHitRegistrationTeachInfoByUserId(loginUser.getUserId()); - if(ObjectUtils.isNotEmpty(hitRegistrationTeachInfo)&&hitRegistrationTeachInfo.getStatus().equals("1")){ + HitRegistrationTeachInfo hitRegistrationTeachInfo = hitRegistrationTeachInfoMapper.selectHitRegistrationTeachInfoByUserId(loginUser.getUserId(), hitCompetitionStudentInfo.getYear()); + if (ObjectUtils.isNotEmpty(hitRegistrationTeachInfo) && hitRegistrationTeachInfo.getStatus().equals("1")) { hitCompetitionStudentInfo.setSchoolName(hitRegistrationTeachInfo.getSchoolName()); } PageUtils.startPage(); return hitCompetitionStudentInfoMapper.selectHitCompetitionStudentInfoList(hitCompetitionStudentInfo); } + /** * 查询大赛学生列表 * @@ -108,15 +107,14 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti * @return 大赛学生 */ @Override - public List<HitCompetitionStudentInfo> selectHitCompetitionStudentInfoListExport(HitCompetitionStudentInfo hitCompetitionStudentInfo) - { + public List<HitCompetitionStudentInfo> selectHitCompetitionStudentInfoListExport(HitCompetitionStudentInfo hitCompetitionStudentInfo) { Calendar calendar = Calendar.getInstance(); int year = calendar.get(Calendar.YEAR); hitCompetitionStudentInfo.setYear(String.valueOf(year)); //当前教师的学校 LoginUser loginUser = SecurityUtils.getLoginUser(); - HitRegistrationTeachInfo hitRegistrationTeachInfo = hitRegistrationTeachInfoMapper.selectHitRegistrationTeachInfoByUserId(loginUser.getUserId()); - if(ObjectUtils.isNotEmpty(hitRegistrationTeachInfo)&&hitRegistrationTeachInfo.getStatus().equals("1")){ + HitRegistrationTeachInfo hitRegistrationTeachInfo = hitRegistrationTeachInfoMapper.selectHitRegistrationTeachInfoByUserId(loginUser.getUserId(), hitCompetitionStudentInfo.getYear()); + if (ObjectUtils.isNotEmpty(hitRegistrationTeachInfo) && hitRegistrationTeachInfo.getStatus().equals("1")) { hitCompetitionStudentInfo.setSchoolName(hitRegistrationTeachInfo.getSchoolName()); } // PageUtils.startPage(); @@ -130,8 +128,7 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti * @return 结果 */ @Override - public int insertHitCompetitionStudentInfo(HitCompetitionStudentInfo hitCompetitionStudentInfo) - { + public int insertHitCompetitionStudentInfo(HitCompetitionStudentInfo hitCompetitionStudentInfo) { //判断是否重复报名 LambdaQueryWrapper<HitCompetitionStudentInfo> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(HitCompetitionStudentInfo::getStudentId, hitCompetitionStudentInfo.getStudentId()); @@ -155,17 +152,16 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti * @return 结果 */ @Override - public int updateHitCompetitionStudentInfo(HitCompetitionStudentInfo hitCompetitionStudentInfo) - { + public int updateHitCompetitionStudentInfo(HitCompetitionStudentInfo hitCompetitionStudentInfo) { LambdaQueryWrapper<HitCompetitionStudentInfo> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(HitCompetitionStudentInfo::getSchoolName, hitCompetitionStudentInfo.getSchoolName()); - queryWrapper.eq(HitCompetitionStudentInfo::getIsPreliminary,true); + queryWrapper.eq(HitCompetitionStudentInfo::getIsPreliminary, true); DateTime now = DateUtil.date(); DateTime dateTime = DateUtil.beginOfYear(now); DateTime dateTime1 = DateUtil.endOfYear(now); queryWrapper.between(HitCompetitionStudentInfo::getCreateTime, dateTime, dateTime1); List<HitCompetitionStudentInfo> hitCompetitionStudentInfos = hitCompetitionStudentInfoMapper.selectList(queryWrapper); - if (CollectionUtil.isNotEmpty(hitCompetitionStudentInfos)&&hitCompetitionStudentInfos.size() >= 15 && hitCompetitionStudentInfo.getIsPreliminary()) { + if (CollectionUtil.isNotEmpty(hitCompetitionStudentInfos) && hitCompetitionStudentInfos.size() >= 15 && hitCompetitionStudentInfo.getIsPreliminary()) { throw new RuntimeException("该学校入选人数已超过15人,无法再添加"); } hitCompetitionStudentInfo.setUpdateTime(DateUtils.getNowDate()); @@ -182,7 +178,7 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti public int updateHitCompetitionStudentInfoUpdate(HitCompetitionStudentInfo hitCompetitionStudentInfo) { LambdaQueryWrapper<HitCompetitionStudentInfo> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(HitCompetitionStudentInfo::getSchoolName, hitCompetitionStudentInfo.getSchoolName()); - queryWrapper.eq(HitCompetitionStudentInfo::getIsPreliminary,true); + queryWrapper.eq(HitCompetitionStudentInfo::getIsPreliminary, true); DateTime now = DateUtil.date(); DateTime dateTime = DateUtil.beginOfYear(now); DateTime dateTime1 = DateUtil.endOfYear(now); @@ -198,8 +194,7 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti * @return 结果 */ @Override - public int deleteHitCompetitionStudentInfoByIds(String[] ids) - { + public int deleteHitCompetitionStudentInfoByIds(String[] ids) { return hitCompetitionStudentInfoMapper.deleteHitCompetitionStudentInfoByIds(ids); } @@ -210,8 +205,7 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti * @return 结果 */ @Override - public int deleteHitCompetitionStudentInfoById(String id) - { + public int deleteHitCompetitionStudentInfoById(String id) { return hitCompetitionStudentInfoMapper.deleteHitCompetitionStudentInfoById(id); } @@ -222,7 +216,7 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti HitCompetitionStudentInfo hitCompetitionStudentInfo = hitCompetitionStudentInfoMapper.selectOne(queryWrapper); String com_region = sysDictDataService.selectDictLabel("com_region", hitCompetitionStudentInfo.getDivision()); hitCompetitionStudentInfo.setDivisionLabel(com_region); - if (ObjectUtils.isEmpty(hitCompetitionStudentInfo) ) { + if (ObjectUtils.isEmpty(hitCompetitionStudentInfo)) { return new HitCompetitionStudentInfo(); } @@ -246,78 +240,78 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti // if (ObjectUtils.isNotEmpty(hitTeams)) { //// hitCompetitionStudentInfo.setCompetition(hitTeams.getCompetition()); // } - if (ObjectUtils.isEmpty(hitCompetitionStudentInfo) ) { + if (ObjectUtils.isEmpty(hitCompetitionStudentInfo)) { return new HitCompetitionStudentInfo(); } String com_region = sysDictDataService.selectDictLabel("com_region", hitCompetitionStudentInfo.getDivision()); hitCompetitionStudentInfo.setDivisionLabel(com_region); //根据学校查询领队老师 - LambdaQueryWrapper<HitRegistrationTeachInfo> queryWrapper1 =new LambdaQueryWrapper<>(); - queryWrapper1.eq(HitRegistrationTeachInfo::getSchoolName,hitCompetitionStudentInfo.getSchoolName()) - .likeRight(HitRegistrationTeachInfo::getCreateTime, year).eq(HitRegistrationTeachInfo::getType,1).eq(HitRegistrationTeachInfo::getStatus,1); + LambdaQueryWrapper<HitRegistrationTeachInfo> 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); //根绝学校查询 团队成员 把自己排除掉 和 指导老师 - LambdaQueryWrapper<HitRegistrationTeachInfo> queryWrapper2 =new LambdaQueryWrapper<>(); - queryWrapper2.eq(HitRegistrationTeachInfo::getSchoolName,hitCompetitionStudentInfo.getSchoolName()) - .likeRight(HitRegistrationTeachInfo::getCreateTime, year).eq(HitRegistrationTeachInfo::getType,0).eq(HitRegistrationTeachInfo::getStatus,1); + LambdaQueryWrapper<HitRegistrationTeachInfo> queryWrapper2 = new LambdaQueryWrapper<>(); + queryWrapper2.eq(HitRegistrationTeachInfo::getSchoolName, hitCompetitionStudentInfo.getSchoolName()) + .likeRight(HitRegistrationTeachInfo::getCreateTime, year).eq(HitRegistrationTeachInfo::getType, 0).eq(HitRegistrationTeachInfo::getStatus, 1); List<HitRegistrationTeachInfo> hitRegistrationTeachInfos = hitRegistrationTeachInfoMapper.selectList(queryWrapper2); //领队老师也可以是指导老师 - if (ObjectUtils.isNotEmpty(hitRegistrationTeachInfo)){ + if (ObjectUtils.isNotEmpty(hitRegistrationTeachInfo)) { hitRegistrationTeachInfos.add(hitRegistrationTeachInfo); } hitCompetitionStudentInfo.setZdTeacherList(hitRegistrationTeachInfos); - LambdaQueryWrapper<HitCompetitionStudentInfo> queryWrapper3 =new LambdaQueryWrapper<>(); - queryWrapper3.eq(HitCompetitionStudentInfo::getSchoolName,hitCompetitionStudentInfo.getSchoolName()).ne(HitCompetitionStudentInfo::getUserId,user.getUserId()) - .likeRight(HitCompetitionStudentInfo::getCreateTime, year).eq(HitCompetitionStudentInfo::getIsPreliminary,1) - .and(it->{ - it.isNull(HitCompetitionStudentInfo::getHitRegId).or().eq(HitCompetitionStudentInfo::getHitRegId,""); + LambdaQueryWrapper<HitCompetitionStudentInfo> queryWrapper3 = new LambdaQueryWrapper<>(); + queryWrapper3.eq(HitCompetitionStudentInfo::getSchoolName, hitCompetitionStudentInfo.getSchoolName()).ne(HitCompetitionStudentInfo::getUserId, user.getUserId()) + .likeRight(HitCompetitionStudentInfo::getCreateTime, year).eq(HitCompetitionStudentInfo::getIsPreliminary, 1) + .and(it -> { + it.isNull(HitCompetitionStudentInfo::getHitRegId).or().eq(HitCompetitionStudentInfo::getHitRegId, ""); }); List<HitCompetitionStudentInfo> studentInfos = this.list(queryWrapper3); hitCompetitionStudentInfo.setTdStudentList(studentInfos); //查询是否存在已组队团队 HitRegInfo hitRegInfos1 = regInfoService.selectHitByUserId(user.getUserId(), "1"); - String status="-1"; - if (ObjectUtils.isNotEmpty(hitRegInfos1)){ + String status = "-1"; + if (ObjectUtils.isNotEmpty(hitRegInfos1)) { status = "1"; hitCompetitionStudentInfo.setHitRegInfo(hitRegInfos1); List<HitRegInfoUser> teachers = hitRegInfos1.getRegInfoUsers().stream().filter(it -> { return it.getType().equals("2"); }).collect(Collectors.toList()); - String tmpStr =""; + String tmpStr = ""; for (HitRegInfoUser teacher : teachers) { - tmpStr = teacher.getUserName()+","; + tmpStr = teacher.getUserName() + ","; } - hitCompetitionStudentInfo.setZdTeacherStr(tmpStr.substring(0,tmpStr.length()-1)); + hitCompetitionStudentInfo.setZdTeacherStr(tmpStr.substring(0, tmpStr.length() - 1)); - }else { + } else { //查询是否存在已确认团队 审核中 HitRegInfo hitRegInfos2 = regInfoService.selectHitByUserId(user.getUserId(), "0"); - if (ObjectUtils.isNotEmpty(hitRegInfos2)){ + if (ObjectUtils.isNotEmpty(hitRegInfos2)) { status = "0"; hitCompetitionStudentInfo.setHitRegInfo(hitRegInfos2); List<HitRegInfoUser> teachers = hitRegInfos2.getRegInfoUsers().stream().filter(it -> { return it.getType().equals("2"); }).collect(Collectors.toList()); - String tmpStr =""; + String tmpStr = ""; for (HitRegInfoUser teacher : teachers) { - tmpStr = teacher.getUserName()+","; + tmpStr = teacher.getUserName() + ","; } - hitCompetitionStudentInfo.setZdTeacherStr(tmpStr.substring(0,tmpStr.length()-1)); - }else { + hitCompetitionStudentInfo.setZdTeacherStr(tmpStr.substring(0, tmpStr.length() - 1)); + } else { //查询是否存在待确认团队 HitRegInfo hitRegInfos3 = regInfoService.selectHitByUserId(user.getUserId(), "9"); - if (ObjectUtils.isNotEmpty(hitRegInfos3)){ + if (ObjectUtils.isNotEmpty(hitRegInfos3)) { status = "9"; hitCompetitionStudentInfo.setHitRegInfo(hitRegInfos3); List<HitRegInfoUser> teachers = hitRegInfos3.getRegInfoUsers().stream().filter(it -> { return it.getType().equals("2"); }).collect(Collectors.toList()); - String tmpStr =""; + String tmpStr = ""; for (HitRegInfoUser teacher : teachers) { - tmpStr =tmpStr+ teacher.getUserName()+","; + tmpStr = tmpStr + teacher.getUserName() + ","; } - hitCompetitionStudentInfo.setZdTeacherStr(tmpStr.substring(0,tmpStr.length()-1)); + hitCompetitionStudentInfo.setZdTeacherStr(tmpStr.substring(0, tmpStr.length() - 1)); } } } @@ -329,7 +323,7 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti } @Override - public List<HitCompetitionStudentInfo> selectTeamMateBySchoolNameAndDivision(String schoolName, String division) { + public List<HitCompetitionStudentInfo> selectTeamMateBySchoolNameAndDivision(String schoolName, String division) { //获取当前学生信息信息 SysUser user = SecurityUtils.getLoginUser().getUser(); String userName = user.getUserName(); @@ -344,6 +338,7 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti /** * 查询当前用户信息 + * * @return TeamsVo */ @Override @@ -363,9 +358,9 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti //学生报名信息 HitCompetitionStudentInfo studentDB = this.getOne(queryWrapper); Integer studentDBId = studentDB.getId(); - LambdaQueryWrapper<HitTeamMembers> hitTeamsLambdaQueryWrapper = new LambdaQueryWrapper<>(); - hitTeamsLambdaQueryWrapper.eq(HitTeamMembers::getTeamMemberId, studentDBId); - teamsVo= selectTeamMsg(teamsVo, hitTeamsLambdaQueryWrapper); + LambdaQueryWrapper<HitTeamMembers> hitTeamsLambdaQueryWrapper = new LambdaQueryWrapper<>(); + hitTeamsLambdaQueryWrapper.eq(HitTeamMembers::getTeamMemberId, studentDBId); + teamsVo = selectTeamMsg(teamsVo, hitTeamsLambdaQueryWrapper); } if (userType.equals("02")) { //如果是老师,则查询老师信息 @@ -374,7 +369,7 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti HitRegistrationTeachInfo teacherDB = hitRegistrationTeachInfoMapper.selectOne(queryWrapper); LambdaQueryWrapper<HitTeamMembers> hitTeamsLambdaQueryWrapper = new LambdaQueryWrapper<>(); hitTeamsLambdaQueryWrapper.eq(HitTeamMembers::getTeamMemberId, teacherDB.getId()); - teamsVo= selectTeamMsg(teamsVo, hitTeamsLambdaQueryWrapper); + teamsVo = selectTeamMsg(teamsVo, hitTeamsLambdaQueryWrapper); } return teamsVo; } @@ -390,15 +385,13 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti //获取当前时间 DateTime now = DateUtil.date(); Date date = new Date(); - if (StringUtils.isNull(hitList) || hitList.size() == 0) - { + if (StringUtils.isNull(hitList) || hitList.size() == 0) { throw new ServiceException("导入学生分数信息不能为空!"); } hitList.forEach(item -> { //判断手机号与分数是否为空 - if (!StringUtils.isNull(item.getPhoneNumber()) || !StringUtils.isNull(item.getTrialsScore())) - { + if (!StringUtils.isNull(item.getPhoneNumber()) || !StringUtils.isNull(item.getTrialsScore())) { //添加trycatch 如果报错继续往下面修改 try { HitCompetitionStudentInfo hitCompetitionStudentInfo = BeanUtil.copyProperties(item, HitCompetitionStudentInfo.class); @@ -408,7 +401,7 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti item.setUpdateTime(date); hitCompetitionStudentInfo.setUpdateTime(date); hitCompetitionStudentInfoMapper.update(hitCompetitionStudentInfo, queryWrapper); - } catch (Exception e){ + } catch (Exception e) { log.error("更新学生信息失败,phoneNumber: " + item.getPhoneNumber(), e); } @@ -418,15 +411,27 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti return "导入成功"; } + /** + * 查询学生大赛报名信息 + * + * @param info 请求参数 + * @return + */ + @Override + public HitCompetitionStudentInfo selectHitCompetitionStudentInfo(HitCompetitionStudentInfo info) { + return hitCompetitionStudentInfoMapper.selectHitCompetitionStudentInfoByUserId(info.getUserId(), info.getYear()); + } + /** * 查询团队信息 + * * @param teamsVo * @param hitTeamsLambdaQueryWrapper * @return */ private TeamsVo selectTeamMsg(TeamsVo teamsVo, LambdaQueryWrapper<HitTeamMembers> hitTeamsLambdaQueryWrapper) { HitTeamMembers hitTeamMembers = hitTeamMembersMapper.selectOne(hitTeamsLambdaQueryWrapper); - if (hitTeamMembers != null) { + if (hitTeamMembers != null) { teamsVo.setTeamMateId(Long.valueOf(hitTeamMembers.getTeamMemberId())); teamsVo.setTeamId(Long.valueOf(hitTeamMembers.getTeamId())); teamsVo.setIsAgreeWith(String.valueOf(hitTeamMembers.getIsAgreeWith())); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitRegInfoServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitRegInfoServiceImpl.java index f6607f7..9be9f61 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitRegInfoServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitRegInfoServiceImpl.java @@ -4,9 +4,11 @@ import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Calendar; +import java.util.Date; import java.util.List; import java.util.stream.Collectors; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -82,9 +84,13 @@ public class HitRegInfoServiceImpl implements IHitRegInfoService @Override public List<HitRegInfo> selectHitRegInfoList(HitRegInfo hitRegInfo) { + if (ObjectUtil.isEmpty(hitRegInfo.getYear())) { + //获取当前年 + hitRegInfo.setYear(DateUtil.format(new Date(), "yyyy")); + } Long userId = SecurityUtils.getLoginUser().getUserId(); //判断当前登陆人是否是领队老师,如果是查询该老师学校下的战队 - HitRegistrationTeachInfo teacherInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(userId); + HitRegistrationTeachInfo teacherInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(userId,hitRegInfo.getYear()); if (teacherInfo != null && teacherInfo.getType().equals("1")) { hitRegInfo.setSchoolName(teacherInfo.getSchoolName()); } @@ -97,17 +103,17 @@ public class HitRegInfoServiceImpl implements IHitRegInfoService for (HitRegInfoUser regInfoUser : hitRegInfoUsers) { switch (regInfoUser.getType()) { case "3": { - HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId()); + HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId(),hitRegInfo.getYear()); regInfo.setLdTeacher(hitRegistrationTeachInfo); break; } case "2": { - HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId()); + HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId(),hitRegInfo.getYear()); regInfo.getZdTeacher().add(hitRegistrationTeachInfo); break; } case "1": - HitCompetitionStudentInfo studentInfo = hitCompetitionStudentInfoMapper.selectHitCompetitionStudentInfoByUserId(regInfoUser.getUserId()); + HitCompetitionStudentInfo studentInfo = hitCompetitionStudentInfoMapper.selectHitCompetitionStudentInfoByUserId(regInfoUser.getUserId(),hitRegInfo.getYear()); regInfo.getStudentUserss().add(studentInfo); break; } @@ -125,9 +131,13 @@ public class HitRegInfoServiceImpl implements IHitRegInfoService @Override public List<HitRegInfo> selectHitRegInfoListExport(HitRegInfo hitRegInfo) { + if (ObjectUtil.isEmpty(hitRegInfo.getYear())) { + //获取当前年 + hitRegInfo.setYear(DateUtil.format(new Date(), "yyyy")); + } Long userId = SecurityUtils.getLoginUser().getUserId(); //判断当前登陆人是否是领队老师,如果是查询该老师学校下的战队 - HitRegistrationTeachInfo teacherInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(userId); + HitRegistrationTeachInfo teacherInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(userId,hitRegInfo.getYear()); if (teacherInfo != null && teacherInfo.getType().equals("1")) { hitRegInfo.setSchoolName(teacherInfo.getSchoolName()); } @@ -139,17 +149,17 @@ public class HitRegInfoServiceImpl implements IHitRegInfoService for (HitRegInfoUser regInfoUser : hitRegInfoUsers) { switch (regInfoUser.getType()) { case "3": { - HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId()); + HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId(),hitRegInfo.getYear()); regInfo.setLdTeacher(hitRegistrationTeachInfo); break; } case "2": { - HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId()); + HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId(),hitRegInfo.getYear()); regInfo.getZdTeacher().add(hitRegistrationTeachInfo); break; } case "1": - HitCompetitionStudentInfo studentInfo = hitCompetitionStudentInfoMapper.selectHitCompetitionStudentInfoByUserId(regInfoUser.getUserId()); + HitCompetitionStudentInfo studentInfo = hitCompetitionStudentInfoMapper.selectHitCompetitionStudentInfoByUserId(regInfoUser.getUserId(),hitRegInfo.getYear()); regInfo.getStudentUserss().add(studentInfo); break; } @@ -372,7 +382,7 @@ public class HitRegInfoServiceImpl implements IHitRegInfoService Calendar calendar = Calendar.getInstance(); int year = calendar.get(Calendar.YEAR); HitRegInfo hitRegInfo = hitRegInfoMapper.selectHitByUserId2(userId,String.valueOf(year)); - if (ObjectUtils.isNotEmpty(hitRegInfo)){ + if (ObjectUtils.isNotEmpty(hitRegInfo)) { HitRegInfoUser hitRegInfoUser = new HitRegInfoUser(); hitRegInfoUser.setRegId(hitRegInfo.getId()); List<HitRegInfoUser> hitRegInfoUsers = regInfoUserService.selectHitRegInfoUserList(hitRegInfoUser); @@ -383,6 +393,10 @@ public class HitRegInfoServiceImpl implements IHitRegInfoService @Override public List<HitRegInfo> selectStudentHitRegInfoList(HitRegInfo hitRegInfo) { + if (ObjectUtil.isEmpty(hitRegInfo.getYear())) { + //获取当前年 + hitRegInfo.setYear(DateUtil.format(new Date(), "yyyy")); + } Long userId = SecurityUtils.getLoginUser().getUserId(); //判断当前登陆人是否是领队老师,如果是查询该老师学校下的战队 //查询当前学生所在的战队信息 @@ -415,17 +429,17 @@ public class HitRegInfoServiceImpl implements IHitRegInfoService for (HitRegInfoUser regInfoUser : hitRegInfoUsers) { switch (regInfoUser.getType()) { case "3": { - HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId()); + HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId(), regInfo.getYear()); regInfo.setLdTeacher(hitRegistrationTeachInfo); break; } case "2": { - HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId()); + HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId(), regInfo.getYear()); regInfo.getZdTeacher().add(hitRegistrationTeachInfo); break; } case "1": - HitCompetitionStudentInfo studentInfo = hitCompetitionStudentInfoMapper.selectHitCompetitionStudentInfoByUserId(regInfoUser.getUserId()); + HitCompetitionStudentInfo studentInfo = hitCompetitionStudentInfoMapper.selectHitCompetitionStudentInfoByUserId(regInfoUser.getUserId(), regInfo.getYear()); regInfo.getStudentUserss().add(studentInfo); break; } 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 5136102..8577d7d 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 @@ -63,16 +63,18 @@ public class HitRegistrationTeachInfoServiceImpl implements IHitRegistrationTeac /** * 根据用户id获取教师信息 + * * @param id * @return */ @Override public HitRegistrationTeachInfo selectHitRegistrationTeachInfoByUseryId(Long id) { - LambdaQueryWrapper<HitRegistrationTeachInfo> queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(HitRegistrationTeachInfo::getUserId,id); + LambdaQueryWrapper<HitRegistrationTeachInfo> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(HitRegistrationTeachInfo::getUserId, id); HitRegistrationTeachInfo hitRegistrationTeachInfo = hitRegistrationTeachInfoMapper.selectOne(queryWrapper); return hitRegistrationTeachInfo; } + /** * 查询教师信息列表 * @@ -82,14 +84,16 @@ public class HitRegistrationTeachInfoServiceImpl implements IHitRegistrationTeac @Override public List<HitRegistrationTeachInfo> selectHitRegistrationTeachInfoList(HitRegistrationTeachInfo hitRegistrationTeachInfo) { - //获取当前年份 - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy"); - String currentYear = LocalDate.now().format(formatter); - hitRegistrationTeachInfo.setYear(currentYear); + if (ObjectUtils.isEmpty(hitRegistrationTeachInfo.getYear())) { + //获取当前年份 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy"); + String currentYear = LocalDate.now().format(formatter); + hitRegistrationTeachInfo.setYear(currentYear); + } //当前教师的学校 LoginUser loginUser = SecurityUtils.getLoginUser(); - HitRegistrationTeachInfo hitRegistrationTeachInfo1 = hitRegistrationTeachInfoMapper.selectHitRegistrationTeachInfoByUserId(loginUser.getUserId()); - if(ObjectUtils.isNotEmpty(hitRegistrationTeachInfo1)){ + HitRegistrationTeachInfo hitRegistrationTeachInfo1 = hitRegistrationTeachInfoMapper.selectHitRegistrationTeachInfoByUserId(loginUser.getUserId(), hitRegistrationTeachInfo.getYear()); + if (ObjectUtils.isNotEmpty(hitRegistrationTeachInfo1)) { hitRegistrationTeachInfo.setSchoolName(hitRegistrationTeachInfo1.getSchoolName()); } PageUtils.startPage(); @@ -116,14 +120,14 @@ public class HitRegistrationTeachInfoServiceImpl implements IHitRegistrationTeac */ @Override public int updateHitRegistrationTeachInfo(HitRegistrationTeachInfo hitRegistrationTeachInfo) throws Exception { - if (hitRegistrationTeachInfo.getType().equals("1")&&hitRegistrationTeachInfo.getStatus().equals("1")){ + if (hitRegistrationTeachInfo.getType().equals("1") && hitRegistrationTeachInfo.getStatus().equals("1")) { //查询系统中是否存在已审核通过的同学校领队老师 - LambdaQueryWrapper<HitRegistrationTeachInfo> queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(HitRegistrationTeachInfo::getType,"1") - .eq(HitRegistrationTeachInfo::getSchoolName,hitRegistrationTeachInfo.getSchoolName()) - .eq(HitRegistrationTeachInfo::getStatus,"1").last("limit 1"); + LambdaQueryWrapper<HitRegistrationTeachInfo> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(HitRegistrationTeachInfo::getType, "1") + .eq(HitRegistrationTeachInfo::getSchoolName, hitRegistrationTeachInfo.getSchoolName()) + .eq(HitRegistrationTeachInfo::getStatus, "1").last("limit 1"); HitRegistrationTeachInfo hitRegistrationTeachInfo1 = hitRegistrationTeachInfoMapper.selectOne(queryWrapper); - if (ObjectUtils.isNotEmpty(hitRegistrationTeachInfo1)){ + if (ObjectUtils.isNotEmpty(hitRegistrationTeachInfo1)) { throw new Exception("已存在领队老师"); } @@ -156,6 +160,7 @@ public class HitRegistrationTeachInfoServiceImpl implements IHitRegistrationTeac /** * 根据学校名称和赛区查询教师信息 + * * @param schoolName * @param division * @return @@ -182,7 +187,7 @@ public class HitRegistrationTeachInfoServiceImpl implements IHitRegistrationTeac validateCaptcha(username, user.getCode(), user.getUuid()); } boolean validPhoneNumber = isValidPhoneNumber(username); - if (StringUtils.isEmpty(username)) { + if (StringUtils.isEmpty(username)) { msg = "用户名不能为空"; } else if (StringUtils.isEmpty(password)) { msg = "用户密码不能为空"; @@ -198,19 +203,19 @@ public class HitRegistrationTeachInfoServiceImpl implements IHitRegistrationTeac sysUser.setNickName(user.getNickName()); sysUser.setPassword(SecurityUtils.encryptPassword(password)); sysUser.setUserType(user.getUserType()); - boolean regFlag ; - if (user.getUserType().equals("03")){ + boolean regFlag; + if (user.getUserType().equals("03")) { //领队老师 sysUser.setRoleIds(new Long[]{102L}); - regFlag = userService.insertUser(sysUser)>0; + regFlag = userService.insertUser(sysUser) > 0; } else if (user.getUserType().equals("02")) { //指导老师 sysUser.setRoleIds(new Long[]{103L}); - regFlag = userService.insertUser(sysUser)>0; + regFlag = userService.insertUser(sysUser) > 0; } else { //指导老师 sysUser.setRoleIds(new Long[]{2L}); - regFlag= userService.registerUser(sysUser); + regFlag = userService.insertUser(sysUser) > 0; } if (!regFlag) { msg = "注册失败,请联系系统管理人员"; @@ -219,10 +224,10 @@ public class HitRegistrationTeachInfoServiceImpl implements IHitRegistrationTeac } } - if(StringUtils.isNotEmpty(msg)){ + if (StringUtils.isNotEmpty(msg)) { throw new Exception(msg); } - if (user.getUserType().equals("02")){ + if (user.getUserType().equals("02")) { HitRegistrationTeachInfo teachInfo = user.getHitRegistrationTeachInfo(); teachInfo.setRelatedAccounts(user.getUsername()); teachInfo.setStatus("1"); @@ -230,7 +235,7 @@ public class HitRegistrationTeachInfoServiceImpl implements IHitRegistrationTeac teachInfo.setTeacherName(user.getNickName()); teachInfo.setUserId(sysUser.getUserId()); this.insertHitRegistrationTeachInfo(teachInfo); - }else if (user.getUserType().equals("03")){ + } else if (user.getUserType().equals("03")) { HitRegistrationTeachInfo teachInfo = user.getHitRegistrationTeachInfo(); teachInfo.setRelatedAccounts(user.getUsername()); teachInfo.setStatus("0"); @@ -248,8 +253,8 @@ public class HitRegistrationTeachInfoServiceImpl implements IHitRegistrationTeac * @return */ @Override - public List<Map> getSchoolName(String schoolename,String year) { - return hitRegistrationTeachInfoMapper.selectSchoolName(schoolename,year); + public List<Map> getSchoolName(String schoolename, String year) { + return hitRegistrationTeachInfoMapper.selectSchoolName(schoolename, year); } /** diff --git a/ruoyi-admin/src/main/resources/mapper/cms/HitCompetitionStudentInfoMapper.xml b/ruoyi-admin/src/main/resources/mapper/cms/HitCompetitionStudentInfoMapper.xml index 05ba06a..e970b00 100644 --- a/ruoyi-admin/src/main/resources/mapper/cms/HitCompetitionStudentInfoMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/cms/HitCompetitionStudentInfoMapper.xml @@ -40,6 +40,7 @@ <if test="stuName != null and stuName != ''"> and stu_name like concat('%', #{stuName}, '%')</if> <if test="schoolName != null and schoolName != ''"> and school_name = #{schoolName} </if> <if test="collegeName != null and collegeName != ''"> and college_name like concat('%', #{collegeName}, '%')</if> + <if test="schoolName != null and schoolName != ''"> and school_name like concat('%', #{schoolName}, '%')</if> <if test="major != null and major != ''"> and major = #{major}</if> <if test="division != null and division != ''"> and division = #{division}</if> <if test="phoneNumber != null and phoneNumber != ''"> and phone_number = #{phoneNumber}</if> @@ -58,9 +59,9 @@ where id = #{id} </select> <select id="selectHitCompetitionStudentInfoByUserId" - resultType="com.ruoyi.cms.domain.HitCompetitionStudentInfo" parameterType="java.lang.Long"> + resultType="com.ruoyi.cms.domain.HitCompetitionStudentInfo" > select * from hit_competition_student_info - where user_id = #{userId} and YEAR(create_time) = YEAR(CURRENT_DATE) + where user_id = #{userId} and create_time like concat(#{year},'%') </select> <insert id="insertHitCompetitionStudentInfo" parameterType="HitCompetitionStudentInfo" useGeneratedKeys="true" keyProperty="id"> @@ -115,6 +116,7 @@ update hit_competition_student_info <trim prefix="SET" suffixOverrides=","> <if test="hitRegId != null">hit_reg_id = #{hitRegId},</if> + <if test="studentId != null">student_id = #{studentId},</if> <if test="stuName != null and stuName != ''">stu_name = #{stuName},</if> <if test="schoolName != null and schoolName != ''">school_name = #{schoolName},</if> <if test="collegeName != null and collegeName != ''">college_name = #{collegeName},</if> diff --git a/ruoyi-admin/src/main/resources/mapper/cms/HitRegInfoMapper.xml b/ruoyi-admin/src/main/resources/mapper/cms/HitRegInfoMapper.xml index e041a2e..25a3638 100644 --- a/ruoyi-admin/src/main/resources/mapper/cms/HitRegInfoMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/cms/HitRegInfoMapper.xml @@ -40,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <if test="sampleAddress != null and sampleAddress != ''"> and sample_address = #{sampleAddress}</if> <if test="uploadFile != null and uploadFile != ''"> and upload_file = #{uploadFile}</if> <if test="createTime != null " > and create_time LIKE concat('%', date_format(#{createTime}, '%Y'), '%')</if> + <if test="year != null " > and create_time LIKE concat(#{year}, '%')</if> </where> order by audit_status asc,create_time desc </select> diff --git a/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationTeachInfoMapper.xml b/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationTeachInfoMapper.xml index cac1269..04b0953 100644 --- a/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationTeachInfoMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationTeachInfoMapper.xml @@ -55,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <select id="selectHitRegistrationTeachInfoByUserId" resultType="com.ruoyi.common.core.domain.HitRegistrationTeachInfo"> select * from hit_registration_teach_info - where user_id = #{userId} and YEAR(create_time) = YEAR(CURRENT_DATE) + where user_id = #{userId} and create_time like concat(#{year},'%') </select> <select id="selectSchoolName" resultType="java.util.Map"> diff --git a/ruoyi-admin/target/classes/mapper/cms/CmsContentMapper.xml b/ruoyi-admin/target/classes/mapper/cms/CmsContentMapper.xml deleted file mode 100644 index 87c87b3..0000000 --- a/ruoyi-admin/target/classes/mapper/cms/CmsContentMapper.xml +++ /dev/null @@ -1,379 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper - PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.ruoyi.cms.mapper.CmsContentMapper"> - - <resultMap type="CmsContent" id="CmsContentResult"> - <result property="id" column="id"/> - <result property="categoryId" column="category_id"/> - <result property="contentType" column="content_type"/> - <result property="contentTitle" column="content_title"/> - <result property="contentImg" column="content_img"/> - <result property="contentDetail" column="content_detail"/> - <result property="source" column="source"/> - <result property="sourceUrl" column="source_url"/> - <result property="original" column="original"/> - <result property="author" column="author"/> - <result property="sortNum" column="sort_num"/> - <result property="editor" column="editor"/> - <result property="summary" column="summary"/> - <result property="tagName" column="tag_name"/> - <result property="status" column="status"/> - <result property="publishDate" column="publish_date"/> - <result property="offlineDate" column="offline_date"/> - <result property="isAccessory" column="is_accessory"/> - <result property="accessoryUrl" column="accessory_url" javaType="java.util.List" - typeHandler="com.ruoyi.system.handler.MysqlTypeHandler"/> - <result property="remark" column="remark"/> - <result property="delFlag" column="del_flag"/> - <result property="createTime" column="create_time"/> - <result property="createBy" column="create_by"/> - <result property="updateTime" column="update_time"/> - <result property="updateBy" column="update_by"/> - <result property="imageUrl" column="image_url" javaType="java.util.List" - typeHandler="com.ruoyi.system.handler.MysqlTypeHandler"/> - <result property="videoUrl" column="video_url" javaType="java.util.List" - typeHandler="com.ruoyi.system.handler.MysqlTypeHandler"/> - <result property="linkType" column="link_type" /> - <result property="link" column="link" /> - <result property="count" column="count" /> - </resultMap> - - <sql id="selectCmsContentVo"> - select id, - category_id, - content_type, - image_url, - video_url, - content_title, - content_img, - content_detail, - source, - source_url, - original, - author, - sort_num, - editor, - summary, - tag_name, - status, - publish_date, - offline_date, - is_accessory, - accessory_url, - remark, - del_flag, - create_time, - create_by, - update_time, - update_by, - link_type, - link, - count - from cms_content - </sql> - - <select id="selectCmsContentList" parameterType="CmsContent" resultMap="CmsContentResult"> - select id, - category_id, - content_type, - image_url, - video_url, - content_title, - content_img, - content_detail, - source, - source_url, - original, - author, - sort_num, - editor, - summary, - tag_name, - status, - publish_date, - offline_date, - is_accessory, - accessory_url, - remark, - del_flag, - create_time, - create_by, - update_time, - update_by, - link_type, - link, - count - from cms_content - <where> - <if test="categoryId != null ">and category_id = #{categoryId}</if> - <if test="contentType != null ">and content_type = #{contentType}</if> - <if test="contentTitle != null and contentTitle != ''">and content_title like concat('%', #{contentTitle}, - '%') - </if> - <if test="contentImg != null and contentImg != ''">and content_img = #{contentImg}</if> - <if test="contentDetail != null and contentDetail != ''">and content_detail = #{contentDetail}</if> - <if test="source != null and source != ''">and source = #{source}</if> - <if test="sourceUrl != null and sourceUrl != ''">and source_url = #{sourceUrl}</if> - <if test="original != null ">and original = #{original}</if> - <if test="author != null and author != ''">and author = #{author}</if> - <if test="editor != null and editor != ''">and editor = #{editor}</if> - <if test="summary != null and summary != ''">and summary = #{summary}</if> - <if test="status != null ">and status = #{status}</if> - <if test="publishDate != null ">and publish_date = #{publishDate}</if> - <if test="offlineDate != null ">and offline_date = #{offlineDate}</if> - <if test="isAccessory != null ">and is_accessory = #{isAccessory}</if> - <if test="accessoryUrl != null and accessoryUrl != ''">and accessory_url = #{accessoryUrl}</if> - <if test="delFlag != null">and del_flag = #{delFlag}</if> - </where> - order by sort_num ASC, create_time desc, update_time desc - </select> - - <select id="contentList" parameterType="CmsContent" resultMap="CmsContentResult"> - select id, - category_id, - content_type, - image_url, - video_url, - content_title, - content_img, - source, - source_url, - original, - author, - sort_num, - editor, - summary, - tag_name, - status, - publish_date, - offline_date, - is_accessory, - accessory_url, - remark, - del_flag, - create_time, - create_by, - update_time, - update_by, - link_type, - link, - count - from cms_content - <where> - <if test="categoryId != null ">and category_id = #{categoryId}</if> - <if test="contentType != null ">and content_type = #{contentType}</if> - <if test="contentTitle != null and contentTitle != ''">and content_title like concat('%', #{contentTitle}, - '%') - </if> - <if test="contentImg != null and contentImg != ''">and content_img = #{contentImg}</if> - <if test="contentDetail != null and contentDetail != ''">and content_detail = #{contentDetail}</if> - <if test="source != null and source != ''">and source = #{source}</if> - <if test="sourceUrl != null and sourceUrl != ''">and source_url = #{sourceUrl}</if> - <if test="original != null ">and original = #{original}</if> - <if test="author != null and author != ''">and author = #{author}</if> - <if test="editor != null and editor != ''">and editor = #{editor}</if> - <if test="summary != null and summary != ''">and summary = #{summary}</if> - <if test="status != null ">and status = #{status}</if> - <if test="publishDate != null ">and publish_date = #{publishDate}</if> - <if test="offlineDate != null ">and offline_date = #{offlineDate}</if> - <if test="isAccessory != null ">and is_accessory = #{isAccessory}</if> - <if test="accessoryUrl != null and accessoryUrl != ''">and accessory_url = #{accessoryUrl}</if> - <if test="delFlag != null">and del_flag = #{delFlag}</if> - </where> - order by sort_num ASC, create_time desc, update_time desc - </select> - - <select id="selectCmsContentById" parameterType="Long" resultMap="CmsContentResult"> - <include refid="selectCmsContentVo"/> - where id = #{id} - </select> - - <sql id="selectCmsContentVoNew"> - select id, - category_id, - content_type, - image_url, - video_url, - content_title, - content_img, - source, - source_url, - tag_name, - original, - author, - sort_num, - editor, - summary, - status, - publish_date, - offline_date, - is_accessory, - accessory_url, - remark, - del_flag, - create_time, - create_by, - update_time, - update_by, - link_type, - link, - count - from cms_content - </sql> - <select id="selectCmsContentPart" resultMap="CmsContentResult"> - <include refid="selectCmsContentVoNew"></include> - <where> - <if test="categoryId != null ">and category_id = #{categoryId}</if> - <if test="contentType != null ">and content_type = #{contentType}</if> - <if test="contentTitle != null and contentTitle != ''">and content_title like concat('%', #{contentTitle}, - '%') - </if> - <if test="contentImg != null and contentImg != ''">and content_img = #{contentImg}</if> - <if test="source != null and source != ''">and source = #{source}</if> - <if test="sourceUrl != null and sourceUrl != ''">and source_url = #{sourceUrl}</if> - <if test="original != null ">and original = #{original}</if> - <if test="author != null and author != ''">and author = #{author}</if> - <if test="editor != null and editor != ''">and editor = #{editor}</if> - <if test="summary != null and summary != ''">and summary = #{summary}</if> - <if test="status != null ">and status = #{status}</if> - <if test="publishDate != null ">and publish_date = #{publishDate}</if> - <if test="offlineDate != null ">and offline_date = #{offlineDate}</if> - <if test="isAccessory != null ">and is_accessory = #{isAccessory}</if> - <if test="accessoryUrl != null and accessoryUrl != ''">and accessory_url = #{accessoryUrl}</if> - <if test="delFlag != null">and del_flag = #{delFlag}</if> - </where> - order by sort_num ASC, create_time desc, update_time desc - </select> - <select id="selectCmsContentByContentTitle" resultType="com.ruoyi.cms.domain.CmsContent" - parameterType="java.lang.String"> - select * from cms_content where content_title = #{contentTitle} - </select> - - <insert id="insertCmsContent" parameterType="CmsContent"> - insert into cms_content - <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="id != null">id,</if> - <if test="categoryId != null">category_id,</if> - <if test="contentType != null">content_type,</if> - <if test="contentTitle != null and contentTitle != ''">content_title,</if> - <if test="contentImg != null and contentImg != ''">content_img,</if> - <if test="contentDetail != null and contentDetail != ''">content_detail,</if> - <if test="source != null and source != ''">source,</if> - <if test="sourceUrl != null and sourceUrl != ''">source_url,</if> - <if test="original != null and original != ''">original,</if> - <if test="author != null and author != ''">author,</if> - <if test="sortNum != null and sortNum != ''">sort_num,</if> - <if test="editor != null and editor != ''">editor,</if> - <if test="tagName != null and tagName != ''">tag_name,</if> - <if test="summary != null and summary != ''">summary,</if> - <if test="status != null and status != ''">status,</if> - <if test="publishDate != null">publish_date,</if> - <if test="offlineDate != null">offline_date,</if> - <if test="isAccessory != null and isAccessory != ''">is_accessory,</if> - <if test="accessoryUrl != null and accessoryUrl.size() != 0">accessory_url,</if> - <if test="remark != null">remark,</if> - <if test="delFlag != null">del_flag,</if> - <if test="createTime != null">create_time,</if> - <if test="createBy != null">create_by,</if> - <if test="updateTime != null">update_time,</if> - <if test="updateBy != null">update_by,</if> - <if test="linkType != null">link_type,</if> - <if test="link != null">link,</if> - <if test="imageUrl != null and imageUrl.size() != 0">image_url,</if> - <if test="videoUrl != null and videoUrl.size() != 0">video_url,</if> - </trim> - <trim prefix="values (" suffix=")" suffixOverrides=","> - <if test="id != null">#{id},</if> - <if test="categoryId != null">#{categoryId},</if> - <if test="contentType != null">#{contentType},</if> - <if test="contentTitle != null and contentTitle != ''">#{contentTitle},</if> - <if test="contentImg != null and contentImg != ''">#{contentImg},</if> - <if test="contentDetail != null and contentDetail != ''">#{contentDetail},</if> - <if test="source != null and source != ''">#{source},</if> - <if test="sourceUrl != null and sourceUrl != ''">#{sourceUrl},</if> - <if test="original != null and original != ''">#{original},</if> - <if test="author != null and author != ''">#{author},</if> - <if test="sortNum != null and sortNum != ''">#{sortNum},</if> - <if test="editor != null and editor != ''">#{editor},</if> - <if test="tagName != null and tagName != ''">#{tagName},</if> - <if test="summary != null and summary != ''">#{summary},</if> - <if test="status != null and status != ''">#{status},</if> - <if test="publishDate != null">#{publishDate},</if> - <if test="offlineDate != null">#{offlineDate},</if> - <if test="isAccessory != null and isAccessory != ''">#{isAccessory},</if> - <if test="accessoryUrl != null and accessoryUrl.size() != 0"> - #{accessoryUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, - </if> - <if test="remark != null">#{remark},</if> - <if test="delFlag != null">#{delFlag},</if> - <if test="createTime != null">#{createTime},</if> - <if test="createBy != null">#{createBy},</if> - <if test="updateTime != null">#{updateTime},</if> - <if test="updateBy != null">#{updateBy},</if> - <if test="linkType != null">#{linkType},</if> - <if test="link != null">#{link},</if> - <if test="imageUrl != null and imageUrl.size() != 0"> - #{imageUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, - </if> - <if test="videoUrl != null and videoUrl.size() != 0"> - #{videoUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, - </if> - </trim> - </insert> - - <update id="updateCmsContent" parameterType="CmsContent"> - update cms_content - <trim prefix="SET" suffixOverrides=","> - category_id = #{categoryId}, - content_type = #{contentType}, - content_title = #{contentTitle}, - content_img = #{contentImg}, - content_detail = #{contentDetail}, - source = #{source}, - source_url = #{sourceUrl}, - original = #{original}, - author = #{author}, - tag_name = #{tagName}, - editor = #{editor}, - sort_num = #{sortNum}, - summary = #{summary}, - status = #{status}, - publish_date = #{publishDate}, - offline_date = #{offlineDate}, - is_accessory = #{isAccessory}, - accessory_url = #{accessoryUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, - remark = #{remark}, - del_flag = #{delFlag}, - create_time = #{createTime}, - create_by = #{createBy}, - update_time = #{updateTime}, - update_by = #{updateBy}, - link_type = #{linkType}, - link = #{link}, - image_url = #{imageUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, - video_url = #{videoUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, - </trim> - where id = #{id} - </update> - - <update id="updateCount" parameterType="Long"> - update cms_content set count = count + 1 where id = #{id} - </update> - - <delete id="deleteCmsContentById" parameterType="Long"> - delete - from cms_content - where id = #{id} - </delete> - - <delete id="deleteCmsContentByIds" parameterType="String"> - delete from cms_content where id in - <foreach item="id" collection="array" open="(" separator="," close=")"> - #{id} - </foreach> - </delete> - - -</mapper> \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index fe16427..46dad39 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -1,6 +1,9 @@ package com.ruoyi.framework.web.service; import javax.annotation.Resource; + +import com.ruoyi.common.core.domain.entity.SysRole; +import io.netty.util.internal.ObjectUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; @@ -96,6 +99,19 @@ public class SysLoginService AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); LoginUser loginUser = (LoginUser) authentication.getPrincipal(); recordLoginInfo(loginUser.getUserId()); + + //判断当前登陆人是否是学生 + SysUser sysUser = userService.selectUserById(loginUser.getUserId()); + if (sysUser != null && sysUser.getUserType().equals("01")) { + //查询当前学生是否有普通角色 + SysRole sysRole = sysUser.getRoles().stream().filter(role -> "common".equals(role.getRoleKey())) + .findFirst().orElse(null); + if (sysRole == null) { + //给学生添加普通角色 + userService.insertUserAuth(sysUser.getUserId(), new Long[]{2L}); + } + } + // 生成token return tokenService.createToken(loginUser); } diff --git a/ruoyi-ui/public/index.html b/ruoyi-ui/public/index.html index 925455c..e5eb4c0 100644 --- a/ruoyi-ui/public/index.html +++ b/ruoyi-ui/public/index.html @@ -5,7 +5,7 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="renderer" content="webkit"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> - <link rel="icon" href="<%= BASE_URL %>favicon.ico"> + <link rel="icon" href="<%= BASE_URL %>logo.png"> <title><%= webpackConfig.name %></title> <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]--> <style> diff --git a/ruoyi-ui/public/logo.png b/ruoyi-ui/public/logo.png new file mode 100644 index 0000000..d7877f2 Binary files /dev/null and b/ruoyi-ui/public/logo.png differ diff --git a/ruoyi-ui/src/api/hit/competitionEdit.js b/ruoyi-ui/src/api/hit/competitionEdit.js new file mode 100644 index 0000000..238deef --- /dev/null +++ b/ruoyi-ui/src/api/hit/competitionEdit.js @@ -0,0 +1,18 @@ +import request from '@/utils/request' + +// 校园赛报名信息 +export function queryCompetitionStudentInfo(query) { + return request({ + url: '/system/hit_stu_info/queryStudentInfo', + method: 'get', + params: query + }) +} +// 校园赛报名信息 +export function editCompetitionStudentInfo(data) { + return request({ + url: '/system/hit_stu_info/editInfo', + method: 'put', + data: data + }) +} diff --git a/ruoyi-ui/src/views/hit/registrationStudentInfo/index.vue b/ruoyi-ui/src/views/hit/registrationStudentInfo/index.vue index 44fd17a..b946c1a 100644 --- a/ruoyi-ui/src/views/hit/registrationStudentInfo/index.vue +++ b/ruoyi-ui/src/views/hit/registrationStudentInfo/index.vue @@ -13,12 +13,19 @@ <el-form-item label="团队名称" prop="teamName"> <el-input v-model="queryParams.teamName" placeholder="请输入团队名称" clearable @keyup.enter.native="handleQuery" /> </el-form-item> - <el-form-item label="大赛年份" prop="competitionYear"> - <el-select v-model="queryParams.createTime" placeholder="请选择"> - <el-option <el-option v-for="item in yearList" :key="item.value" :label="item.label" :value="item.value"> - </el-option> - </el-select> + <el-form-item label="年份" prop="year"> + <el-date-picker + v-model="queryParams.year" + type="year" + placeholder="选择年份"> + </el-date-picker> </el-form-item> +<!-- <el-form-item label="大赛年份" prop="competitionYear">--> +<!-- <el-select v-model="queryParams.createTime" placeholder="请选择">--> +<!-- <el-option v-for="item in yearList" :key="item.value" :label="item.label" :value="item.value">--> +<!-- </el-option>--> +<!-- </el-select>--> +<!-- </el-form-item>--> <el-form-item> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置刷新</el-button> @@ -26,18 +33,6 @@ </el-form> <el-row :gutter="10" class="mb8"> - <!-- <el-col :span="1.5">--> - <!-- <el-button--> - <!-- type="danger"--> - <!-- plain--> - <!-- icon="el-icon-delete"--> - <!-- size="mini"--> - <!-- :disabled="multiple"--> - <!-- @click="handleDelete"--> - <!-- v-hasPermi="['hit:hitRegistrationStudentInfo:remove']"--> - <!-- >删除</el-button>--> - <!-- </el-col>--> - <!-- <el-col :span="1.5"> --> <el-col :span="1.5"> <el-button type="warning" @@ -123,10 +118,10 @@ <div v-if="props.row.auditStatus == '0' " style="color:#007bff;"> 待审核</div> <div v-if="props.row.auditStatus == '1' " style="color:green;"> 通过</div> <div v-if="props.row.auditStatus == '2' " style="color:red;"> 拒绝</div> - <div v-if="props.row.registrationInformation.status == '0' && props.row.zdTeacherList.includes(userId) && techerType == '0' && props.row.auditStatus == '9'" style="color:#007bff;"> 待确认</div> - <div v-if="props.row.registrationInformation.status == '1' && props.row.zdTeacherList.includes(userId) && techerType == '0' && props.row.auditStatus == '9'" style="color:green;"> 已同意</div> - <div v-if="props.row.registrationInformation.status == '2' && props.row.zdTeacherList.includes(userId) && techerType == '0' && props.row.auditStatus == '9'" style="color:red;"> 已拒绝</div> - + <div v-if="props.row.registrationInformation && props.row.registrationInformation.status == '0' && props.row.zdTeacherList.includes(userId) && techerType == '0' && props.row.auditStatus == '9'" style="color:#007bff;"> 待确认</div> + <div v-if="props.row.registrationInformation && props.row.registrationInformation.status == '1' && props.row.zdTeacherList.includes(userId) && techerType == '0' && props.row.auditStatus == '9'" style="color:green;"> 已同意</div> + <div v-if="props.row.registrationInformation && props.row.registrationInformation.status == '2' && props.row.zdTeacherList.includes(userId) && techerType == '0' && props.row.auditStatus == '9'" style="color:red;"> 已拒绝</div> +<!--&& props.row.zdTeacherList.includes(userId)--> </template> </el-table-column> @@ -152,14 +147,16 @@ </el-popconfirm> <!-- 指导老师 --> + <!----> <el-popconfirm title="确定当前操作" @confirm="submitData(scope.row.registrationInformation,1)" - v-if="techerType == '0' && scope.row.zdTeacherList.includes(userId) && scope.row.auditStatus == '9'"> + v-if="techerType == '0' && (scope.row.zdTeacherList) && scope.row.zdTeacherList.includes(userId) && scope.row.auditStatus == '9'"> <el-button size="mini" type="text" slot="reference">同意</el-button> </el-popconfirm> +<!----> <el-popconfirm title="确定当前操作?" style="margin-left: 10px" - v-if="techerType == '0' && scope.row.zdTeacherList.includes(userId) && scope.row.auditStatus == '9'" + v-if="techerType == '0' && (scope.row.zdTeacherList ) && scope.row.zdTeacherList.includes(userId) && scope.row.auditStatus == '9'" @confirm="submitData(scope.row.registrationInformation,2)"> <el-button size="mini" type="text" slot="reference">拒绝</el-button> </el-popconfirm> @@ -195,7 +192,7 @@ <el-form-item label="联系电话"> <el-input v-model="currentRow.sampleNumber"></el-input> </el-form-item> - <el-form-item label="附件"> + <el-form-item labe l="附件"> <FileUpload :file-type="['doc','zip', 'docx', 'pdf']" v-model="currentRow.uploadFile" ></FileUpload> </el-form-item> </el-form> @@ -225,6 +222,7 @@ import { import { selectBaseInfo, editStatus } from '@/api/cms/baseInfo' import { getHitRegistrationTeachInfoByUserId, selectByUserId } from '@/api/hit/teacherInfo' import { editRegUser } from '@/api/officialWebsite/registerStudent' +import {mapState} from "vuex"; export default { name: "HitRegistrationStudentInfo", @@ -269,7 +267,7 @@ export default { queryParams: { pageNum: 1, pageSize: 10, - year: null, + year: new Date().getFullYear().toString(), competitionName: null, stuName: null, stuGender: null, @@ -321,9 +319,8 @@ export default { }) this.yearList = this.years(); // 获取当前登陆人的id - console.log('当前登陆人id', this.$store); this.userId = this.$store.state.user.id - this.getTeachInfoByIds(this.$store.state.user.id) + this.getTeachInfoByIds(this.userId) }, @@ -331,6 +328,7 @@ export default { /** 查询报名信息列表 */ getList() { this.loading = true; + this.queryParams.year = new Date(this.queryParams.year).getFullYear().toString() listHitRegistrationStudentInfo(this.queryParams).then(response => { this.HitRegistrationStudentInfoList = response.rows; //判断数组是否为空 @@ -339,38 +337,40 @@ export default { } console.log("报名信息", this.HitRegistrationStudentInfoList); //for循环this.HitRegistrationStudentInfoList - for (let i = 0; i < this.HitRegistrationStudentInfoList.length; i++) { - //判断当前登录用户是否为指导老师 - this.HitRegistrationStudentInfoList[i].zdTeacherList =this.HitRegistrationStudentInfoList[i].zdTeacher.map(teacher => teacher.userId) - this.HitRegistrationStudentInfoList[i].registrationInformation= {} - //循环this.registrationInformation - for (let j = 0; j < this.registrationInformation.length; j++) { - if (this.registrationInformation[j].regId == this.HitRegistrationStudentInfoList[i].id){ - this.HitRegistrationStudentInfoList[i].registrationInformation = this.registrationInformation[j] - } - } - this.HitRegistrationStudentInfoList[i].competitionName = "" - //判断this.HitRegistrationStudentInfoList[i].competition不为空 - if (this.HitRegistrationStudentInfoList[i].competition != null) { + if (this.HitRegistrationStudentInfoList.length != 0) { + for (let i = 0; i < this.HitRegistrationStudentInfoList.length; i++) { + //判断当前登录用户是否为指导老师 + this.HitRegistrationStudentInfoList[i].zdTeacherList = this.HitRegistrationStudentInfoList[i].zdTeacher.map(teacher => teacher.userId) + this.HitRegistrationStudentInfoList[i].registrationInformation = {} + //循环this.registrationInformation + if (this.registrationInformation) { + for (let j = 0; j < this.registrationInformation.length; j++) { + if (this.registrationInformation[j].regId == this.HitRegistrationStudentInfoList[i].id) { + this.HitRegistrationStudentInfoList[i].registrationInformation = this.registrationInformation[j] + } + } + this.HitRegistrationStudentInfoList[i].competitionName = "" + //判断this.HitRegistrationStudentInfoList[i].competition不为空 + if (this.HitRegistrationStudentInfoList[i].competition != null) { - const arr = this.splitStringToArray(this.HitRegistrationStudentInfoList[i].competition) - const arr2 = [] - // 循环arr - for (let k = 0; k < arr.length; k++) { - //判断当前登录用户是否是指导老师 - if (arr[k] == "1") { - arr2.push('化验赛') - // this.HitRegistrationStudentInfoList[0].competitionName += "化验赛" - } else if (arr[k] == "2") { - arr2.push('虚拟赛') - // this.HitRegistrationStudentInfoList[0].competitionName += ",虚拟赛" + const arr = this.splitStringToArray(this.HitRegistrationStudentInfoList[i].competition) + const arr2 = [] + // 循环arr + for (let k = 0; k < arr.length; k++) { + //判断当前登录用户是否是指导老师 + if (arr[k] == "1") { + arr2.push('化验赛') + // this.HitRegistrationStudentInfoList[0].competitionName += "化验赛" + } else if (arr[k] == "2") { + arr2.push('虚拟赛') + // this.HitRegistrationStudentInfoList[0].competitionName += ",虚拟赛" + } + } + this.HitRegistrationStudentInfoList[i].competitionName = this.arrayToString(arr2); } } - this.HitRegistrationStudentInfoList[i].competitionName = this.arrayToString(arr2); } } - console.log("this.HitRegistrationStudentInfoList", this.HitRegistrationStudentInfoList) - this.total = response.total; this.loading = false; }); @@ -378,8 +378,12 @@ export default { //查询当前老师的类型 getTeachInfoByIds(id) { getHitRegistrationTeachInfoByUserId(id).then(res => { - console.log('当前老师类型', res.data.type); - this.techerType = res.data.type + if (res.data) { + console.log('当前老师类型', res.data.type); + this.techerType = res.data.type + } + }).catch(err => { + console.log('查询当前老师的类型失败', err); }) this.fetchRegistrationInformation() }, @@ -405,8 +409,10 @@ export default { //查询当前老师的报名信息 fetchRegistrationInformation() { selectByUserId(this.userId).then(res => { - this.registrationInformation = res.data - console.log("这是获取的信息", this.registrationInformation) + if (res.data) { + this.registrationInformation = res.data + console.log("这是获取的信息", this.registrationInformation) + } }) }, // 取消按钮 diff --git a/ruoyi-ui/src/views/hit/stuInfo/index.vue b/ruoyi-ui/src/views/hit/stuInfo/index.vue index d2d19e1..750aa80 100644 --- a/ruoyi-ui/src/views/hit/stuInfo/index.vue +++ b/ruoyi-ui/src/views/hit/stuInfo/index.vue @@ -6,9 +6,30 @@ <el-input v-model="queryParams.stuName" placeholder="请输入学生姓名" clearable @keyup.enter.native="handleQuery" /> </el-form-item> - <el-form-item label="院系名称" prop="collegeName"> + <el-form-item label="学院名称" prop="collegeName"> + <el-input v-model="queryParams.schoolName" placeholder="请输入学院名称" clearable @keyup.enter.native="handleQuery" /> + </el-form-item> + + <el-form-item label="院系名称" prop="schoolName"> <el-input v-model="queryParams.collegeName" placeholder="请输入院系名称" clearable @keyup.enter.native="handleQuery" /> </el-form-item> + <el-form-item label="年份" prop="year"> + <el-date-picker + v-model="queryParams.year" + type="year" + placeholder="选择年份"> + </el-date-picker> + </el-form-item> + <el-form-item label="是否初赛" prop="year"> + <el-select v-model="queryParams.isPreliminary" placeholder="请选择" clearable> + <el-option + v-for="item in options" + :key="item.value" + :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> <el-form-item> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> @@ -234,7 +255,15 @@ export default { studentIdCard: null, trialsScore: null, isPreliminary: null, + year: new Date().getFullYear().toString(), }, + options: [{ + value: 1, + label: '是' + }, { + value: 0, + label: '否' + }], // 表单参数 form: {}, // 表单校验 @@ -293,6 +322,7 @@ export default { /** 查询大赛学生列表 */ getList() { this.loading = true; + this.queryParams.year = new Date(this.queryParams.year).getFullYear().toString() listInfo(this.queryParams).then(response => { this.infoList = response.rows; this.total = response.total; diff --git a/ruoyi-ui/src/views/hit/studentEdit/competitionEdit.vue b/ruoyi-ui/src/views/hit/studentEdit/competitionEdit.vue new file mode 100644 index 0000000..0ae2aab --- /dev/null +++ b/ruoyi-ui/src/views/hit/studentEdit/competitionEdit.vue @@ -0,0 +1,167 @@ +<template> + <div class="app-container"> + <div class="baseInfo"> + <el-form ref="form" :model="form" :rules="rules" label-width="110px"> + <el-form-item label="学号" prop="studentId"> + <el-input v-model="form.studentId" placeholder="请输入名称"/> + </el-form-item> + <el-form-item label="姓名" prop="stuName"> + <el-input v-model="form.stuName" placeholder="请输入名称"/> + </el-form-item> + <el-form-item label="手机号" prop="phoneNumber"> + <el-input v-model="form.phoneNumber" placeholder="手机号"/> + </el-form-item> + <el-form-item label="联系邮箱" prop="email"> + <el-input v-model="form.email" placeholder="请输入联系邮箱"/> + </el-form-item> + <el-form-item label="学校名称" prop="schoolName"> + <el-input v-model="form.schoolName" placeholder="请输入学校名称"/> + </el-form-item> + <el-form-item label="专业" prop="major"> + <el-input v-model="form.major" placeholder="请输入专业"/> + </el-form-item> + <el-form-item label="所属赛区" prop="division"> + <el-select v-model="form.division" filterable allow-create default-first-option + placeholder="请选择学校名称"> + <el-option v-for="item in dict.type.com_region" :key="item.value" :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="学生证" prop="studentIdCard"> + <image-upload :limit="1" v-model="form.studentIdCard"/> + </el-form-item> + </el-form> + + <!-- 成绩展示 --> + <div class="score-display"> + <span>个人选拔赛成绩:</span> + <span class="score" v-if="form.trialsScore">{{ form.trialsScore }}</span> + <span v-else>未出</span> + </div> + + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">确 定</el-button> + </div> + </div> + </div> +</template> + +<script> +import {updateBaseInfo, selectBaseInfo} from "@/api/cms/baseInfo" +import { editCompetitionStudentInfo, queryCompetitionStudentInfo } from '@/api/hit/competitionEdit' +import { getbaseInfo } from '@/api/officialWebsite/getPageData' + +export default { + dicts: ["sys_user_sex", "school_name", "com_region"], + name: "BaseInfo", + data() { + return { + form: {}, + registerStatus: '', + rules: { + stuName: [ + {required: true, message: "名称不能为空", trigger: "blur"} + ], + phoneNumber: [ + {required: true, message: "手机号不能为空", trigger: "blur"} + ], + email: [ + {required: true, message: "邮箱不能为空", trigger: "blur"} + ], + division: [ + {required: true, message: "请选择赛区", trigger: "blur"} + ], + schoolName: [ + {required: true, message: "学校名称不能为空", trigger: "blur"} + ], + major: [ + {required: true, message: "专业不能为空", trigger: "blur"} + ], + studentIdCard: [ + {required: true, message: "学生证不能为空", trigger: "blur"} + ], + studentId: [ + {required: true, message: "学号不能为空", trigger: "blur"} + ] + } + } + }, + created() { + this.getBaseInfo() + }, + methods: { + /** 提交按钮 */ + async submitForm() { + await this.getStatus() + if (!this.registerStatus || this.registerStatus === '0') { + this.$modal.msgError("当前报名截止。无法修改") + return + } + this.$refs["form"].validate(valid => { + if (valid) { + editCompetitionStudentInfo(this.form).then(response => { + this.$modal.msgSuccess("修改成功"); + this.open = false; + this.getList(); + }); + } + }); + }, + // 表单重置 + reset() { + this.form = { + id: null, + webName: null, + contactNumber: null, + contactEmail: null, + address: null, + webImg: null, + recordInfo: null, + copyrightInfo: null + }; + this.resetForm("form"); + }, + getBaseInfo(){ + queryCompetitionStudentInfo().then(res => { + this.form = res.data + this.form.webImg = process.env.VUE_APP_BASE_API + this.form.webImg + }) + }, + async getStatus() { + await getbaseInfo().then(res => { + this.registerStatus = res.data.registerStatus + }) + } + } +} +</script> + +<style scoped lang="scss"> +.app-container { + display: flex; + justify-content: center; +} + +.baseInfo { + width: 40%; + margin-top: 2rem; +} + +.dialog-footer { + width: 100%; + text-align: center; +} + +.score-display { + font-size: 16px; + margin-top: 20px; + color: #333; +} + +.score { + color: red; + font-weight: bold; + font-size: 18px; +} +</style> diff --git a/ruoyi-ui/src/views/officialWebsite/competition.vue b/ruoyi-ui/src/views/officialWebsite/competition.vue index 4ef4d5b..aa215b2 100644 --- a/ruoyi-ui/src/views/officialWebsite/competition.vue +++ b/ruoyi-ui/src/views/officialWebsite/competition.vue @@ -247,7 +247,7 @@ </div> <!-- main --> - <div v-show="currentActive == 0 || currentActive == 1 || currentActive == 5" v-html="pageContext"></div> + <div v-show="currentActive == 0 || currentActive == 1" v-html="pageContext"></div> <div v-show="currentActive == 3 || currentActive == 4" class="wrapbox"> <div class="rsr" v-for="(item, index) in otherList" @click="goDeatail(item)"> @@ -256,7 +256,7 @@ </div> </div> - <div v-show="currentActive == 2" class="wrapbox"> + <div v-show="currentActive == 2 || currentActive == 5 || currentActive == 4" class="wrapbox"> <div class="n-box" v-for="(item, index) in noticeList" @click="goDeatail(item)"> <div> <div class="v-time">{{ item.publishDate }}</div> @@ -269,7 +269,7 @@ </div> </div> - <div v-show="currentActive == 2 || currentActive == 4 || currentActive === 3"> + <div v-show="currentActive == 2 || currentActive == 4 || currentActive === 3 || currentActive == 5"> <page-util :category-id="categoryId" @event-message="handleDataFromPage" /> </div> <div class="anniu" v-show="registerStatus == 1 && currentActive == 0" @click="toRegister"> @@ -550,7 +550,7 @@ export default { this.currentActive = value this.categoryId = "" - if (value === 0 || value === 1 || value === 5) { + if (value === 0 || value === 1) { this.pageContext = "" this.getContentDetail() } else { @@ -587,10 +587,10 @@ export default { }) }, handleDataFromPage(data) { - if (this.currentActive === 3 || this.currentActive == 4) { + if (this.currentActive === 3 ) { this.otherList = data } - if (this.currentActive === 2) { + if (this.currentActive === 2 || this.currentActive == 5 || this.currentActive == 4) { this.noticeList = data } }, diff --git a/ruoyi-ui/src/views/officialWebsite/platform.vue b/ruoyi-ui/src/views/officialWebsite/platform.vue index 2787c59..6a25b6e 100644 --- a/ruoyi-ui/src/views/officialWebsite/platform.vue +++ b/ruoyi-ui/src/views/officialWebsite/platform.vue @@ -25,13 +25,14 @@ <div class="about-conts" v-bind:class="[currentActive == 1 ? 'bj' : '']"> <!-- main --> - <div v-for="(item, index) in nav " :key=index @click="goDeatail(item)"> - <div class="about-conts-item1" v-show="currentActive == 1"> - <div class="neirong" v-html="pageContext"></div> - </div> - </div> - <!-- 专业平台介绍 --> - <div class="ayptjs" v-show="currentActive == 0"> +<!-- <div v-for="(item, index) in nav " :key=index @click="goDeatail(item)">--> +<!-- <div class="about-conts-item1" v-show="currentActive == 1">--> +<!-- <div class="neirong" v-html="pageContext"></div>--> +<!-- </div>--> +<!-- </div>--> +<!-- 专业平台介绍--> +<!-- <div class="ayptjs" v-show="currentActive == 0">--> + <div class="ayptjs"> <div class="ayptjs-list"> <div class="item" v-for="(item, index) in onelist" @click="goDeatail(item)" > @@ -122,13 +123,19 @@ export default { }, // 触发导航 getCurrentActive(value) { + console.log('value',value) if (this.currentActive == value) { return } this.currentActive = value - if (value === 1){ - this.getContentDetail(); - } + // if (value === 1){ + // this.getContentDetail(); + // } + this.categoryId = this.nav[this.currentActive].id + // getCategoryByParentId(this.routeParam.categoryId).then(res => { + // this.nav = res.data + // this.categoryId = res.data[0].id + // }) }, getContentDetail() { this.routeParam.categoryId = this.nav[this.currentActive].id diff --git a/ruoyi-ui/src/views/officialWebsite/teaching.vue b/ruoyi-ui/src/views/officialWebsite/teaching.vue index 7eecc6e..69fa63e 100644 --- a/ruoyi-ui/src/views/officialWebsite/teaching.vue +++ b/ruoyi-ui/src/views/officialWebsite/teaching.vue @@ -164,7 +164,11 @@ export default { initPageData() { getCategoryByParentId(this.routeParam.categoryId).then(res => { this.nav = res.data - this.categoryId = this.nav[0].id + if (this.nav.length > 0) { + this.categoryId = this.nav[0].id + }else { + this.categoryId = this.$route.query.id + } }) }, }