Explorar el Código

添加 sim_real_exam_fault 相关。

tom hace 5 meses
padre
commit
728cdc94d3

+ 98 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/RealExamFaultController.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.RealExamFault;
+import com.ruoyi.sim.service.IRealExamFaultService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 考试故障关联Controller
+ *
+ * @author tom
+ * @date 2024-12-15
+ */
+@RestController
+@RequestMapping("/sim/real-exam-fault")
+public class RealExamFaultController extends BaseController {
+    @Autowired
+    private IRealExamFaultService realExamFaultService;
+
+    /**
+     * 查询考试故障关联列表
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-fault:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(RealExamFault realExamFault) {
+        startPage();
+        List<RealExamFault> list = realExamFaultService.selectRealExamFaultList(realExamFault);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出考试故障关联列表
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-fault:export')")
+    @Log(title = "考试故障关联", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, RealExamFault realExamFault) {
+        List<RealExamFault> list = realExamFaultService.selectRealExamFaultList(realExamFault);
+        ExcelUtil<RealExamFault> util = new ExcelUtil<RealExamFault>(RealExamFault.class);
+        util.exportExcel(response, list, "考试故障关联数据");
+    }
+
+    /**
+     * 获取考试故障关联详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-fault:query')")
+    @GetMapping(value = "/{refId}")
+    public AjaxResult getInfo(@PathVariable("refId") Long refId) {
+        return success(realExamFaultService.selectRealExamFaultByRefId(refId));
+    }
+
+    /**
+     * 新增考试故障关联
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-fault:add')")
+    @Log(title = "考试故障关联", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody RealExamFault realExamFault) {
+        return toAjax(realExamFaultService.insertRealExamFault(realExamFault));
+    }
+
+    /**
+     * 修改考试故障关联
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-fault:edit')")
+    @Log(title = "考试故障关联", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody RealExamFault realExamFault) {
+        return toAjax(realExamFaultService.updateRealExamFault(realExamFault));
+    }
+
+    /**
+     * 删除考试故障关联
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-fault:remove')")
+    @Log(title = "考试故障关联", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{refIds}")
+    public AjaxResult remove(@PathVariable Long[] refIds) {
+        return toAjax(realExamFaultService.deleteRealExamFaultByRefIds(refIds));
+    }
+}

+ 133 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/domain/RealExamFault.java

@@ -0,0 +1,133 @@
+package com.ruoyi.sim.domain;
+
+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_fault
+ *
+ * @author tom
+ * @date 2024-12-15
+ */
+public class RealExamFault extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * $column.columnComment
+     */
+    private Long refId;
+
+    /**
+     * 考试ID
+     */
+    @Excel(name = "考试ID")
+    private Long examId;
+
+    /**
+     * 故障ID
+     */
+    @Excel(name = "故障ID")
+    private String faultId;
+
+    /**
+     * 7:未知
+     * 1:选中
+     * 0:没有选中
+     */
+    @Excel(name = "flag")
+    private String flag;
+
+    /**
+     * 出题数值
+     */
+    @Excel(name = "出题数值")
+    private String questionValue;
+
+    /**
+     * 答题数值
+     */
+    @Excel(name = "答题数值")
+    private String answerValue;
+
+    /**
+     * 减分值 计正数
+     */
+    @Excel(name = "减分值 计正数")
+    private Integer minus;
+
+    public void setRefId(Long refId) {
+        this.refId = refId;
+    }
+
+    public Long getRefId() {
+        return refId;
+    }
+
+    public void setExamId(Long examId) {
+        this.examId = examId;
+    }
+
+    public Long getExamId() {
+        return examId;
+    }
+
+    public void setFaultId(String faultId) {
+        this.faultId = faultId;
+    }
+
+    public String getFaultId() {
+        return faultId;
+    }
+
+    public void setFlag(String flag) {
+        this.flag = flag;
+    }
+
+    public String getFlag() {
+        return flag;
+    }
+
+    public void setQuestionValue(String questionValue) {
+        this.questionValue = questionValue;
+    }
+
+    public String getQuestionValue() {
+        return questionValue;
+    }
+
+    public void setAnswerValue(String answerValue) {
+        this.answerValue = answerValue;
+    }
+
+    public String getAnswerValue() {
+        return answerValue;
+    }
+
+    public void setMinus(Integer minus) {
+        this.minus = minus;
+    }
+
+    public Integer getMinus() {
+        return minus;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("refId", getRefId())
+                .append("examId", getExamId())
+                .append("faultId", getFaultId())
+                .append("flag", getFlag())
+                .append("questionValue", getQuestionValue())
+                .append("answerValue", getAnswerValue())
+                .append("minus", getMinus())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .append("remark", getRemark())
+                .toString();
+    }
+}

+ 62 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/mapper/RealExamFaultMapper.java

@@ -0,0 +1,62 @@
+package com.ruoyi.sim.mapper;
+
+import java.util.List;
+
+import com.ruoyi.sim.domain.RealExamFault;
+
+/**
+ * 考试故障关联Mapper接口
+ *
+ * @author tom
+ * @date 2024-12-15
+ */
+public interface RealExamFaultMapper {
+    /**
+     * 查询考试故障关联
+     *
+     * @param refId 考试故障关联主键
+     * @return 考试故障关联
+     */
+    public RealExamFault selectRealExamFaultByRefId(Long refId);
+
+    /**
+     * 查询考试故障关联列表
+     *
+     * @param realExamFault 考试故障关联
+     * @return 考试故障关联集合
+     */
+    public List<RealExamFault> selectRealExamFaultList(RealExamFault realExamFault);
+
+    /**
+     * 新增考试故障关联
+     *
+     * @param realExamFault 考试故障关联
+     * @return 结果
+     */
+    public int insertRealExamFault(RealExamFault realExamFault);
+
+    /**
+     * 修改考试故障关联
+     *
+     * @param realExamFault 考试故障关联
+     * @return 结果
+     */
+    public int updateRealExamFault(RealExamFault realExamFault);
+
+    /**
+     * 删除考试故障关联
+     *
+     * @param refId 考试故障关联主键
+     * @return 结果
+     */
+    public int deleteRealExamFaultByRefId(Long refId);
+
+    /**
+     * 批量删除考试故障关联
+     *
+     * @param refIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteRealExamFaultByRefIds(Long[] refIds);
+}
+

+ 62 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/IRealExamFaultService.java

@@ -0,0 +1,62 @@
+package com.ruoyi.sim.service;
+
+import java.util.List;
+
+import com.ruoyi.sim.domain.RealExamFault;
+
+/**
+ * 考试故障关联Service接口
+ *
+ * @author tom
+ * @date 2024-12-15
+ */
+public interface IRealExamFaultService {
+    /**
+     * 查询考试故障关联
+     *
+     * @param refId 考试故障关联主键
+     * @return 考试故障关联
+     */
+    public RealExamFault selectRealExamFaultByRefId(Long refId);
+
+    /**
+     * 查询考试故障关联列表
+     *
+     * @param realExamFault 考试故障关联
+     * @return 考试故障关联集合
+     */
+    public List<RealExamFault> selectRealExamFaultList(RealExamFault realExamFault);
+
+    /**
+     * 新增考试故障关联
+     *
+     * @param realExamFault 考试故障关联
+     * @return 结果
+     */
+    public int insertRealExamFault(RealExamFault realExamFault);
+
+    /**
+     * 修改考试故障关联
+     *
+     * @param realExamFault 考试故障关联
+     * @return 结果
+     */
+    public int updateRealExamFault(RealExamFault realExamFault);
+
+    /**
+     * 批量删除考试故障关联
+     *
+     * @param refIds 需要删除的考试故障关联主键集合
+     * @return 结果
+     */
+    public int deleteRealExamFaultByRefIds(Long[] refIds);
+
+    /**
+     * 删除考试故障关联信息
+     *
+     * @param refId 考试故障关联主键
+     * @return 结果
+     */
+    public int deleteRealExamFaultByRefId(Long refId);
+}
+

+ 90 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/RealExamFaultServiceImpl.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.RealExamFaultMapper;
+import com.ruoyi.sim.domain.RealExamFault;
+import com.ruoyi.sim.service.IRealExamFaultService;
+
+/**
+ * 考试故障关联Service业务层处理
+ *
+ * @author tom
+ * @date 2024-12-15
+ */
+@Service
+public class RealExamFaultServiceImpl implements IRealExamFaultService {
+    @Autowired
+    private RealExamFaultMapper realExamFaultMapper;
+
+    /**
+     * 查询考试故障关联
+     *
+     * @param refId 考试故障关联主键
+     * @return 考试故障关联
+     */
+    @Override
+    public RealExamFault selectRealExamFaultByRefId(Long refId) {
+        return realExamFaultMapper.selectRealExamFaultByRefId(refId);
+    }
+
+    /**
+     * 查询考试故障关联列表
+     *
+     * @param realExamFault 考试故障关联
+     * @return 考试故障关联
+     */
+    @Override
+    public List<RealExamFault> selectRealExamFaultList(RealExamFault realExamFault) {
+        return realExamFaultMapper.selectRealExamFaultList(realExamFault);
+    }
+
+    /**
+     * 新增考试故障关联
+     *
+     * @param realExamFault 考试故障关联
+     * @return 结果
+     */
+    @Override
+    public int insertRealExamFault(RealExamFault realExamFault) {
+        realExamFault.setCreateTime(DateUtils.getNowDate());
+        return realExamFaultMapper.insertRealExamFault(realExamFault);
+    }
+
+    /**
+     * 修改考试故障关联
+     *
+     * @param realExamFault 考试故障关联
+     * @return 结果
+     */
+    @Override
+    public int updateRealExamFault(RealExamFault realExamFault) {
+        realExamFault.setUpdateTime(DateUtils.getNowDate());
+        return realExamFaultMapper.updateRealExamFault(realExamFault);
+    }
+
+    /**
+     * 批量删除考试故障关联
+     *
+     * @param refIds 需要删除的考试故障关联主键
+     * @return 结果
+     */
+    @Override
+    public int deleteRealExamFaultByRefIds(Long[] refIds) {
+        return realExamFaultMapper.deleteRealExamFaultByRefIds(refIds);
+    }
+
+    /**
+     * 删除考试故障关联信息
+     *
+     * @param refId 考试故障关联主键
+     * @return 结果
+     */
+    @Override
+    public int deleteRealExamFaultByRefId(Long refId) {
+        return realExamFaultMapper.deleteRealExamFaultByRefId(refId);
+    }
+}

+ 115 - 0
ruoyi-sim/src/main/resources/mapper/sim/RealExamFaultMapper.xml

@@ -0,0 +1,115 @@
+<?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.RealExamFaultMapper">
+
+    <resultMap type="RealExamFault" id="RealExamFaultResult">
+        <result property="refId" column="ref_id"/>
+        <result property="examId" column="exam_id"/>
+        <result property="faultId" column="fault_id"/>
+        <result property="flag" column="flag"/>
+        <result property="questionValue" column="question_value"/>
+        <result property="answerValue" column="answer_value"/>
+        <result property="minus" column="minus"/>
+        <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="selectRealExamFaultVo">
+        select ref_id,
+               exam_id,
+               fault_id,
+               flag,
+               question_value,
+               answer_value,
+               minus,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               remark
+        from sim_real_exam_fault
+    </sql>
+
+    <select id="selectRealExamFaultList" parameterType="RealExamFault" resultMap="RealExamFaultResult">
+        <include refid="selectRealExamFaultVo"/>
+        <where>
+            <if test="examId != null ">and exam_id = #{examId}</if>
+            <if test="faultId != null  and faultId != ''">and fault_id = #{faultId}</if>
+            <if test="flag != null  and flag != ''">and flag = #{flag}</if>
+            <if test="questionValue != null  and questionValue != ''">and question_value = #{questionValue}</if>
+            <if test="answerValue != null  and answerValue != ''">and answer_value = #{answerValue}</if>
+            <if test="minus != null ">and minus = #{minus}</if>
+        </where>
+    </select>
+
+    <select id="selectRealExamFaultByRefId" parameterType="Long" resultMap="RealExamFaultResult">
+        <include refid="selectRealExamFaultVo"/>
+        where ref_id = #{refId}
+    </select>
+
+    <insert id="insertRealExamFault" parameterType="RealExamFault" useGeneratedKeys="true" keyProperty="refId">
+        insert into sim_real_exam_fault
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="examId != null">exam_id,</if>
+            <if test="faultId != null and faultId != ''">fault_id,</if>
+            <if test="flag != null and flag != ''">flag,</if>
+            <if test="questionValue != null">question_value,</if>
+            <if test="answerValue != null">answer_value,</if>
+            <if test="minus != null">minus,</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="examId != null">#{examId},</if>
+            <if test="faultId != null and faultId != ''">#{faultId},</if>
+            <if test="flag != null and flag != ''">#{flag},</if>
+            <if test="questionValue != null">#{questionValue},</if>
+            <if test="answerValue != null">#{answerValue},</if>
+            <if test="minus != null">#{minus},</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="updateRealExamFault" parameterType="RealExamFault">
+        update sim_real_exam_fault
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="examId != null">exam_id = #{examId},</if>
+            <if test="faultId != null and faultId != ''">fault_id = #{faultId},</if>
+            <if test="flag != null and flag != ''">flag = #{flag},</if>
+            <if test="questionValue != null">question_value = #{questionValue},</if>
+            <if test="answerValue != null">answer_value = #{answerValue},</if>
+            <if test="minus != null">minus = #{minus},</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 ref_id = #{refId}
+    </update>
+
+    <delete id="deleteRealExamFaultByRefId" parameterType="Long">
+        delete
+        from sim_real_exam_fault
+        where ref_id = #{refId}
+    </delete>
+
+    <delete id="deleteRealExamFaultByRefIds" parameterType="String">
+        delete from sim_real_exam_fault where ref_id in
+        <foreach item="refId" collection="array" open="(" separator="," close=")">
+            #{refId}
+        </foreach>
+    </delete>
+</mapper>