From 8b4a0d0009c61a07a353a2c3f72cccc0e5966277 Mon Sep 17 00:00:00 2001 From: xiao-fajia <1665375861@qq.com> Date: Sat, 27 Jul 2024 18:02:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8A=A5=E5=90=8D=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/cms/api/HitCompetitionAPI.java | 41 +++++++++ .../api/HitRegistrationStudentInfoAPI.java | 69 ++++++++++++++ .../HitRegistrationStudentInfoController.java | 66 +++++++++++--- .../com/ruoyi/cms/domain/HitCompetition.java | 2 +- .../vo/HitRegistrationStudentInfoVo.java | 72 +++++++++++++++ .../HitRegistrationStudentInfoExport.java | 51 +++++++++++ .../HitRegistrationStudentInfoMapper.java | 8 ++ .../HitRegistrationTeachInfoMapper.java | 7 ++ .../IHitRegistrationStudentInfoService.java | 9 ++ .../IHitRegistrationTeachInfoService.java | 7 ++ .../service/impl/CmsContentServiceImpl.java | 2 + ...HitRegistrationStudentInfoServiceImpl.java | 13 +++ .../HitRegistrationTeachInfoServiceImpl.java | 11 +++ .../mapper/cms/CmsCategoryMapper.xml | 1 + .../cms/HitRegistrationStudentInfoMapper.xml | 70 +++++++++++++++ .../cms/HitRegistrationTeachInfoMapper.xml | 5 ++ .../src/api/hit/registrationStudentInfo.js | 8 ++ .../src/views/cms/content/contentList.vue | 12 ++- ruoyi-ui/src/views/cms/editor/index.vue | 3 - .../hit/registrationStudentInfo/index.vue | 90 ++++++++++++++++--- 20 files changed, 520 insertions(+), 27 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/cms/api/HitCompetitionAPI.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/cms/api/HitRegistrationStudentInfoAPI.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/cms/domain/vo/HitRegistrationStudentInfoVo.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/cms/export/HitRegistrationStudentInfoExport.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/api/HitCompetitionAPI.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/api/HitCompetitionAPI.java new file mode 100644 index 0000000..c9b1366 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/api/HitCompetitionAPI.java @@ -0,0 +1,41 @@ +package com.ruoyi.cms.api; + +import com.ruoyi.cms.domain.HitCompetition; +import com.ruoyi.cms.service.IHitCompetitionService; +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 大赛信息Controller + * + * @author 点亮信息 + * @date 2024-07-26 + */ +@Anonymous +@RestController +@RequestMapping("/api/competition") +public class HitCompetitionAPI extends BaseController +{ + + @Autowired + private IHitCompetitionService competitionService; + /** + * 查询所有比赛 + */ + @GetMapping("/list") + public AjaxResult getCompetition(HitCompetition competition){ + startPage(); + return success(competitionService.selectHitCompetitionList(competition)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/api/HitRegistrationStudentInfoAPI.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/api/HitRegistrationStudentInfoAPI.java new file mode 100644 index 0000000..b261e06 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/api/HitRegistrationStudentInfoAPI.java @@ -0,0 +1,69 @@ +package com.ruoyi.cms.api; + +import cn.hutool.core.bean.BeanUtil; +import com.ruoyi.cms.domain.HitRegistrationStudentInfo; +import com.ruoyi.cms.domain.HitRegistrationTeachInfo; +import com.ruoyi.cms.domain.vo.HitRegistrationStudentInfoVo; +import com.ruoyi.cms.export.HitRegistrationStudentInfoExport; +import com.ruoyi.cms.service.IHitRegistrationStudentInfoService; +import com.ruoyi.cms.service.IHitRegistrationTeachInfoService; +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 报名信息Controller + * + * @author 点亮信息 + * @date 2024-07-26 + */ +@Anonymous +@RestController +@RequestMapping("/api/registerStudent") +public class HitRegistrationStudentInfoAPI extends BaseController +{ + @Autowired + private IHitRegistrationStudentInfoService hitRegistrationStudentInfoService; + + @Autowired + private IHitRegistrationTeachInfoService hitRegistrationTeachInfoService; + + /** + * 报名接口 + * @param studentInfo + * @return + */ + @PostMapping() + public AjaxResult register(@RequestBody HitRegistrationStudentInfo studentInfo){ + return toAjax(hitRegistrationStudentInfoService.insertHitRegistrationStudentInfo(studentInfo)); + } + + /** + * 老师信息验证或插入 + * @param teachInfo + * @return + */ + @PostMapping("/addTeach") + public AjaxResult addTeach(@RequestBody HitRegistrationTeachInfo teachInfo){ + Long id = hitRegistrationTeachInfoService.checkExist(teachInfo); + if (id != null){ + return success(id); + }else { + int flag = hitRegistrationTeachInfoService.insertHitRegistrationTeachInfo(teachInfo); + if (flag > 0) return success(teachInfo.getId()); + else return error(); + } + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitRegistrationStudentInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitRegistrationStudentInfoController.java index b695f78..83fa852 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitRegistrationStudentInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/HitRegistrationStudentInfoController.java @@ -1,7 +1,15 @@ package com.ruoyi.cms.controller; +import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.bean.BeanUtil; +import com.ruoyi.cms.domain.vo.HitRegistrationStudentInfoVo; +import com.ruoyi.cms.export.HitRegistrationStudentInfoExport; +import com.ruoyi.cms.service.IHitRegistrationTeachInfoService; +import org.apache.ibatis.annotations.Param; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -34,17 +42,20 @@ public class HitRegistrationStudentInfoController extends BaseController @Autowired private IHitRegistrationStudentInfoService hitRegistrationStudentInfoService; + @Autowired + private IHitRegistrationTeachInfoService hitRegistrationTeachInfoService; + /** * 查询报名信息列表 */ - @PreAuthorize("@ss.hasPermi('hit:hitRegistrationStudentInfo:list')") - @GetMapping("/list") - public TableDataInfo list(HitRegistrationStudentInfo hitRegistrationStudentInfo) - { - startPage(); - List list = hitRegistrationStudentInfoService.selectHitRegistrationStudentInfoList(hitRegistrationStudentInfo); - return getDataTable(list); - } +// @PreAuthorize("@ss.hasPermi('hit:hitRegistrationStudentInfo:list')") +// @GetMapping("/list") +// public TableDataInfo list(HitRegistrationStudentInfo hitRegistrationStudentInfo) +// { +// startPage(); +// List list = hitRegistrationStudentInfoService.selectHitRegistrationStudentInfoList(hitRegistrationStudentInfo); +// return getDataTable(list); +// } /** * 导出报名信息列表 @@ -52,11 +63,20 @@ public class HitRegistrationStudentInfoController extends BaseController @PreAuthorize("@ss.hasPermi('hit:hitRegistrationStudentInfo:export')") @Log(title = "报名信息", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, HitRegistrationStudentInfo hitRegistrationStudentInfo) + public void export(HttpServletResponse response, HitRegistrationStudentInfoVo studentInfoVo) { - List list = hitRegistrationStudentInfoService.selectHitRegistrationStudentInfoList(hitRegistrationStudentInfo); - ExcelUtil util = new ExcelUtil(HitRegistrationStudentInfo.class); - util.exportExcel(response, list, "报名信息数据"); + List list = hitRegistrationStudentInfoService.selectStudentInfoNew(studentInfoVo); + + /** 转换为excel要的字段 */ + List result = list.stream().map(item -> { + HitRegistrationStudentInfoExport export = new HitRegistrationStudentInfoExport(); + BeanUtil.copyProperties(item, export); + export.setLeaderNames(String.join(",", item.getLeaderNames())); + export.setGuideNames(String.join(",", item.getGuideNames())); + return export; + }).collect(Collectors.toList()); + ExcelUtil util = new ExcelUtil(HitRegistrationStudentInfoExport.class); + util.exportExcel(response, result, "报名信息数据"); } /** @@ -101,4 +121,26 @@ public class HitRegistrationStudentInfoController extends BaseController { return toAjax(hitRegistrationStudentInfoService.deleteHitRegistrationStudentInfoByIds(ids)); } + + /** + * 自定义查询 + * @param studentInfoVo + * @return + */ + @PreAuthorize("@ss.hasPermi('hit:hitRegistrationStudentInfo:list')") + @GetMapping("/list") + public TableDataInfo list(HitRegistrationStudentInfoVo studentInfoVo) + { + startPage(); + List list = hitRegistrationStudentInfoService.selectStudentInfoNew(studentInfoVo); + return getDataTable(list); + } + + /** + * 查询老师信息 + */ + @GetMapping("/getTeach/{ids}") + public AjaxResult getTeachInfo(@PathVariable Long[] ids){ + return success(hitRegistrationTeachInfoService.listByIds(Arrays.asList(ids))); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/HitCompetition.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/HitCompetition.java index c546586..8e8abeb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/HitCompetition.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/HitCompetition.java @@ -46,7 +46,7 @@ public class HitCompetition extends BaseEntity private Date regEndTime; /** 大赛类型("0":团队赛,"1":个人赛,默认"0") */ - @Excel(name = "大赛类型", readConverterExp = "0:团队赛,1:个人赛,默认0") + @Excel(name = "大赛类型", readConverterExp = "0=团队赛,1=个人赛") private String competitionType; /** 逻辑删除0未删除1真删除 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/vo/HitRegistrationStudentInfoVo.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/vo/HitRegistrationStudentInfoVo.java new file mode 100644 index 0000000..30e94d0 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/vo/HitRegistrationStudentInfoVo.java @@ -0,0 +1,72 @@ +package com.ruoyi.cms.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; + +import java.util.List; + +@Data +public class HitRegistrationStudentInfoVo extends BaseEntity { + /** 报名信息ID */ + private Long id; + + /** 大赛ID */ + private Long competitionId; + + /** 学生姓名 */ + @Excel(name = "学生姓名") + private String stuName; + + /** 学生性别(0:男,1:女) */ + @Excel(name = "学生性别", readConverterExp = "0=男,1=女") + private String stuGender; + + /** 学生专业 */ + @Excel(name = "学生专业") + private String stuMajor; + + /** 学生手机号 */ + @Excel(name = "学生手机号") + private String stuNumber; + + /** 学校及院系名称 */ + @Excel(name = "学校及院系名称") + private String schoolName; + + /** 所属赛区 */ + @Excel(name = "所属赛区") + private String division; + + /** 团队名称(个人赛不需求,可以为空) */ + @Excel(name = "团队名称") + private String teamName; + + /** 领队教师ID集合 */ + private List leaderIds; + + /** 指导老师ID集合 */ + private List guideIds; + + /** 老师名字 查询用 */ + private String teachName; + + /** 逻辑删除0未删除1真删除 */ + private Integer delFlag; + + /** 大赛名称 */ + @Excel(name = "大赛名称") + private String competitionName; + + /** 大赛类型("0":团队赛,"1":个人赛,默认"0") */ + @Excel(name = "大赛类型", readConverterExp = "0=团队赛,1=个人赛") + private String competitionType; + + /** 带队老师姓名集合 */ + @Excel(name = "领队老师") + private List leaderNames; + + /** 指导老师姓名集合 */ + @Excel(name = "指导老师") + private List guideNames; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/export/HitRegistrationStudentInfoExport.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/export/HitRegistrationStudentInfoExport.java new file mode 100644 index 0000000..cc216a0 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/export/HitRegistrationStudentInfoExport.java @@ -0,0 +1,51 @@ +package com.ruoyi.cms.export; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +@Data +public class HitRegistrationStudentInfoExport{ + /** 学生姓名 */ + @Excel(name = "学生姓名") + private String stuName; + + /** 学生性别(0:男,1:女) */ + @Excel(name = "学生性别", readConverterExp = "0=男,1=女") + private String stuGender; + + /** 学生专业 */ + @Excel(name = "学生专业") + private String stuMajor; + + /** 学生手机号 */ + @Excel(name = "学生手机号") + private String stuNumber; + + /** 学校及院系名称 */ + @Excel(name = "学校及院系名称") + private String schoolName; + + /** 所属赛区 */ + @Excel(name = "所属赛区") + private String division; + + /** 团队名称(个人赛不需求,可以为空) */ + @Excel(name = "团队名称") + private String teamName; + + /** 大赛名称 */ + @Excel(name = "大赛名称") + private String competitionName; + + /** 大赛类型("0":团队赛,"1":个人赛,默认"0") */ + @Excel(name = "大赛类型", readConverterExp = "0=团队赛,1=个人赛") + private String competitionType; + + /** 带队老师姓名集合 */ + @Excel(name = "领队老师") + private String leaderNames; + + /** 指导老师姓名集合 */ + @Excel(name = "指导老师") + private String guideNames; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/mapper/HitRegistrationStudentInfoMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/mapper/HitRegistrationStudentInfoMapper.java index 05dbf5c..b176c98 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/mapper/HitRegistrationStudentInfoMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/mapper/HitRegistrationStudentInfoMapper.java @@ -5,6 +5,7 @@ import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.cms.domain.HitRegistrationStudentInfo; import com.ruoyi.cms.domain.HitRegistrationTeachInfo; +import com.ruoyi.cms.domain.vo.HitRegistrationStudentInfoVo; /** * 报名信息Mapper接口 @@ -61,4 +62,11 @@ public interface HitRegistrationStudentInfoMapper extends BaseMapper selectStudentInfoNew(HitRegistrationStudentInfoVo studentInfoVo); } 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 8f4d39f..7d004d5 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 @@ -61,4 +61,11 @@ public interface HitRegistrationTeachInfoMapper extends BaseMapper selectStudentInfoNew(HitRegistrationStudentInfoVo studentInfoVo); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/IHitRegistrationTeachInfoService.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/IHitRegistrationTeachInfoService.java index 054fd8b..25e7501 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/IHitRegistrationTeachInfoService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/IHitRegistrationTeachInfoService.java @@ -60,4 +60,11 @@ public interface IHitRegistrationTeachInfoService extends IService selectStudentInfoNew(HitRegistrationStudentInfoVo studentInfoVo){ + return baseMapper.selectStudentInfoNew(studentInfoVo); + } } 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 7c08ae2..f2f1058 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 @@ -3,6 +3,7 @@ package com.ruoyi.cms.service.impl; import java.util.List; import cn.hutool.core.lang.Snowflake; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.utils.DateUtils; @@ -98,4 +99,14 @@ public class HitRegistrationTeachInfoServiceImpl extends ServiceImpl and parent_id = #{parentId} and is_frame = #{isFrame} and is_disable = #{isDisable} + and del_flag = 0 order by parent_id, category_sort diff --git a/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationStudentInfoMapper.xml b/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationStudentInfoMapper.xml index 41c6596..904704f 100644 --- a/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationStudentInfoMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationStudentInfoMapper.xml @@ -124,4 +124,74 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + + select + id, competition_id, stu_name, stu_gender, stu_major, stu_number, school_name, division, team_name, leader_ids, guide_ids, remark,del_flag, create_time, create_by, update_time, update_by,competition_name, competition_type, leader_names, guide_names + from + (SELECT + s.id, s.competition_id, s.stu_name, s.stu_gender, s.stu_major, s.stu_number, s.school_name, s.division, s.team_name, s.leader_ids, s.guide_ids, s.remark, s.del_flag, s.create_time, s.create_by, s.update_time, s.update_by,c.competition_name, c.competition_type, + CONCAT('[', + GROUP_CONCAT(JSON_QUOTE(t.teacher_name) ORDER BY t.teacher_name SEPARATOR ','), + ']') AS leader_names + FROM + hit_registration_student_info s + LEFT JOIN + hit_registration_teach_info t ON JSON_CONTAINS(s.leader_ids, CAST(t.id AS JSON), '$') + LEFT JOIN + hit_competition c on c.id = s.competition_id + GROUP BY + s.id) as t1, + (SELECT + s.id AS student_id, + CONCAT('[', + GROUP_CONCAT(JSON_QUOTE(t.teacher_name) ORDER BY t.teacher_name SEPARATOR ','), + ']') AS guide_names + FROM + hit_registration_student_info s + LEFT JOIN + hit_registration_teach_info t ON JSON_CONTAINS(s.guide_ids, CAST(t.id AS JSON), '$') + GROUP BY + s.id) as t2 + where t1.id = t2.student_id + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationTeachInfoMapper.xml b/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationTeachInfoMapper.xml index eef5af6..a67b593 100644 --- a/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationTeachInfoMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/cms/HitRegistrationTeachInfoMapper.xml @@ -89,6 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + delete from hit_registration_teach_info where id = #{id} @@ -99,4 +100,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + \ No newline at end of file diff --git a/ruoyi-ui/src/api/hit/registrationStudentInfo.js b/ruoyi-ui/src/api/hit/registrationStudentInfo.js index acea724..174ed60 100644 --- a/ruoyi-ui/src/api/hit/registrationStudentInfo.js +++ b/ruoyi-ui/src/api/hit/registrationStudentInfo.js @@ -42,3 +42,11 @@ export function delHitRegistrationStudentInfo(id) { method: 'delete' }) } + +//获取老师信息 +export function getTeachInfoByIds(ids){ + return request({ + url: '/hit/hitRegistrationStudentInfo/getTeach/' + ids, + method: "get", + }) +} diff --git a/ruoyi-ui/src/views/cms/content/contentList.vue b/ruoyi-ui/src/views/cms/content/contentList.vue index 107e2b2..c96c071 100644 --- a/ruoyi-ui/src/views/cms/content/contentList.vue +++ b/ruoyi-ui/src/views/cms/content/contentList.vue @@ -110,7 +110,17 @@ + + + + + + - + - + + + + - + - + - - + +