浏览代码

添加 RealExamCollection 相关。

tom 5 月之前
父节点
当前提交
c7ae361746

+ 98 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/RealExamCollectionController.java

@@ -0,0 +1,98 @@
+package com.ruoyi.sim.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.sim.domain.RealExamCollection;
+import com.ruoyi.sim.service.IRealExamCollectionService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 考试集合Controller
+ *
+ * @author tom
+ * @date 2024-12-13
+ */
+@RestController
+@RequestMapping("/sim/real-exam-collection")
+public class RealExamCollectionController extends BaseController {
+    @Autowired
+    private IRealExamCollectionService realExamCollectionService;
+
+    /**
+     * 查询考试集合列表
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(RealExamCollection realExamCollection) {
+        startPage();
+        List<RealExamCollection> list = realExamCollectionService.selectRealExamCollectionList(realExamCollection);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出考试集合列表
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:export')")
+    @Log(title = "考试集合", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, RealExamCollection realExamCollection) {
+        List<RealExamCollection> list = realExamCollectionService.selectRealExamCollectionList(realExamCollection);
+        ExcelUtil<RealExamCollection> util = new ExcelUtil<RealExamCollection>(RealExamCollection.class);
+        util.exportExcel(response, list, "考试集合数据");
+    }
+
+    /**
+     * 获取考试集合详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:query')")
+    @GetMapping(value = "/{examCollectionId}")
+    public AjaxResult getInfo(@PathVariable("examCollectionId") Long examCollectionId) {
+        return success(realExamCollectionService.selectRealExamCollectionByExamCollectionId(examCollectionId));
+    }
+
+    /**
+     * 新增考试集合
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:add')")
+    @Log(title = "考试集合", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody RealExamCollection realExamCollection) {
+        return toAjax(realExamCollectionService.insertRealExamCollection(realExamCollection));
+    }
+
+    /**
+     * 修改考试集合
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:edit')")
+    @Log(title = "考试集合", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody RealExamCollection realExamCollection) {
+        return toAjax(realExamCollectionService.updateRealExamCollection(realExamCollection));
+    }
+
+    /**
+     * 删除考试集合
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:remove')")
+    @Log(title = "考试集合", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{examCollectionIds}")
+    public AjaxResult remove(@PathVariable Long[] examCollectionIds) {
+        return toAjax(realExamCollectionService.deleteRealExamCollectionByExamCollectionIds(examCollectionIds));
+    }
+}

+ 184 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/domain/RealExamCollection.java

@@ -0,0 +1,184 @@
+package com.ruoyi.sim.domain;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 考试集合对象 sim_real_exam_collection
+ *
+ * @author tom
+ * @date 2024-12-13
+ */
+public class RealExamCollection extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 考试集合ID
+     */
+    private Long examCollectionId;
+
+    /**
+     * 模拟器类型
+     */
+    @Excel(name = "模拟器类型")
+    private String simType;
+
+    /** 出题方式:
+     1 系统随机
+     2 教师自选
+     3 任务自选
+     */
+    @Excel(name = "出题方式")
+    private String questionSettingMethod;
+
+    /** 考试类型
+     1:练习
+     2:自主练习
+     3:考试 */
+    @Excel(name = "考试类型")
+    private String examCollectionType;
+
+    /**
+     * 考试名称
+     */
+    @Excel(name = "考试名称")
+    private String examCollectionName;
+
+    /**
+     * 任务ID
+     */
+    @Excel(name = "任务ID")
+    private Long taskId;
+
+    /**
+     * 限制时长(分钟)
+     */
+    @Excel(name = "限制时长(分钟)")
+    private Integer limitDuration;
+
+    /**
+     * 考试开始时间(天)
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "考试开始时间(天)", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date startTime;
+
+    /**
+     * 考试结束时间(天)
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "考试结束时间(天)", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date endTime;
+
+    /**
+     * 创建教师ID/用户ID
+     */
+    @Excel(name = "创建教师ID/用户ID")
+    private Long createUserId;
+
+    public void setExamCollectionId(Long examCollectionId) {
+        this.examCollectionId = examCollectionId;
+    }
+
+    public Long getExamCollectionId() {
+        return examCollectionId;
+    }
+
+    public void setSimType(String simType) {
+        this.simType = simType;
+    }
+
+    public String getSimType() {
+        return simType;
+    }
+
+    public void setQuestionSettingMethod(String questionSettingMethod) {
+        this.questionSettingMethod = questionSettingMethod;
+    }
+
+    public String getQuestionSettingMethod() {
+        return questionSettingMethod;
+    }
+
+    public void setExamCollectionType(String examCollectionType) {
+        this.examCollectionType = examCollectionType;
+    }
+
+    public String getExamCollectionType() {
+        return examCollectionType;
+    }
+
+    public void setExamCollectionName(String examCollectionName) {
+        this.examCollectionName = examCollectionName;
+    }
+
+    public String getExamCollectionName() {
+        return examCollectionName;
+    }
+
+    public void setTaskId(Long taskId) {
+        this.taskId = taskId;
+    }
+
+    public Long getTaskId() {
+        return taskId;
+    }
+
+    public void setLimitDuration(Integer limitDuration) {
+        this.limitDuration = limitDuration;
+    }
+
+    public Integer getLimitDuration() {
+        return limitDuration;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setCreateUserId(Long createUserId) {
+        this.createUserId = createUserId;
+    }
+
+    public Long getCreateUserId() {
+        return createUserId;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("examCollectionId", getExamCollectionId())
+                .append("simType", getSimType())
+                .append("questionSettingMethod", getQuestionSettingMethod())
+                .append("examCollectionType", getExamCollectionType())
+                .append("examCollectionName", getExamCollectionName())
+                .append("taskId", getTaskId())
+                .append("limitDuration", getLimitDuration())
+                .append("startTime", getStartTime())
+                .append("endTime", getEndTime())
+                .append("createUserId", getCreateUserId())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .append("remark", getRemark())
+                .toString();
+    }
+}

+ 61 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/mapper/RealExamCollectionMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.sim.mapper;
+
+import java.util.List;
+
+import com.ruoyi.sim.domain.RealExamCollection;
+
+/**
+ * 考试集合Mapper接口
+ *
+ * @author tom
+ * @date 2024-12-13
+ */
+public interface RealExamCollectionMapper {
+    /**
+     * 查询考试集合
+     *
+     * @param examCollectionId 考试集合主键
+     * @return 考试集合
+     */
+    public RealExamCollection selectRealExamCollectionByExamCollectionId(Long examCollectionId);
+
+    /**
+     * 查询考试集合列表
+     *
+     * @param realExamCollection 考试集合
+     * @return 考试集合集合
+     */
+    public List<RealExamCollection> selectRealExamCollectionList(RealExamCollection realExamCollection);
+
+    /**
+     * 新增考试集合
+     *
+     * @param realExamCollection 考试集合
+     * @return 结果
+     */
+    public int insertRealExamCollection(RealExamCollection realExamCollection);
+
+    /**
+     * 修改考试集合
+     *
+     * @param realExamCollection 考试集合
+     * @return 结果
+     */
+    public int updateRealExamCollection(RealExamCollection realExamCollection);
+
+    /**
+     * 删除考试集合
+     *
+     * @param examCollectionId 考试集合主键
+     * @return 结果
+     */
+    public int deleteRealExamCollectionByExamCollectionId(Long examCollectionId);
+
+    /**
+     * 批量删除考试集合
+     *
+     * @param examCollectionIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteRealExamCollectionByExamCollectionIds(Long[] examCollectionIds);
+}

+ 61 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/IRealExamCollectionService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.sim.service;
+
+import java.util.List;
+
+import com.ruoyi.sim.domain.RealExamCollection;
+
+/**
+ * 考试集合Service接口
+ *
+ * @author tom
+ * @date 2024-12-13
+ */
+public interface IRealExamCollectionService {
+    /**
+     * 查询考试集合
+     *
+     * @param examCollectionId 考试集合主键
+     * @return 考试集合
+     */
+    public RealExamCollection selectRealExamCollectionByExamCollectionId(Long examCollectionId);
+
+    /**
+     * 查询考试集合列表
+     *
+     * @param realExamCollection 考试集合
+     * @return 考试集合集合
+     */
+    public List<RealExamCollection> selectRealExamCollectionList(RealExamCollection realExamCollection);
+
+    /**
+     * 新增考试集合
+     *
+     * @param realExamCollection 考试集合
+     * @return 结果
+     */
+    public int insertRealExamCollection(RealExamCollection realExamCollection);
+
+    /**
+     * 修改考试集合
+     *
+     * @param realExamCollection 考试集合
+     * @return 结果
+     */
+    public int updateRealExamCollection(RealExamCollection realExamCollection);
+
+    /**
+     * 批量删除考试集合
+     *
+     * @param examCollectionIds 需要删除的考试集合主键集合
+     * @return 结果
+     */
+    public int deleteRealExamCollectionByExamCollectionIds(Long[] examCollectionIds);
+
+    /**
+     * 删除考试集合信息
+     *
+     * @param examCollectionId 考试集合主键
+     * @return 结果
+     */
+    public int deleteRealExamCollectionByExamCollectionId(Long examCollectionId);
+}

+ 90 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/RealExamCollectionServiceImpl.java

@@ -0,0 +1,90 @@
+package com.ruoyi.sim.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.sim.mapper.RealExamCollectionMapper;
+import com.ruoyi.sim.domain.RealExamCollection;
+import com.ruoyi.sim.service.IRealExamCollectionService;
+
+/**
+ * 考试集合Service业务层处理
+ *
+ * @author tom
+ * @date 2024-12-13
+ */
+@Service
+public class RealExamCollectionServiceImpl implements IRealExamCollectionService {
+    @Autowired
+    private RealExamCollectionMapper realExamCollectionMapper;
+
+    /**
+     * 查询考试集合
+     *
+     * @param examCollectionId 考试集合主键
+     * @return 考试集合
+     */
+    @Override
+    public RealExamCollection selectRealExamCollectionByExamCollectionId(Long examCollectionId) {
+        return realExamCollectionMapper.selectRealExamCollectionByExamCollectionId(examCollectionId);
+    }
+
+    /**
+     * 查询考试集合列表
+     *
+     * @param realExamCollection 考试集合
+     * @return 考试集合
+     */
+    @Override
+    public List<RealExamCollection> selectRealExamCollectionList(RealExamCollection realExamCollection) {
+        return realExamCollectionMapper.selectRealExamCollectionList(realExamCollection);
+    }
+
+    /**
+     * 新增考试集合
+     *
+     * @param realExamCollection 考试集合
+     * @return 结果
+     */
+    @Override
+    public int insertRealExamCollection(RealExamCollection realExamCollection) {
+        realExamCollection.setCreateTime(DateUtils.getNowDate());
+        return realExamCollectionMapper.insertRealExamCollection(realExamCollection);
+    }
+
+    /**
+     * 修改考试集合
+     *
+     * @param realExamCollection 考试集合
+     * @return 结果
+     */
+    @Override
+    public int updateRealExamCollection(RealExamCollection realExamCollection) {
+        realExamCollection.setUpdateTime(DateUtils.getNowDate());
+        return realExamCollectionMapper.updateRealExamCollection(realExamCollection);
+    }
+
+    /**
+     * 批量删除考试集合
+     *
+     * @param examCollectionIds 需要删除的考试集合主键
+     * @return 结果
+     */
+    @Override
+    public int deleteRealExamCollectionByExamCollectionIds(Long[] examCollectionIds) {
+        return realExamCollectionMapper.deleteRealExamCollectionByExamCollectionIds(examCollectionIds);
+    }
+
+    /**
+     * 删除考试集合信息
+     *
+     * @param examCollectionId 考试集合主键
+     * @return 结果
+     */
+    @Override
+    public int deleteRealExamCollectionByExamCollectionId(Long examCollectionId) {
+        return realExamCollectionMapper.deleteRealExamCollectionByExamCollectionId(examCollectionId);
+    }
+}

+ 146 - 0
ruoyi-sim/src/main/resources/mapper/sim/RealExamCollection.xml

@@ -0,0 +1,146 @@
+<?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.sim.mapper.RealExamCollectionMapper">
+
+    <resultMap type="RealExamCollection" id="RealExamCollectionResult">
+        <result property="examCollectionId" column="exam_collection_id"/>
+        <result property="simType" column="sim_type"/>
+        <result property="questionSettingMethod" column="question_setting_method"/>
+        <result property="examCollectionType" column="exam_collection_type"/>
+        <result property="examCollectionName" column="exam_collection_name"/>
+        <result property="taskId" column="task_id"/>
+        <result property="limitDuration" column="limit_duration"/>
+        <result property="startTime" column="start_time"/>
+        <result property="endTime" column="end_time"/>
+        <result property="createUserId" column="create_user_id"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="remark" column="remark"/>
+    </resultMap>
+
+    <sql id="selectRealExamCollectionVo">
+        select exam_collection_id,
+               sim_type,
+               question_setting_method,
+               exam_collection_type,
+               exam_collection_name,
+               task_id,
+               limit_duration,
+               start_time,
+               end_time,
+               create_user_id,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               remark
+        from sim_real_exam_collection
+    </sql>
+
+    <select id="selectRealExamCollectionList" parameterType="RealExamCollection" resultMap="RealExamCollectionResult">
+        <include refid="selectRealExamCollectionVo"/>
+        <where>
+            <if test="simType != null  and simType != ''">and sim_type = #{simType}</if>
+            <if test="questionSettingMethod != null  and questionSettingMethod != ''">and question_setting_method =
+                #{questionSettingMethod}
+            </if>
+            <if test="examCollectionType != null  and examCollectionType != ''">and exam_collection_type =
+                #{examCollectionType}
+            </if>
+            <if test="examCollectionName != null  and examCollectionName != ''">and exam_collection_name like
+                concat('%', #{examCollectionName}, '%')
+            </if>
+            <if test="taskId != null ">and task_id = #{taskId}</if>
+            <if test="limitDuration != null ">and limit_duration = #{limitDuration}</if>
+            <if test="startTime != null ">and start_time = #{startTime}</if>
+            <if test="endTime != null ">and end_time = #{endTime}</if>
+            <if test="createUserId != null ">and create_user_id = #{createUserId}</if>
+        </where>
+    </select>
+
+    <select id="selectRealExamCollectionByExamCollectionId" parameterType="Long" resultMap="RealExamCollectionResult">
+        <include refid="selectRealExamCollectionVo"/>
+        where exam_collection_id = #{examCollectionId}
+    </select>
+
+    <insert id="insertRealExamCollection" parameterType="RealExamCollection" useGeneratedKeys="true"
+            keyProperty="examCollectionId">
+        insert into sim_real_exam_collection
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="simType != null and simType != ''">sim_type,</if>
+            <if test="questionSettingMethod != null and questionSettingMethod != ''">question_setting_method,</if>
+            <if test="examCollectionType != null and examCollectionType != ''">exam_collection_type,</if>
+            <if test="examCollectionName != null and examCollectionName != ''">exam_collection_name,</if>
+            <if test="taskId != null">task_id,</if>
+            <if test="limitDuration != null">limit_duration,</if>
+            <if test="startTime != null">start_time,</if>
+            <if test="endTime != null">end_time,</if>
+            <if test="createUserId != null">create_user_id,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="simType != null and simType != ''">#{simType},</if>
+            <if test="questionSettingMethod != null and questionSettingMethod != ''">#{questionSettingMethod},</if>
+            <if test="examCollectionType != null and examCollectionType != ''">#{examCollectionType},</if>
+            <if test="examCollectionName != null and examCollectionName != ''">#{examCollectionName},</if>
+            <if test="taskId != null">#{taskId},</if>
+            <if test="limitDuration != null">#{limitDuration},</if>
+            <if test="startTime != null">#{startTime},</if>
+            <if test="endTime != null">#{endTime},</if>
+            <if test="createUserId != null">#{createUserId},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+        </trim>
+    </insert>
+
+    <update id="updateRealExamCollection" parameterType="RealExamCollection">
+        update sim_real_exam_collection
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="simType != null and simType != ''">sim_type = #{simType},</if>
+            <if test="questionSettingMethod != null and questionSettingMethod != ''">question_setting_method =
+                #{questionSettingMethod},
+            </if>
+            <if test="examCollectionType != null and examCollectionType != ''">exam_collection_type =
+                #{examCollectionType},
+            </if>
+            <if test="examCollectionName != null and examCollectionName != ''">exam_collection_name =
+                #{examCollectionName},
+            </if>
+            <if test="taskId != null">task_id = #{taskId},</if>
+            <if test="limitDuration != null">limit_duration = #{limitDuration},</if>
+            <if test="startTime != null">start_time = #{startTime},</if>
+            <if test="endTime != null">end_time = #{endTime},</if>
+            <if test="createUserId != null">create_user_id = #{createUserId},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where exam_collection_id = #{examCollectionId}
+    </update>
+
+    <delete id="deleteRealExamCollectionByExamCollectionId" parameterType="Long">
+        delete
+        from sim_real_exam_collection
+        where exam_collection_id = #{examCollectionId}
+    </delete>
+
+    <delete id="deleteRealExamCollectionByExamCollectionIds" parameterType="String">
+        delete from sim_real_exam_collection where exam_collection_id in
+        <foreach item="examCollectionId" collection="array" open="(" separator="," close=")">
+            #{examCollectionId}
+        </foreach>
+    </delete>
+</mapper>