Prechádzať zdrojové kódy

王子文 专项培训

wangggziwen 3 rokov pred
rodič
commit
c81733256e

+ 103 - 0
master/src/main/java/com/ruoyi/project/training/spec/controller/TStQuestionBankController.java

@@ -0,0 +1,103 @@
+package com.ruoyi.project.training.spec.controller;
+
+import java.util.List;
+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.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.project.training.spec.domain.TStQuestionBank;
+import com.ruoyi.project.training.spec.service.ITStQuestionBankService;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.web.page.TableDataInfo;
+
+/**
+ * 专项培训题库Controller
+ *
+ * @author ruoyi
+ * @date 2022-04-28
+ */
+@RestController
+@RequestMapping("/spec/bank")
+public class TStQuestionBankController extends BaseController
+{
+    @Autowired
+    private ITStQuestionBankService tStQuestionBankService;
+
+    /**
+     * 查询专项培训题库列表
+     */
+    @PreAuthorize("@ss.hasPermi('spec:bank:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TStQuestionBank tStQuestionBank)
+    {
+        startPage();
+        List<TStQuestionBank> list = tStQuestionBankService.selectTStQuestionBankList(tStQuestionBank);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出专项培训题库列表
+     */
+    @PreAuthorize("@ss.hasPermi('spec:bank:export')")
+    @Log(title = "专项培训题库", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(TStQuestionBank tStQuestionBank)
+    {
+        List<TStQuestionBank> list = tStQuestionBankService.selectTStQuestionBankList(tStQuestionBank);
+        ExcelUtil<TStQuestionBank> util = new ExcelUtil<TStQuestionBank>(TStQuestionBank.class);
+        return util.exportExcel(list, "bank");
+    }
+
+    /**
+     * 获取专项培训题库详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('spec:bank:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(tStQuestionBankService.selectTStQuestionBankById(id));
+    }
+
+    /**
+     * 新增专项培训题库
+     */
+    @PreAuthorize("@ss.hasPermi('spec:bank:add')")
+    @Log(title = "专项培训题库", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TStQuestionBank tStQuestionBank)
+    {
+        return toAjax(tStQuestionBankService.insertTStQuestionBank(tStQuestionBank));
+    }
+
+    /**
+     * 修改专项培训题库
+     */
+    @PreAuthorize("@ss.hasPermi('spec:bank:edit')")
+    @Log(title = "专项培训题库", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TStQuestionBank tStQuestionBank)
+    {
+        return toAjax(tStQuestionBankService.updateTStQuestionBank(tStQuestionBank));
+    }
+
+    /**
+     * 删除专项培训题库
+     */
+    @PreAuthorize("@ss.hasPermi('spec:bank:remove')")
+    @Log(title = "专项培训题库", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(tStQuestionBankService.deleteTStQuestionBankByIds(ids));
+    }
+}

+ 65 - 0
master/src/main/java/com/ruoyi/project/training/spec/domain/TStQuestionBank.java

@@ -0,0 +1,65 @@
+package com.ruoyi.project.training.spec.domain;
+
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import com.ruoyi.framework.web.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 专项培训题库对象 t_st_question_bank
+ *
+ * @author ruoyi
+ * @date 2022-04-28
+ */
+public class TStQuestionBank extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 问题 */
+    @Excel(name = "问题")
+    private String question;
+
+    /** 问题类型 */
+    @Excel(name = "问题类型")
+    private Long questionType;
+
+    public void setId(Long id)
+    {
+        this.id = id;
+    }
+
+    public Long getId()
+    {
+        return id;
+    }
+    public void setQuestion(String question)
+    {
+        this.question = question;
+    }
+
+    public String getQuestion()
+    {
+        return question;
+    }
+    public void setQuestionType(Long questionType)
+    {
+        this.questionType = questionType;
+    }
+
+    public Long getQuestionType()
+    {
+        return questionType;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("question", getQuestion())
+            .append("questionType", getQuestionType())
+            .toString();
+    }
+}

+ 63 - 0
master/src/main/java/com/ruoyi/project/training/spec/mapper/TStQuestionBankMapper.java

@@ -0,0 +1,63 @@
+package com.ruoyi.project.training.spec.mapper;
+
+import java.util.List;
+import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
+import com.ruoyi.project.training.spec.domain.TStQuestionBank;
+
+/**
+ * 专项培训题库Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2022-04-28
+ */
+public interface TStQuestionBankMapper 
+{
+    /**
+     * 查询专项培训题库
+     * 
+     * @param id 专项培训题库ID
+     * @return 专项培训题库
+     */
+    public TStQuestionBank selectTStQuestionBankById(Long id);
+
+    /**
+     * 查询专项培训题库列表
+     * 
+     * @param tStQuestionBank 专项培训题库
+     * @return 专项培训题库集合
+     */
+    @DataScope(deptAlias = "d")
+    public List<TStQuestionBank> selectTStQuestionBankList(TStQuestionBank tStQuestionBank);
+
+    /**
+     * 新增专项培训题库
+     * 
+     * @param tStQuestionBank 专项培训题库
+     * @return 结果
+     */
+    public int insertTStQuestionBank(TStQuestionBank tStQuestionBank);
+
+    /**
+     * 修改专项培训题库
+     * 
+     * @param tStQuestionBank 专项培训题库
+     * @return 结果
+     */
+    public int updateTStQuestionBank(TStQuestionBank tStQuestionBank);
+
+    /**
+     * 删除专项培训题库
+     * 
+     * @param id 专项培训题库ID
+     * @return 结果
+     */
+    public int deleteTStQuestionBankById(Long id);
+
+    /**
+     * 批量删除专项培训题库
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteTStQuestionBankByIds(Long[] ids);
+}

+ 61 - 0
master/src/main/java/com/ruoyi/project/training/spec/service/ITStQuestionBankService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.project.training.spec.service;
+
+import java.util.List;
+import com.ruoyi.project.training.spec.domain.TStQuestionBank;
+
+/**
+ * 专项培训题库Service接口
+ * 
+ * @author ruoyi
+ * @date 2022-04-28
+ */
+public interface ITStQuestionBankService 
+{
+    /**
+     * 查询专项培训题库
+     * 
+     * @param id 专项培训题库ID
+     * @return 专项培训题库
+     */
+    public TStQuestionBank selectTStQuestionBankById(Long id);
+
+    /**
+     * 查询专项培训题库列表
+     * 
+     * @param tStQuestionBank 专项培训题库
+     * @return 专项培训题库集合
+     */
+    public List<TStQuestionBank> selectTStQuestionBankList(TStQuestionBank tStQuestionBank);
+
+    /**
+     * 新增专项培训题库
+     * 
+     * @param tStQuestionBank 专项培训题库
+     * @return 结果
+     */
+    public int insertTStQuestionBank(TStQuestionBank tStQuestionBank);
+
+    /**
+     * 修改专项培训题库
+     * 
+     * @param tStQuestionBank 专项培训题库
+     * @return 结果
+     */
+    public int updateTStQuestionBank(TStQuestionBank tStQuestionBank);
+
+    /**
+     * 批量删除专项培训题库
+     * 
+     * @param ids 需要删除的专项培训题库ID
+     * @return 结果
+     */
+    public int deleteTStQuestionBankByIds(Long[] ids);
+
+    /**
+     * 删除专项培训题库信息
+     * 
+     * @param id 专项培训题库ID
+     * @return 结果
+     */
+    public int deleteTStQuestionBankById(Long id);
+}

+ 93 - 0
master/src/main/java/com/ruoyi/project/training/spec/service/impl/TStQuestionBankServiceImpl.java

@@ -0,0 +1,93 @@
+package com.ruoyi.project.training.spec.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.project.training.spec.mapper.TStQuestionBankMapper;
+import com.ruoyi.project.training.spec.domain.TStQuestionBank;
+import com.ruoyi.project.training.spec.service.ITStQuestionBankService;
+
+/**
+ * 专项培训题库Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2022-04-28
+ */
+@Service
+public class TStQuestionBankServiceImpl implements ITStQuestionBankService
+{
+    @Autowired
+    private TStQuestionBankMapper tStQuestionBankMapper;
+
+    /**
+     * 查询专项培训题库
+     *
+     * @param id 专项培训题库ID
+     * @return 专项培训题库
+     */
+    @Override
+    public TStQuestionBank selectTStQuestionBankById(Long id)
+    {
+        return tStQuestionBankMapper.selectTStQuestionBankById(id);
+    }
+
+    /**
+     * 查询专项培训题库列表
+     *
+     * @param tStQuestionBank 专项培训题库
+     * @return 专项培训题库
+     */
+    @Override
+    public List<TStQuestionBank> selectTStQuestionBankList(TStQuestionBank tStQuestionBank)
+    {
+        return tStQuestionBankMapper.selectTStQuestionBankList(tStQuestionBank);
+    }
+
+    /**
+     * 新增专项培训题库
+     *
+     * @param tStQuestionBank 专项培训题库
+     * @return 结果
+     */
+    @Override
+    public int insertTStQuestionBank(TStQuestionBank tStQuestionBank)
+    {
+        return tStQuestionBankMapper.insertTStQuestionBank(tStQuestionBank);
+    }
+
+    /**
+     * 修改专项培训题库
+     *
+     * @param tStQuestionBank 专项培训题库
+     * @return 结果
+     */
+    @Override
+    public int updateTStQuestionBank(TStQuestionBank tStQuestionBank)
+    {
+        return tStQuestionBankMapper.updateTStQuestionBank(tStQuestionBank);
+    }
+
+    /**
+     * 批量删除专项培训题库
+     *
+     * @param ids 需要删除的专项培训题库ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTStQuestionBankByIds(Long[] ids)
+    {
+        return tStQuestionBankMapper.deleteTStQuestionBankByIds(ids);
+    }
+
+    /**
+     * 删除专项培训题库信息
+     *
+     * @param id 专项培训题库ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTStQuestionBankById(Long id)
+    {
+        return tStQuestionBankMapper.deleteTStQuestionBankById(id);
+    }
+}

+ 3 - 0
master/src/main/resources/mybatis/training/spec/TStFeedbackMapper.xml

@@ -69,6 +69,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
         
     <insert id="insertTStFeedback" parameterType="TStFeedback">
+        <selectKey keyProperty="id" resultType="long" order="BEFORE">
+            SELECT seq_t_st_feedback.NEXTVAL as id FROM DUAL
+        </selectKey>
         insert into t_st_feedback
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="id != null">id,</if>

+ 69 - 0
master/src/main/resources/mybatis/training/spec/TStQuestionBankMapper.xml

@@ -0,0 +1,69 @@
+<?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.project.training.spec.mapper.TStQuestionBankMapper">
+    
+    <resultMap type="TStQuestionBank" id="TStQuestionBankResult">
+        <result property="id"    column="id"    />
+        <result property="question"    column="question"    />
+        <result property="questionType"    column="question_type"    />
+        <result property="deptName" column="dept_name" />
+    </resultMap>
+
+    <sql id="selectTStQuestionBankVo">
+        select d.id, d.question, d.question_type ,s.dept_name from t_st_question_bank d
+      left join sys_dept s on s.dept_id = d.dept_id
+    </sql>
+
+    <select id="selectTStQuestionBankList" parameterType="TStQuestionBank" resultMap="TStQuestionBankResult">
+        <include refid="selectTStQuestionBankVo"/>
+        <where>  
+            <if test="question != null  and question != ''"> and question = #{question}</if>
+            <if test="questionType != null "> and question_type = #{questionType}</if>
+            and d.del_flag = 0
+        </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+    </select>
+    
+    <select id="selectTStQuestionBankById" parameterType="Long" resultMap="TStQuestionBankResult">
+        <include refid="selectTStQuestionBankVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertTStQuestionBank" parameterType="TStQuestionBank">
+        insert into t_st_question_bank
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="question != null">question,</if>
+            <if test="questionType != null">question_type,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="question != null">#{question},</if>
+            <if test="questionType != null">#{questionType},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTStQuestionBank" parameterType="TStQuestionBank">
+        update t_st_question_bank
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="question != null">question = #{question},</if>
+            <if test="questionType != null">question_type = #{questionType},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <update id="deleteTStQuestionBankById" parameterType="Long">
+        update t_st_question_bank set del_flag = 2 where id = #{id}
+    </update>
+
+    <update id="deleteTStQuestionBankByIds" parameterType="String">
+        update t_st_question_bank set del_flag = 2 where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+    
+</mapper>