diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitRegInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitRegInfoController.java index 4582bc0..3d45c27 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitRegInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitRegInfoController.java @@ -47,6 +47,17 @@ public class HitRegInfoController extends BaseController List list = hitRegInfoService.selectHitRegInfoList(hitRegInfo); return getDataTable(list); } + /** + * 学生查询报名信息列表 + */ + + @GetMapping("/studentList") + public TableDataInfo studentList(HitRegInfo hitRegInfo) + { + + List list = hitRegInfoService.selectStudentHitRegInfoList(hitRegInfo); + return getDataTable(list); + } /** * 导出报名信息列表 @@ -92,6 +103,16 @@ public class HitRegInfoController extends BaseController { return toAjax(hitRegInfoService.updateHitRegInfo(hitRegInfo)); } + /** + * 修改报名信息 + */ + + @Log(title = "报名信息", businessType = BusinessType.UPDATE) + @PutMapping("/studentEdit") + public AjaxResult studentEdit(@RequestBody HitRegInfo hitRegInfo) + { + return toAjax(hitRegInfoService.studentEdit(hitRegInfo)); + } /** * 修改报名信息 */ 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 66c3992..88c1741 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 @@ -42,7 +42,7 @@ public class HitRegInfo extends BaseEntity /** 赛事 */ @ApiModelProperty(value = "赛事") - @TableField(exist = false) +// @TableField(exist = false) private String competition; /** 团队名称(个人赛不需求,可以为空) */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/IHitRegInfoService.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/IHitRegInfoService.java index 0b3bf07..e80fe4f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/IHitRegInfoService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/IHitRegInfoService.java @@ -66,4 +66,7 @@ public interface IHitRegInfoService HitRegInfo selectHitByUserId2(Long userId); + List selectStudentHitRegInfoList(HitRegInfo hitRegInfo); + + int studentEdit(HitRegInfo hitRegInfo); } 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 f2f3890..72f51ff 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 @@ -7,6 +7,7 @@ import java.util.Calendar; import java.util.List; import java.util.stream.Collectors; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; @@ -55,6 +56,9 @@ public class HitRegInfoServiceImpl implements IHitRegInfoService @Autowired private HitCompetitionStudentInfoMapper hitCompetitionStudentInfoMapper; + @Autowired + private HitRegInfoUserMapper hitRegInfoUserMapper; + /** * 查询报名信息 @@ -334,6 +338,81 @@ public class HitRegInfoServiceImpl implements IHitRegInfoService return hitRegInfo; } + @Override + public List selectStudentHitRegInfoList(HitRegInfo hitRegInfo) { + Long userId = SecurityUtils.getLoginUser().getUserId(); + //判断当前登陆人是否是领队老师,如果是查询该老师学校下的战队 + //查询当前学生所在的战队信息 + HitRegInfoUser hitRegInfoUser1 = hitRegInfoUserMapper.selectOne(new LambdaQueryWrapper() + .eq(HitRegInfoUser::getUserId, userId) + .last("limit 1")); + if (ObjectUtils.isEmpty(hitRegInfoUser1)) { + throw new RuntimeException("您并未参加战队"); + } + + HitRegInfo hitRegInfo1 = hitRegInfoMapper.selectOne(new LambdaQueryWrapper() + .eq(HitRegInfo::getId, hitRegInfoUser1.getRegId()) + .last("limit 1")); + //判断当前登陆人是否是领队老师,如果是查询该老师学校下的战队 + HitRegistrationTeachInfo teacherInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(userId); + if (teacherInfo != null && teacherInfo.getType().equals("1")) { + hitRegInfo.setSchoolName(teacherInfo.getSchoolName()); + } + PageUtils.startPage(); +// List hitRegInfos = hitRegInfoMapper.selectHitRegInfoList(hitRegInfo); + List hitRegInfos = hitRegInfoMapper.selectList(new LambdaQueryWrapper() + .eq(HitRegInfo::getId, hitRegInfoUser1.getRegId())); + for (HitRegInfo regInfo : hitRegInfos) { + HitRegInfoUser hitRegInfoUser =new HitRegInfoUser(); + hitRegInfoUser.setRegId(regInfo.getId()); + List hitRegInfoUsers = regInfoUserService.selectHitRegInfoUserList(hitRegInfoUser); + for (HitRegInfoUser regInfoUser : hitRegInfoUsers) { + switch (regInfoUser.getType()) { + case "3": { + HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId()); + regInfo.setLdTeacher(hitRegistrationTeachInfo); + break; + } + case "2": { + HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId()); + regInfo.getZdTeacher().add(hitRegistrationTeachInfo); + break; + } + case "1": + HitCompetitionStudentInfo studentInfo = hitCompetitionStudentInfoMapper.selectHitCompetitionStudentInfoByUserId(regInfoUser.getUserId()); + regInfo.getStudentUserss().add(studentInfo); + break; + } + } + + } + return hitRegInfos; + } + + @Override + public int studentEdit(HitRegInfo hitRegInfo) { + HitRegInfo hitRegInfo1 = new HitRegInfo(); + hitRegInfo1.setId(hitRegInfo.getId()); + if (ObjectUtil.isNotEmpty(hitRegInfo.getCompetition())) { + hitRegInfo1.setCompetition(hitRegInfo.getCompetition()); + } + if (ObjectUtil.isNotEmpty(hitRegInfo.getSampleNumber())) { + hitRegInfo1.setSampleNumber(hitRegInfo.getSampleNumber()); + } + hitRegInfo1.setSampleAddress(hitRegInfo.getSampleAddress()); + //判断hitRegInfo.getCompetition()是否包含1 + if (!hitRegInfo.getCompetition().contains("1")) { + hitRegInfo1.setSampleAddress(""); + } + + if (ObjectUtil.isNotEmpty(hitRegInfo.getSampleConcat())) { + hitRegInfo1.setSampleConcat(hitRegInfo.getSampleConcat()); + } + int i = hitRegInfoMapper.updateById(hitRegInfo1); + + return i; + } + /** * 更新队员信息 * @param teamId diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitTeamsServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitTeamsServiceImpl.java index f925836..aac3921 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitTeamsServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/HitTeamsServiceImpl.java @@ -15,6 +15,8 @@ import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.system.service.ISysUserService; import org.apache.commons.lang3.ObjectUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -33,6 +35,8 @@ import java.util.Date; */ @Service public class HitTeamsServiceImpl extends ServiceImpl implements IHitTeamsService { + private static final Logger log = LoggerFactory.getLogger(HitTeamsServiceImpl.class); + @Autowired private HitCompetitionStudentInfoMapper hitCompetitionStudentInfoMapper; @@ -84,6 +88,7 @@ public class HitTeamsServiceImpl extends ServiceImpl i hitRegInfo.setUploadFile(preliminary.getUploadFile()); hitRegInfo.setAuditStatus("9"); hitRegInfo.setCreateTime(new Date()); + log.info("插入数据:"+hitRegInfo); hitRegInfo.setCompetition(preliminary.getCompetition()); int insert = hitRegInfoMapper.insert(hitRegInfo); //插入人员信息 diff --git a/ruoyi-admin/src/main/resources/mapper/cms/HitRegInfoMapper.xml b/ruoyi-admin/src/main/resources/mapper/cms/HitRegInfoMapper.xml index 01b18ef..e041a2e 100644 --- a/ruoyi-admin/src/main/resources/mapper/cms/HitRegInfoMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/cms/HitRegInfoMapper.xml @@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, school_name, college_name, division, team_name, sample_concat, sample_number,audit_status, sample_address, remark, upload_file,ds_file, del_flag, create_time, create_by, update_time, update_by from hit_reg_info + select id, school_name, college_name, division, team_name, sample_concat, sample_number,audit_status, sample_address, remark, upload_file,ds_file, del_flag, create_time, create_by, update_time, update_by,competition from hit_reg_info