Jelajahi Sumber

添加 ExamCollectionDept 相关。

tom 5 bulan lalu
induk
melakukan
eb06d9b370

+ 32 - 0
pla-sim/01_SQL/02_table/sim_real_exam_collection_dept.sql

@@ -0,0 +1,32 @@
+/*
+ Navicat Premium Dump SQL
+
+ Source Server         : qdhome.iot321.top-dev
+ Source Server Type    : MySQL
+ Source Server Version : 50740 (5.7.40-log)
+ Source Host           : qdhome.iot321.top:33103
+ Source Schema         : pla-chem-sim-dev-1
+
+ Target Server Type    : MySQL
+ Target Server Version : 50740 (5.7.40-log)
+ File Encoding         : 65001
+
+ Date: 13/12/2024 22:02:42
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for sim_real_exam_collection_dept
+-- ----------------------------
+DROP TABLE IF EXISTS `sim_real_exam_collection_dept`;
+CREATE TABLE `sim_real_exam_collection_dept`  (
+  `rel_id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `exam_collection_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '正式考试集合ID',
+  `dept_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '班级ID/部门ID',
+  `update_time` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+  PRIMARY KEY (`rel_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'sim-考试集合班级关联表' ROW_FORMAT = DYNAMIC;
+
+SET FOREIGN_KEY_CHECKS = 1;

+ 98 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/RealExamCollectionDeptController.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.RealExamCollectionDept;
+import com.ruoyi.sim.service.IRealExamCollectionDeptService;
+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-dept")
+public class RealExamCollectionDeptController extends BaseController {
+    @Autowired
+    private IRealExamCollectionDeptService realExamCollectionDeptService;
+
+    /**
+     * 查询考试集合班级关联列表
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-collection-dept:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(RealExamCollectionDept realExamCollectionDept) {
+        startPage();
+        List<RealExamCollectionDept> list = realExamCollectionDeptService.selectRealExamCollectionDeptList(realExamCollectionDept);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出考试集合班级关联列表
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-collection-dept:export')")
+    @Log(title = "考试集合班级关联", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, RealExamCollectionDept realExamCollectionDept) {
+        List<RealExamCollectionDept> list = realExamCollectionDeptService.selectRealExamCollectionDeptList(realExamCollectionDept);
+        ExcelUtil<RealExamCollectionDept> util = new ExcelUtil<RealExamCollectionDept>(RealExamCollectionDept.class);
+        util.exportExcel(response, list, "考试集合班级关联数据");
+    }
+
+    /**
+     * 获取考试集合班级关联详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-collection-dept:query')")
+    @GetMapping(value = "/{relId}")
+    public AjaxResult getInfo(@PathVariable("relId") Long relId) {
+        return success(realExamCollectionDeptService.selectRealExamCollectionDeptByRelId(relId));
+    }
+
+    /**
+     * 新增考试集合班级关联
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-collection-dept:add')")
+    @Log(title = "考试集合班级关联", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody RealExamCollectionDept realExamCollectionDept) {
+        return toAjax(realExamCollectionDeptService.insertRealExamCollectionDept(realExamCollectionDept));
+    }
+
+    /**
+     * 修改考试集合班级关联
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-collection-dept:edit')")
+    @Log(title = "考试集合班级关联", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody RealExamCollectionDept realExamCollectionDept) {
+        return toAjax(realExamCollectionDeptService.updateRealExamCollectionDept(realExamCollectionDept));
+    }
+
+    /**
+     * 删除考试集合班级关联
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam-collection-dept:remove')")
+    @Log(title = "考试集合班级关联", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{relIds}")
+    public AjaxResult remove(@PathVariable Long[] relIds) {
+        return toAjax(realExamCollectionDeptService.deleteRealExamCollectionDeptByRelIds(relIds));
+    }
+}

+ 67 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/domain/RealExamCollectionDept.java

@@ -0,0 +1,67 @@
+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_collection_dept
+ *
+ * @author tom
+ * @date 2024-12-13
+ */
+public class RealExamCollectionDept extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     *
+     */
+    private Long relId;
+
+    /**
+     * 正式考试集合ID
+     */
+    @Excel(name = "正式考试集合ID")
+    private Long examCollectionId;
+
+    /**
+     * 班级ID/部门ID
+     */
+    @Excel(name = "班级ID/部门ID")
+    private Long deptId;
+
+    public void setRelId(Long relId) {
+        this.relId = relId;
+    }
+
+    public Long getRelId() {
+        return relId;
+    }
+
+    public void setExamCollectionId(Long examCollectionId) {
+        this.examCollectionId = examCollectionId;
+    }
+
+    public Long getExamCollectionId() {
+        return examCollectionId;
+    }
+
+    public void setDeptId(Long deptId) {
+        this.deptId = deptId;
+    }
+
+    public Long getDeptId() {
+        return deptId;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("relId", getRelId())
+                .append("examCollectionId", getExamCollectionId())
+                .append("deptId", getDeptId())
+                .append("updateTime", getUpdateTime())
+                .toString();
+    }
+}

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

@@ -0,0 +1,61 @@
+package com.ruoyi.sim.mapper;
+
+import java.util.List;
+
+import com.ruoyi.sim.domain.RealExamCollectionDept;
+
+/**
+ * 考试集合班级关联Mapper接口
+ *
+ * @author tom
+ * @date 2024-12-13
+ */
+public interface RealExamCollectionDeptMapper {
+    /**
+     * 查询考试集合班级关联
+     *
+     * @param relId 考试集合班级关联主键
+     * @return 考试集合班级关联
+     */
+    public RealExamCollectionDept selectRealExamCollectionDeptByRelId(Long relId);
+
+    /**
+     * 查询考试集合班级关联列表
+     *
+     * @param realExamCollectionDept 考试集合班级关联
+     * @return 考试集合班级关联集合
+     */
+    public List<RealExamCollectionDept> selectRealExamCollectionDeptList(RealExamCollectionDept realExamCollectionDept);
+
+    /**
+     * 新增考试集合班级关联
+     *
+     * @param realExamCollectionDept 考试集合班级关联
+     * @return 结果
+     */
+    public int insertRealExamCollectionDept(RealExamCollectionDept realExamCollectionDept);
+
+    /**
+     * 修改考试集合班级关联
+     *
+     * @param realExamCollectionDept 考试集合班级关联
+     * @return 结果
+     */
+    public int updateRealExamCollectionDept(RealExamCollectionDept realExamCollectionDept);
+
+    /**
+     * 删除考试集合班级关联
+     *
+     * @param relId 考试集合班级关联主键
+     * @return 结果
+     */
+    public int deleteRealExamCollectionDeptByRelId(Long relId);
+
+    /**
+     * 批量删除考试集合班级关联
+     *
+     * @param relIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteRealExamCollectionDeptByRelIds(Long[] relIds);
+}

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

@@ -0,0 +1,61 @@
+package com.ruoyi.sim.service;
+
+import java.util.List;
+
+import com.ruoyi.sim.domain.RealExamCollectionDept;
+
+/**
+ * 考试集合班级关联Service接口
+ *
+ * @author tom
+ * @date 2024-12-13
+ */
+public interface IRealExamCollectionDeptService {
+    /**
+     * 查询考试集合班级关联
+     *
+     * @param relId 考试集合班级关联主键
+     * @return 考试集合班级关联
+     */
+    public RealExamCollectionDept selectRealExamCollectionDeptByRelId(Long relId);
+
+    /**
+     * 查询考试集合班级关联列表
+     *
+     * @param realExamCollectionDept 考试集合班级关联
+     * @return 考试集合班级关联集合
+     */
+    public List<RealExamCollectionDept> selectRealExamCollectionDeptList(RealExamCollectionDept realExamCollectionDept);
+
+    /**
+     * 新增考试集合班级关联
+     *
+     * @param realExamCollectionDept 考试集合班级关联
+     * @return 结果
+     */
+    public int insertRealExamCollectionDept(RealExamCollectionDept realExamCollectionDept);
+
+    /**
+     * 修改考试集合班级关联
+     *
+     * @param realExamCollectionDept 考试集合班级关联
+     * @return 结果
+     */
+    public int updateRealExamCollectionDept(RealExamCollectionDept realExamCollectionDept);
+
+    /**
+     * 批量删除考试集合班级关联
+     *
+     * @param relIds 需要删除的考试集合班级关联主键集合
+     * @return 结果
+     */
+    public int deleteRealExamCollectionDeptByRelIds(Long[] relIds);
+
+    /**
+     * 删除考试集合班级关联信息
+     *
+     * @param relId 考试集合班级关联主键
+     * @return 结果
+     */
+    public int deleteRealExamCollectionDeptByRelId(Long relId);
+}

+ 89 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/RealExamCollectionDeptServiceImpl.java

@@ -0,0 +1,89 @@
+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.RealExamCollectionDeptMapper;
+import com.ruoyi.sim.domain.RealExamCollectionDept;
+import com.ruoyi.sim.service.IRealExamCollectionDeptService;
+
+/**
+ * 考试集合班级关联Service业务层处理
+ *
+ * @author tom
+ * @date 2024-12-13
+ */
+@Service
+public class RealExamCollectionDeptServiceImpl implements IRealExamCollectionDeptService {
+    @Autowired
+    private RealExamCollectionDeptMapper realExamCollectionDeptMapper;
+
+    /**
+     * 查询考试集合班级关联
+     *
+     * @param relId 考试集合班级关联主键
+     * @return 考试集合班级关联
+     */
+    @Override
+    public RealExamCollectionDept selectRealExamCollectionDeptByRelId(Long relId) {
+        return realExamCollectionDeptMapper.selectRealExamCollectionDeptByRelId(relId);
+    }
+
+    /**
+     * 查询考试集合班级关联列表
+     *
+     * @param realExamCollectionDept 考试集合班级关联
+     * @return 考试集合班级关联
+     */
+    @Override
+    public List<RealExamCollectionDept> selectRealExamCollectionDeptList(RealExamCollectionDept realExamCollectionDept) {
+        return realExamCollectionDeptMapper.selectRealExamCollectionDeptList(realExamCollectionDept);
+    }
+
+    /**
+     * 新增考试集合班级关联
+     *
+     * @param realExamCollectionDept 考试集合班级关联
+     * @return 结果
+     */
+    @Override
+    public int insertRealExamCollectionDept(RealExamCollectionDept realExamCollectionDept) {
+        return realExamCollectionDeptMapper.insertRealExamCollectionDept(realExamCollectionDept);
+    }
+
+    /**
+     * 修改考试集合班级关联
+     *
+     * @param realExamCollectionDept 考试集合班级关联
+     * @return 结果
+     */
+    @Override
+    public int updateRealExamCollectionDept(RealExamCollectionDept realExamCollectionDept) {
+        realExamCollectionDept.setUpdateTime(DateUtils.getNowDate());
+        return realExamCollectionDeptMapper.updateRealExamCollectionDept(realExamCollectionDept);
+    }
+
+    /**
+     * 批量删除考试集合班级关联
+     *
+     * @param relIds 需要删除的考试集合班级关联主键
+     * @return 结果
+     */
+    @Override
+    public int deleteRealExamCollectionDeptByRelIds(Long[] relIds) {
+        return realExamCollectionDeptMapper.deleteRealExamCollectionDeptByRelIds(relIds);
+    }
+
+    /**
+     * 删除考试集合班级关联信息
+     *
+     * @param relId 考试集合班级关联主键
+     * @return 结果
+     */
+    @Override
+    public int deleteRealExamCollectionDeptByRelId(Long relId) {
+        return realExamCollectionDeptMapper.deleteRealExamCollectionDeptByRelId(relId);
+    }
+}

+ 70 - 0
ruoyi-sim/src/main/resources/mapper/sim/RealExamCollectionDeptMapper.xml

@@ -0,0 +1,70 @@
+<?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.RealExamCollectionDeptMapper">
+
+    <resultMap type="RealExamCollectionDept" id="RealExamCollectionDeptResult">
+        <result property="relId" column="rel_id"/>
+        <result property="examCollectionId" column="exam_collection_id"/>
+        <result property="deptId" column="dept_id"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectRealExamCollectionDeptVo">
+        select rel_id, exam_collection_id, dept_id, update_time
+        from sim_real_exam_collection_dept
+    </sql>
+
+    <select id="selectRealExamCollectionDeptList" parameterType="RealExamCollectionDept"
+            resultMap="RealExamCollectionDeptResult">
+        <include refid="selectRealExamCollectionDeptVo"/>
+        <where>
+            <if test="examCollectionId != null ">and exam_collection_id = #{examCollectionId}</if>
+            <if test="deptId != null ">and dept_id = #{deptId}</if>
+        </where>
+    </select>
+
+    <select id="selectRealExamCollectionDeptByRelId" parameterType="Long" resultMap="RealExamCollectionDeptResult">
+        <include refid="selectRealExamCollectionDeptVo"/>
+        where rel_id = #{relId}
+    </select>
+
+    <insert id="insertRealExamCollectionDept" parameterType="RealExamCollectionDept" useGeneratedKeys="true"
+            keyProperty="relId">
+        insert into sim_real_exam_collection_dept
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="examCollectionId != null">exam_collection_id,</if>
+            <if test="deptId != null">dept_id,</if>
+            <if test="updateTime != null">update_time,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="examCollectionId != null">#{examCollectionId},</if>
+            <if test="deptId != null">#{deptId},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateRealExamCollectionDept" parameterType="RealExamCollectionDept">
+        update sim_real_exam_collection_dept
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="examCollectionId != null">exam_collection_id = #{examCollectionId},</if>
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where rel_id = #{relId}
+    </update>
+
+    <delete id="deleteRealExamCollectionDeptByRelId" parameterType="Long">
+        delete
+        from sim_real_exam_collection_dept
+        where rel_id = #{relId}
+    </delete>
+
+    <delete id="deleteRealExamCollectionDeptByRelIds" parameterType="String">
+        delete from sim_real_exam_collection_dept where rel_id in
+        <foreach item="relId" collection="array" open="(" separator="," close=")">
+            #{relId}
+        </foreach>
+    </delete>
+</mapper>