小么熊🐻 4 years ago
parent
commit
766a3d2ff1

+ 117 - 0
zzjs-service/src/main/java/com/miaxis/question/controller/QuestionErrorController.java

@@ -0,0 +1,117 @@
+package com.miaxis.question.controller;
+
+import com.miaxis.common.constant.Constants;
+import java.util.List;
+import java.util.Arrays;
+import io.swagger.annotations.*;
+import com.miaxis.common.core.domain.Response;
+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 org.springframework.web.bind.annotation.ModelAttribute;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.enums.BusinessTypeEnum;
+import com.miaxis.question.domain.QuestionError;
+import com.miaxis.question.service.IQuestionErrorService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 【错题】Controller
+ *
+ * @author miaxis
+ * @date 2021-03-16
+ */
+@RestController
+@RequestMapping("/error/error")
+@Api(tags={"【小程序-错题】"})
+public class QuestionErrorController extends BaseController{
+    @Autowired
+    private IQuestionErrorService questionErrorService;
+
+    /**
+     * 查询错题列表
+     */
+    @PreAuthorize("@ss.hasPermi('error:error:list')")
+    @GetMapping("/list")
+    @ApiOperation("查询错题列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
+            @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
+    })
+    public ResponsePageInfo<QuestionError> list(@ModelAttribute QuestionError questionError){
+        startPage();
+        List<QuestionError> list = questionErrorService.selectQuestionErrorList(questionError);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出错题列表
+     */
+    @PreAuthorize("@ss.hasPermi('error:error:export')")
+    @Log(title = "错题", businessType = BusinessTypeEnum.EXPORT)
+    @GetMapping("/export")
+    @ApiOperation("导出错题列表Excel")
+    public Response<String> export(@ModelAttribute QuestionError questionError){
+        List<QuestionError> list = questionErrorService.selectQuestionErrorList(questionError);
+        ExcelUtil<QuestionError> util = new ExcelUtil<QuestionError>(QuestionError.class);
+        return util.exportExcel(list, "error");
+    }
+
+    /**
+     * 获取错题详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('error:error:query')")
+    @GetMapping(value = "/{id}")
+    @ApiOperation("获取错题详细信息")
+    public Response<QuestionError> getInfo(
+            @ApiParam(name = "id", value = "错题参数", required = true)
+            @PathVariable("id") Long id
+    ){
+        return Response.success(questionErrorService.getById(id));
+    }
+
+    /**
+     * 新增错题
+     */
+    @PreAuthorize("@ss.hasPermi('error:error:add')")
+    @Log(title = "错题", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    @ApiOperation("新增错题")
+    public Response<Integer> add(@RequestBody QuestionError questionError){
+        return toResponse(questionErrorService.save(questionError) ? 1 : 0);
+    }
+
+    /**
+     * 修改错题
+     */
+    @PreAuthorize("@ss.hasPermi('error:error:edit')")
+    @Log(title = "错题", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    @ApiOperation("修改错题")
+    public Response<Integer> edit(@RequestBody QuestionError questionError){
+        return toResponse(questionErrorService.updateById(questionError) ? 1 : 0);
+    }
+
+    /**
+     * 删除错题
+     */
+    @PreAuthorize("@ss.hasPermi('error:error:remove')")
+    @Log(title = "错题", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{ids}")
+    @ApiOperation("删除错题")
+    public  Response<Integer> remove(
+            @ApiParam(name = "ids", value = "错题ids参数", required = true)
+            @PathVariable Long[] ids
+    ){
+        return toResponse(questionErrorService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
+    }
+}

+ 76 - 0
zzjs-service/src/main/java/com/miaxis/question/domain/QuestionError.java

@@ -0,0 +1,76 @@
+package com.miaxis.question.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.miaxis.common.annotation.Excel;
+import com.miaxis.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.miaxis.common.core.domain.BaseBusinessEntity;
+import lombok.Data;
+/**
+ * 错题对象 question_error
+ *
+ * @author miaxis
+ * @date 2021-03-16
+ */
+@Data
+@TableName("question_error")
+@ApiModel(value = "QuestionError", description = "错题对象 question_error")
+public class QuestionError extends BaseBusinessEntity{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    @TableId(value = "id")
+    @ApiModelProperty(value = "id")
+    private Long id;
+
+    /** 用户id */
+    @Excel(name = "用户id")
+    @TableField("user_id")
+    @ApiModelProperty(value = "用户id")
+    private Long userId;
+
+    /** 题目id */
+    @Excel(name = "题目id")
+    @TableField("question_id")
+    @ApiModelProperty(value = "题目id")
+    private Long questionId;
+
+    public void setId(Long id){
+        this.id = id;
+    }
+
+    public Long getId(){
+        return id;
+    }
+    public void setUserId(Long userId){
+        this.userId = userId;
+    }
+
+    public Long getUserId(){
+        return userId;
+    }
+    public void setQuestionId(Long questionId){
+        this.questionId = questionId;
+    }
+
+    public Long getQuestionId(){
+        return questionId;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("userId", getUserId())
+            .append("questionId", getQuestionId())
+            .append("createTime", getCreateTime())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 22 - 0
zzjs-service/src/main/java/com/miaxis/question/mapper/QuestionErrorMapper.java

@@ -0,0 +1,22 @@
+package com.miaxis.question.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.miaxis.question.domain.QuestionError;
+
+/**
+ * 错题Mapper接口
+ *
+ * @author miaxis
+ * @date 2021-03-16
+ */
+public interface QuestionErrorMapper extends BaseMapper<QuestionError> {
+    /**
+     * 查询错题列表
+     *
+     * @param questionError 错题
+     * @return 错题集合
+     */
+    public List<QuestionError> selectQuestionErrorList(QuestionError questionError);
+
+}

+ 21 - 0
zzjs-service/src/main/java/com/miaxis/question/service/IQuestionErrorService.java

@@ -0,0 +1,21 @@
+package com.miaxis.question.service;
+
+import java.util.List;
+import com.miaxis.question.domain.QuestionError;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 错题Service接口
+ *
+ * @author miaxis
+ * @date 2021-03-16
+ */
+public interface IQuestionErrorService extends IService<QuestionError>{
+    /**
+     * 查询错题列表
+     *
+     * @param questionError 错题
+     * @return 错题集合
+     */
+    public List<QuestionError> selectQuestionErrorList(QuestionError questionError);
+}

+ 36 - 0
zzjs-service/src/main/java/com/miaxis/question/service/impl/QuestionErrorServiceImpl.java

@@ -0,0 +1,36 @@
+package com.miaxis.question.service.impl;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.miaxis.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.apache.commons.lang3.StringUtils;
+import com.miaxis.question.mapper.QuestionErrorMapper;
+import com.miaxis.question.domain.QuestionError;
+import com.miaxis.question.service.IQuestionErrorService;
+
+/**
+ * 错题Service业务层处理
+ *
+ * @author miaxis
+ * @date 2021-03-16
+ */
+@Service
+public class QuestionErrorServiceImpl extends ServiceImpl<QuestionErrorMapper, QuestionError> implements IQuestionErrorService {
+    @Autowired
+    private QuestionErrorMapper questionErrorMapper;
+
+    /**
+     * 查询错题列表
+     *
+     * @param questionError 错题
+     * @return 错题
+     */
+    @Override
+    public List<QuestionError> selectQuestionErrorList(QuestionError questionError){
+        return questionErrorMapper.selectQuestionErrorList(questionError);
+    }
+}

+ 0 - 92
zzjs-service/src/main/resources/mapper/question/QuestionInfoMapper.xml

@@ -1,92 +0,0 @@
-<?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.miaxis.question.mapper.QuestionInfoMapper">
-
-    <resultMap type="QuestionInfo" id="QuestionInfoResult">
-        <result property="id"    column="id"    />
-        <result property="type"    column="type"    />
-        <result property="intNumber"    column="int_number"    />
-        <result property="strTppe"    column="str_tppe"    />
-        <result property="strTypeL"    column="str_type_l"    />
-        <result property="licenseType"    column="license_type"    />
-        <result property="question"    column="question"    />
-        <result property="an1"    column="an1"    />
-        <result property="an2"    column="an2"    />
-        <result property="an3"    column="an3"    />
-        <result property="an4"    column="an4"    />
-        <result property="an5"    column="an5"    />
-        <result property="an6"    column="an6"    />
-        <result property="an7"    column="an7"    />
-        <result property="answerTrue"    column="answer_true"    />
-        <result property="explain1"    column="explain1"    />
-        <result property="bestAnswerId"    column="best_answer_id"    />
-        <result property="kemu"    column="kemu"    />
-        <result property="jieshiFrom"    column="jieshi_from"    />
-        <result property="moretypes"    column="moretypes"    />
-        <result property="chapterid"    column="chapterid"    />
-        <result property="sinaimg"    column="sinaimg"    />
-        <result property="videoUrl"    column="video_url"    />
-        <result property="diffDegree"    column="diff_degree"    />
-        <result property="cityid"    column="cityid"    />
-        <result property="gs"    column="gs"    />
-        <result property="keyword"    column="keyword"    />
-        <result property="errorRate"    column="error_rate"    />
-        <result property="mediaUrl"    column="media_url"    />
-        <result property="showOptionType"    column="show_option_type"    />
-    </resultMap>
-
-    <sql id="selectQuestionInfoVo">
-        select id, type, int_number, str_tppe, str_type_l, license_type, question, an1, an2, an3, an4, an5, an6, an7, answer_true, explain1, best_answer_id, kemu, jieshi_from, moretypes, chapterid, sinaimg, video_url, diff_degree, cityid, gs, keyword, error_rate, media_url, show_option_type from question_info
-    </sql>
-
-    <select id="selectQuestionInfoList" parameterType="QuestionInfo" resultMap="QuestionInfoResult">
-        <include refid="selectQuestionInfoVo"/>
-        <where>
-            <if test="id != null "> and id = #{id}</if>
-            <if test="type != null "> and type = #{type}</if>
-            <if test="intNumber != null  and intNumber != ''"> and int_number = #{intNumber}</if>
-            <if test="strTppe != null  and strTppe != ''"> and str_tppe = #{strTppe}</if>
-            <if test="strTypeL != null  and strTypeL != ''"> and str_type_l = #{strTypeL}</if>
-            <if test="licenseType != null  and licenseType != ''"> and license_type = #{licenseType}</if>
-            <if test="question != null  and question != ''"> and question = #{question}</if>
-            <if test="an1 != null  and an1 != ''"> and an1 = #{an1}</if>
-            <if test="an2 != null  and an2 != ''"> and an2 = #{an2}</if>
-            <if test="an3 != null  and an3 != ''"> and an3 = #{an3}</if>
-            <if test="an4 != null  and an4 != ''"> and an4 = #{an4}</if>
-            <if test="an5 != null  and an5 != ''"> and an5 = #{an5}</if>
-            <if test="an6 != null  and an6 != ''"> and an6 = #{an6}</if>
-            <if test="an7 != null  and an7 != ''"> and an7 = #{an7}</if>
-            <if test="answerTrue != null  and answerTrue != ''"> and answer_true = #{answerTrue}</if>
-            <if test="explain1 != null  and explain1 != ''"> and explain1 = #{explain1}</if>
-            <if test="bestAnswerId != null  and bestAnswerId != ''"> and best_answer_id = #{bestAnswerId}</if>
-            <if test="kemu != null "> and kemu = #{kemu}</if>
-            <if test="jieshiFrom != null  and jieshiFrom != ''"> and jieshi_from = #{jieshiFrom}</if>
-            <if test="moretypes != null  and moretypes != ''"> and moretypes = #{moretypes}</if>
-            <if test="chapterid != null "> and chapterid = #{chapterid}</if>
-            <if test="sinaimg != null  and sinaimg != ''"> and sinaimg = #{sinaimg}</if>
-            <if test="videoUrl != null  and videoUrl != ''"> and video_url = #{videoUrl}</if>
-            <if test="diffDegree != null "> and diff_degree = #{diffDegree}</if>
-            <if test="cityid != null "> and cityid = #{cityid}</if>
-            <if test="gs != null  and gs != ''"> and gs = #{gs}</if>
-            <if test="keyword != null  and keyword != ''"> and keyword = #{keyword}</if>
-            <if test="errorRate != null "> and error_rate = #{errorRate}</if>
-            <if test="mediaUrl != null  and mediaUrl != ''"> and media_url = #{mediaUrl}</if>
-            <if test="showOptionType != null "> and show_option_type = #{showOptionType}</if>
-        </where>
-    </select>
-
-
-    <select id="getQuestionInfoList" parameterType="com.miaxis.question.dto.QuestionInfoDto" resultType="com.miaxis.question.vo.QuestionInfoVo">
-        select id, type, question, an1, an2, an3, an4, an5, an6, an7, answer_true, explain1, best_answer_id, kemu, chapterid, sinaimg, video_url, cityid, media_url, show_option_type from question_info
-        <where>
-            <if test="id != null "> and id = #{id}</if>
-            <if test="type != null "> and type = #{type}</if>
-            <if test="licenseType != null  and licenseType != ''"> and license_type like '%#{licenseType}%'</if>
-            <if test="kemu != null "> and kemu = #{kemu}</if>
-            <if test="showOptionType != null "> and show_option_type = #{showOptionType}</if>
-        </where>
-    </select>
-
-</mapper>