小么熊🐻 4 년 전
부모
커밋
bd9096b064

+ 51 - 38
zzjs-admin/src/main/java/com/miaxis/app/controller/question/QuestionInfoController.java

@@ -7,10 +7,10 @@ import com.miaxis.common.core.page.ResponsePageInfo;
 import com.miaxis.common.enums.BusinessTypeEnum;
 import com.miaxis.common.utils.poi.ExcelUtil;
 import com.miaxis.question.domain.QuestionInfo;
+import com.miaxis.question.dto.QuestionInfoDto;
 import com.miaxis.question.service.IQuestionInfoService;
 import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Arrays;
@@ -45,65 +45,78 @@ public class QuestionInfoController extends BaseController{
         return toResponsePageInfo(list);
     }
 
+    @GetMapping("/getQuestionInfoList")
+    @ApiOperation("查询题库列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
+            @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
+    })
+    public ResponsePageInfo<QuestionInfo> getQuestionInfoList(@ModelAttribute QuestionInfoDto questionInfoDto){
+        startPage();
+        List<QuestionInfo> list = questionInfoService.getQuestionInfoList(questionInfoDto);
+        return toResponsePageInfo(list);
+    }
+
+
     /**
      * 导出题库列表
      */
 //    @PreAuthorize("@ss.hasPermi('question:info:export')")
-    @Log(title = "题库", businessType = BusinessTypeEnum.EXPORT)
-    @GetMapping("/export")
-    @ApiOperation("导出题库列表Excel")
-    public Response<String> export(@ModelAttribute QuestionInfo questionInfo){
-        List<QuestionInfo> list = questionInfoService.selectQuestionInfoList(questionInfo);
-        ExcelUtil<QuestionInfo> util = new ExcelUtil<QuestionInfo>(QuestionInfo.class);
-        return util.exportExcel(list, "info");
-    }
+//    @Log(title = "题库", businessType = BusinessTypeEnum.EXPORT)
+//    @GetMapping("/export")
+//    @ApiOperation("导出题库列表Excel")
+//    public Response<String> export(@ModelAttribute QuestionInfo questionInfo){
+//        List<QuestionInfo> list = questionInfoService.selectQuestionInfoList(questionInfo);
+//        ExcelUtil<QuestionInfo> util = new ExcelUtil<QuestionInfo>(QuestionInfo.class);
+//        return util.exportExcel(list, "info");
+//    }
 
     /**
      * 获取题库详细信息
      */
 //    @PreAuthorize("@ss.hasPermi('question:info:query')")
-    @GetMapping(value = "/{id}")
-    @ApiOperation("获取题库详细信息")
-    public Response<QuestionInfo> getInfo(
-            @ApiParam(name = "id", value = "题库参数", required = true)
-            @PathVariable("id") Long id
-    ){
-        return Response.success(questionInfoService.getById(id));
-    }
+//    @GetMapping(value = "/{id}")
+//    @ApiOperation("获取题库详细信息")
+//    public Response<QuestionInfo> getInfo(
+//            @ApiParam(name = "id", value = "题库参数", required = true)
+//            @PathVariable("id") Long id
+//    ){
+//        return Response.success(questionInfoService.getById(id));
+//    }
 
     /**
      * 新增题库
      */
 //    @PreAuthorize("@ss.hasPermi('question:info:add')")
-    @Log(title = "题库", businessType = BusinessTypeEnum.INSERT)
-    @PostMapping
-    @ApiOperation("新增题库")
-    public Response<Integer> add(@RequestBody QuestionInfo questionInfo){
-        return toResponse(questionInfoService.save(questionInfo) ? 1 : 0);
-    }
+//    @Log(title = "题库", businessType = BusinessTypeEnum.INSERT)
+//    @PostMapping
+//    @ApiOperation("新增题库")
+//    public Response<Integer> add(@RequestBody QuestionInfo questionInfo){
+//        return toResponse(questionInfoService.save(questionInfo) ? 1 : 0);
+//    }
 
     /**
      * 修改题库
      */
 //    @PreAuthorize("@ss.hasPermi('question:info:edit')")
-    @Log(title = "题库", businessType = BusinessTypeEnum.UPDATE)
-    @PutMapping
-    @ApiOperation("修改题库")
-    public Response<Integer> edit(@RequestBody QuestionInfo questionInfo){
-        return toResponse(questionInfoService.updateById(questionInfo) ? 1 : 0);
-    }
+//    @Log(title = "题库", businessType = BusinessTypeEnum.UPDATE)
+//    @PutMapping
+//    @ApiOperation("修改题库")
+//    public Response<Integer> edit(@RequestBody QuestionInfo questionInfo){
+//        return toResponse(questionInfoService.updateById(questionInfo) ? 1 : 0);
+//    }
 
     /**
      * 删除题库
      */
 //    @PreAuthorize("@ss.hasPermi('question:info: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(questionInfoService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
-    }
+//    @Log(title = "题库", businessType = BusinessTypeEnum.DELETE)
+//	@DeleteMapping("/{ids}")
+//    @ApiOperation("删除题库")
+//    public  Response<Integer> remove(
+//            @ApiParam(name = "ids", value = "题库ids参数", required = true)
+//            @PathVariable Long[] ids
+//    ){
+//        return toResponse(questionInfoService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
+//    }
 }

+ 59 - 0
zzjs-service/src/main/java/com/miaxis/question/dto/QuestionInfoDto.java

@@ -0,0 +1,59 @@
+package com.miaxis.question.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.miaxis.common.annotation.Excel;
+import com.miaxis.common.core.domain.BaseBusinessEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 题库对象 question_info
+ *
+ * @author miaxis
+ * @date 2021-03-12
+ */
+@Data
+@ApiModel(value = "QuestionInfoDto", description = "题库传参")
+public class QuestionInfoDto extends BaseBusinessEntity{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    @TableId("id")
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    /** 类型 */
+    @Excel(name = "类型 1:选择题 2:单选题 3:多选题")
+    @TableField("type")
+    @ApiModelProperty(value = "类型 1:选择题 2:单选题 3:多选题")
+    private Long type;
+
+
+    /** 许可车型 */
+    @Excel(name = "许可车型")
+    @TableField("license_type")
+    @ApiModelProperty(value = "许可车型")
+    private String licenseType;
+
+
+    /** 科目 */
+    @Excel(name = "科目")
+    @TableField("kemu")
+    @ApiModelProperty(value = "科目")
+    private Long kemu;
+
+
+    /**
+     * 是否显示
+     */
+    @Excel(name = "是否显示")
+    @TableField("show_option_type")
+    @ApiModelProperty(value = "是否显示")
+    private Long showOptionType;
+
+}

+ 2 - 0
zzjs-service/src/main/java/com/miaxis/question/mapper/QuestionInfoMapper.java

@@ -3,6 +3,7 @@ package com.miaxis.question.mapper;
 import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.miaxis.question.domain.QuestionInfo;
+import com.miaxis.question.dto.QuestionInfoDto;
 
 /**
  * 题库Mapper接口
@@ -19,4 +20,5 @@ public interface QuestionInfoMapper extends BaseMapper<QuestionInfo> {
      */
     public List<QuestionInfo> selectQuestionInfoList(QuestionInfo questionInfo);
 
+    List<QuestionInfo> getQuestionInfoList(QuestionInfoDto questionInfoDto);
 }

+ 3 - 0
zzjs-service/src/main/java/com/miaxis/question/service/IQuestionInfoService.java

@@ -3,6 +3,7 @@ package com.miaxis.question.service;
 import java.util.List;
 import com.miaxis.question.domain.QuestionInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.miaxis.question.dto.QuestionInfoDto;
 
 /**
  * 题库Service接口
@@ -18,4 +19,6 @@ public interface IQuestionInfoService extends IService<QuestionInfo>{
      * @return 题库集合
      */
     public List<QuestionInfo> selectQuestionInfoList(QuestionInfo questionInfo);
+
+    List<QuestionInfo> getQuestionInfoList(QuestionInfoDto questionInfoDto);
 }

+ 6 - 0
zzjs-service/src/main/java/com/miaxis/question/service/impl/QuestionInfoServiceImpl.java

@@ -4,6 +4,7 @@ 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.question.dto.QuestionInfoDto;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.apache.commons.lang3.StringUtils;
@@ -32,4 +33,9 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
     public List<QuestionInfo> selectQuestionInfoList(QuestionInfo questionInfo){
         return questionInfoMapper.selectQuestionInfoList(questionInfo);
     }
+
+    @Override
+    public List<QuestionInfo> getQuestionInfoList(QuestionInfoDto questionInfoDto) {
+        return questionInfoMapper.getQuestionInfoList(questionInfoDto);
+    }
 }

+ 198 - 0
zzjs-service/src/main/java/com/miaxis/question/vo/QuestionInfoVo.java

@@ -0,0 +1,198 @@
+package com.miaxis.question.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.miaxis.common.annotation.Excel;
+import com.miaxis.common.core.domain.BaseBusinessEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 题库对象 question_info
+ *
+ * @author miaxis
+ * @date 2021-03-12
+ */
+@Data
+@ApiModel(value = "QuestionInfoVo", description = "题库对象出参")
+public class QuestionInfoVo extends BaseBusinessEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    @TableId("id")
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    /**
+     * 类型
+     */
+    @Excel(name = "类型 1:选择题 2:单选题 3:多选题")
+    @TableField("type")
+    @ApiModelProperty(value = "类型 1:选择题 2:单选题 3:多选题")
+    private Long type;
+
+
+    /**
+     * 许可车型
+     */
+    @Excel(name = "许可车型")
+    @TableField("license_type")
+    @ApiModelProperty(value = "许可车型")
+    private String licenseType;
+
+    /**
+     * 问题
+     */
+    @Excel(name = "问题")
+    @TableField("question")
+    @ApiModelProperty(value = "问题")
+    private String question;
+
+    /**
+     * 答案1
+     */
+    @Excel(name = "答案1")
+    @TableField("an1")
+    @ApiModelProperty(value = "答案1")
+    private String an1;
+
+    /**
+     * 答案2
+     */
+    @Excel(name = "答案2")
+    @TableField("an2")
+    @ApiModelProperty(value = "答案2")
+    private String an2;
+
+    /**
+     * 答案3
+     */
+    @Excel(name = "答案3")
+    @TableField("an3")
+    @ApiModelProperty(value = "答案3")
+    private String an3;
+
+    /**
+     * 答案4
+     */
+    @Excel(name = "答案4")
+    @TableField("an4")
+    @ApiModelProperty(value = "答案4")
+    private String an4;
+
+    /**
+     * 答案5
+     */
+    @Excel(name = "答案5")
+    @TableField("an5")
+    @ApiModelProperty(value = "答案5")
+    private String an5;
+
+    /**
+     * 答案6
+     */
+    @Excel(name = "答案6")
+    @TableField("an6")
+    @ApiModelProperty(value = "答案6")
+    private String an6;
+
+    /**
+     * 答案7
+     */
+    @Excel(name = "答案7")
+    @TableField("an7")
+    @ApiModelProperty(value = "答案7")
+    private String an7;
+
+    /**
+     * 正确答案
+     */
+    @Excel(name = "正确答案")
+    @TableField("answer_true")
+    @ApiModelProperty(value = "正确答案")
+    private String answerTrue;
+
+    /**
+     * 解释
+     */
+    @Excel(name = "解释")
+    @TableField("explain1")
+    @ApiModelProperty(value = "解释")
+    private String explain1;
+
+    /**
+     * 最佳答案
+     */
+    @Excel(name = "最佳答案")
+    @TableField("best_answer_id")
+    @ApiModelProperty(value = "最佳答案")
+    private String bestAnswerId;
+
+    /**
+     * 科目
+     */
+    @Excel(name = "科目")
+    @TableField("kemu")
+    @ApiModelProperty(value = "科目")
+    private Long kemu;
+
+    /**
+     * 更多类型
+     */
+    @Excel(name = "更多类型")
+    @TableField("moretypes")
+    @ApiModelProperty(value = "更多类型")
+    private String moretypes;
+
+
+    /**
+     * 图片文件名
+     */
+    @Excel(name = "图片文件名")
+    @TableField("sinaimg")
+    @ApiModelProperty(value = "图片文件名")
+    private String sinaimg;
+
+    /**
+     * 视频文件名
+     */
+    @Excel(name = "视频文件名")
+    @TableField("video_url")
+    @ApiModelProperty(value = "视频文件名")
+    private String videoUrl;
+
+
+    /**
+     * 城市
+     */
+    @Excel(name = "城市")
+    @TableField("cityid")
+    @ApiModelProperty(value = "城市")
+    private Long cityid;
+
+
+
+    /**
+     * 文件地址
+     */
+    @Excel(name = "文件地址")
+    @TableField("media_url")
+    @ApiModelProperty(value = "文件地址")
+    private String mediaUrl;
+
+    /**
+     * 是否显示
+     */
+    @Excel(name = "是否显示")
+    @TableField("show_option_type")
+    @ApiModelProperty(value = "是否显示")
+    private Long showOptionType;
+
+}
+

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

@@ -77,4 +77,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </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>