dzx 4 mesiacov pred
rodič
commit
0d8c436d4a

+ 10 - 3
src/main/java/com/xjrsoft/module/xycxedu/controller/ExamPlanController.java

@@ -3,14 +3,15 @@ package com.xjrsoft.module.xycxedu.controller;
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.base.entity.BaseSemester;
 import com.xjrsoft.module.xycxedu.dto.AddExamPlanDto;
 import com.xjrsoft.module.xycxedu.dto.ExamPlanPageDto;
 import com.xjrsoft.module.xycxedu.dto.ExamStatisticsPageDto;
@@ -40,6 +41,7 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.validation.Valid;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Set;
 import java.util.stream.Collectors;
 
 /**
@@ -63,10 +65,13 @@ public class ExamPlanController {
     @SaCheckPermission("examplan:detail")
     public RT<PageOutput<ExamPlanPageVo>> page(@Valid ExamPlanPageDto dto){
 
-        LambdaQueryWrapper<ExamPlan> queryWrapper = new LambdaQueryWrapper<>();
+        MPJLambdaWrapper<ExamPlan> queryWrapper = new MPJLambdaWrapper<>();
         queryWrapper.orderByDesc(ExamPlan::getId)
                 .eq(dto.getSemesterId() != null, ExamPlan::getSemesterId, dto.getSemesterId())
                 .like(StrUtil.isNotEmpty(dto.getName()), ExamPlan::getName, dto.getName())
+                .leftJoin(BaseSemester.class, BaseSemester::getId, ExamPlan::getSemesterId)
+                .select(ExamPlan::getId)
+                .selectAs(BaseSemester::getName, ExamPlanPageVo::getSemesterName)
                 .select(ExamPlan.class,x -> VoToColumnUtil.fieldsToColumns(ExamPlanPageVo.class).contains(x.getProperty()));
         IPage<ExamPlan> page = examPlanService.page(ConventPage.getPage(dto), queryWrapper);
         PageOutput<ExamPlanPageVo> pageOutput = ConventPage.getPageOutput(page, ExamPlanPageVo.class);
@@ -75,7 +80,9 @@ public class ExamPlanController {
             List<Long> milexamids = Arrays.asList(split).stream()
                     .map(Long::parseLong)
                     .collect(Collectors.toList());
-            examListService.list(new QueryWrapper<XycxeduExamList>().lambda().in(XycxeduExamList::getMilexamid, milexamids));
+            List<XycxeduExamList> list = examListService.list(new QueryWrapper<XycxeduExamList>().lambda().in(XycxeduExamList::getMilexamid, milexamids));
+            Set<String> collect = list.stream().map(XycxeduExamList::getMilexamname).collect(Collectors.toSet());
+            record.setMilexamnames(collect.toString().replace("[", "").replace("]", ""));
         }
         return RT.ok(pageOutput);
     }

+ 1 - 0
src/main/java/com/xjrsoft/module/xycxedu/util/DataUtil.java

@@ -114,6 +114,7 @@ public class DataUtil {
                     setScore(scoreObj.get("score").getAsInt());
                     setMilexamid(examidXMilexamidMap.get(examid).longValue());
                     setGradeRanking(scoreObj.get("gradeorder").getAsInt());
+                    setClassRanking(scoreObj.get("classorder").getAsInt());
                     setCoursename(examidXCoursenameMap.get(examid));
                     setCourseSubjectId(courseMap.get(examidXCoursenameMap.get(examid)));
                     setCreateDate(date);

+ 3 - 0
src/main/java/com/xjrsoft/module/xycxedu/vo/ExamPlanPageVo.java

@@ -79,6 +79,9 @@ public class ExamPlanPageVo {
     @ExcelProperty("学期id")
     @ApiModelProperty("学期id")
     private Long semesterId;
+
+    @ApiModelProperty("学期名称")
+    private String semesterName;
     /**
     * 考试计划名称
     */

+ 43 - 18
src/main/resources/sqlScript/20240718_sql.sql

@@ -284,10 +284,10 @@ CREATE TABLE `exam_plan` (
 
 
 -- --------------------------------------------------------------------------------------------
--- 赛事活动
+-- 活动信息
 -- --------------------------------------------------------------------------------------------
-DROP TABLE IF EXISTS match_activity;   
-CREATE TABLE `match_activity` (
+DROP TABLE IF EXISTS activity_info;   
+CREATE TABLE `activity_info` (
   `id` BIGINT NOT NULL,
   `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
   `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
@@ -297,17 +297,46 @@ CREATE TABLE `match_activity` (
   `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
   `name` VARCHAR(50) DEFAULT NULL COMMENT '赛事名称',
   place VARCHAR(50) DEFAULT NULL COMMENT '活动地点',
-  start_date DATETIME DEFAULT NULL COMMENT '开始时间',
-  end_date DATETIME DEFAULT NULL COMMENT '结束时间',
-  TYPE VARCHAR(50) DEFAULT NULL COMMENT '活动类型',
+  start_date DATETIME DEFAULT NULL COMMENT '活动开始时间',
+  end_date DATETIME DEFAULT NULL COMMENT '活动结束时间',
+  `type` VARCHAR(50) DEFAULT NULL COMMENT '活动类型(xjr_dictionary_detail[match_activity_type])',
   org_id BIGINT DEFAULT NULL COMMENT '组织部门(xjr_department)',
-  STATUS INT DEFAULT 0 COMMENT '状态(0:未发布 1:已发布)',
+  `enroll_end_time` DATETIME DEFAULT NULL COMMENT '报名结束时间',
+  `duty_person` VARCHAR(50) DEFAULT NULL COMMENT '活动负责人',
+  `duty_person_mobile` VARCHAR(50) DEFAULT NULL COMMENT '活动负责人电话',
+  `cover_file_id` VARCHAR(50) DEFAULT NULL COMMENT '封面图片',
+  `enroll_range` LONGTEXT DEFAULT NULL COMMENT '报名范围',
+  STATUS INT DEFAULT 0 COMMENT '状态(0:未发布 1:报名中 2:报名结束 3:活动结束)',
+  `content` LONGTEXT DEFAULT NULL COMMENT '活动内容',
+  enterprise_id BIGINT DEFAULT NULL COMMENT '合作企业',
+  category INT DEFAULT NULL COMMENT '1:校企合作活动 2:赛事活动',
   PRIMARY KEY (`id`)
-) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='赛事活动';
+) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动信息';
 
+-- --------------------------------------------------------------------------------------------
+-- 活动报名范围
+-- --------------------------------------------------------------------------------------------
+DROP TABLE IF EXISTS activity_enroll_range;
+CREATE TABLE `activity_enroll_range` (
+  `id` BIGINT NOT NULL,
+  `create_user_id` BIGINT DEFAULT NULL,
+  `create_date` DATETIME(3) DEFAULT NULL,
+  `modify_user_id` BIGINT DEFAULT NULL,
+  `modify_date` DATETIME(3) DEFAULT NULL,
+  `delete_mark` INT DEFAULT NULL,
+  `enabled_mark` INT DEFAULT NULL,
+  `class_id` BIGINT DEFAULT NULL COMMENT '所属班级id',
+  `dept_id` BIGINT DEFAULT NULL COMMENT '所属部门id',
+  `user_id` BIGINT DEFAULT NULL COMMENT '用id',
+  activity_info_id BIGINT DEFAULT NULL COMMENT '活动(activity)',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动报名范围';
 
-DROP TABLE IF EXISTS match_activity_enroll;   
-CREATE TABLE `match_activity` (
+-- --------------------------------------------------------------------------------------------
+-- 活动登记表
+-- --------------------------------------------------------------------------------------------
+DROP TABLE IF EXISTS activity_enroll;   
+CREATE TABLE `activity_enroll` (
   `id` BIGINT NOT NULL,
   `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
   `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
@@ -315,12 +344,8 @@ CREATE TABLE `match_activity` (
   `modify_date` DATETIME DEFAULT NULL COMMENT '修改日期',
   `delete_mark` INT DEFAULT NULL COMMENT '删除标记',
   `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
-  `name` VARCHAR(50) DEFAULT NULL COMMENT '赛事名称',
-  place VARCHAR(50) DEFAULT NULL COMMENT '活动地点',
-  start_date DATETIME DEFAULT NULL COMMENT '开始时间',
-  end_date DATETIME DEFAULT NULL COMMENT '结束时间',
-  TYPE VARCHAR(50) DEFAULT NULL COMMENT '活动类型',
-  org_id BIGINT DEFAULT NULL COMMENT '组织部门(xjr_department)',
-  STATUS INT DEFAULT 0 COMMENT '状态(0:未发布 1:已发布)',
+  activity_info_id BIGINT DEFAULT NULL COMMENT '活动(activity_info)',
+  user_id DATETIME DEFAULT NULL COMMENT '参与人(xjr_user)',
+  STATUS INT DEFAULT 0 COMMENT '状态(0:待确认 1:未参与 2:已参与)',
   PRIMARY KEY (`id`)
-) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='赛事活动';
+) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动登记表';

+ 43 - 0
src/test/java/com/xjrsoft/xjrsoftboot/FreeMarkerGeneratorTest.java

@@ -3455,4 +3455,47 @@ public class FreeMarkerGeneratorTest {
 
         apiGeneratorService.generateCodes(params);
     }
+
+    @Test
+    public void gcMatchActivity() throws IOException {
+        List<TableConfig> tableConfigs = new ArrayList<>();
+        TableConfig mainTable = new TableConfig();
+        mainTable.setTableName("activity_info");//init_sql中的表名
+        mainTable.setIsMain(true);//是否是主表,一般默认为true
+        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
+        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
+        tableConfigs.add(mainTable);
+
+        mainTable = new TableConfig();
+        mainTable.setTableName("activity_enroll_range");//init_sql中的表名
+        mainTable.setIsMain(false);//是否是主表,一般默认为true
+        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
+        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
+        mainTable.setRelationField("activity_info_id");//设置外键
+        mainTable.setRelationTableField(GlobalConstant.DEFAULT_PK);//设置外键
+        tableConfigs.add(mainTable);
+
+        mainTable = new TableConfig();
+        mainTable.setTableName("activity_enroll");//init_sql中的表名
+        mainTable.setIsMain(false);//是否是主表,一般默认为true
+        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
+        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
+        mainTable.setRelationField("activity_info_id");//设置外键
+        mainTable.setRelationTableField(GlobalConstant.DEFAULT_PK);//设置外键
+        tableConfigs.add(mainTable);
+
+        ApiGenerateCodesDto params = new ApiGenerateCodesDto();
+        params.setAuthor("dzx");//作者名称
+        params.setPackageName("activity");//包名
+        params.setTableConfigs(tableConfigs);
+        params.setPage(true);//是否生成分页接口
+        params.setImport(false);//是否生成导入接口
+        params.setExport(false);//是否生成导出接口
+        params.setOutMainDir(true);//是否生成在主目录,前期测试可设置成false
+        params.setDs(ds);
+
+        IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
+
+        apiGeneratorService.generateCodes(params);
+    }
 }