he2802 3 سال پیش
والد
کامیت
6875e7a40f

+ 81 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/cmmon/CommonGoodsController.java

@@ -0,0 +1,81 @@
+package com.zhongzheng.controller.cmmon;
+
+import com.zhongzheng.common.core.controller.BaseController;
+import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.common.core.page.TableDataInfo;
+import com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo;
+import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
+import com.zhongzheng.modules.goods.service.IGoodsAttachedService;
+import com.zhongzheng.modules.goods.service.IGoodsService;
+import com.zhongzheng.modules.goods.vo.GoodsAttachedVo;
+import com.zhongzheng.modules.goods.vo.GoodsVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 商品Controller
+ *
+ * @author hjl
+ * @date 2021-10-12
+ */
+@Api(value = "商品控制器", tags = {"商品管理"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/app/common/goods")
+public class CommonGoodsController extends BaseController {
+
+    private final IGoodsService iGoodsService;
+
+    private final IGoodsAttachedService iGoodsAttachedService;
+
+    /**
+     * 查询商品列表
+     */
+    @ApiOperation("查询商品列表")
+    @GetMapping("/list")
+    public TableDataInfo<GoodsVo> list(GoodsQueryBo bo) {
+        bo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
+        startPage();
+        List<GoodsVo> list = iGoodsService.selectList(bo);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出商品列表
+     */
+    /*selectList*/
+
+    /**
+     * 获取商品详细信息
+     */
+    @ApiOperation("获取商品详细信息")
+    @GetMapping("/{goodsId}")
+    public AjaxResult<GoodsVo> getInfo(@PathVariable("goodsId" ) Long goodsId) {
+        return AjaxResult.success(iGoodsService.selectDetail(goodsId));
+    }
+
+
+    /**
+     * 查询题目业务层次关系列表
+     */
+    @ApiOperation("查询商品题库列表")
+    @GetMapping("/bank/list")
+    public AjaxResult<List<GoodsAttachedVo>> bankList(GoodsAttachedQueryBo bo) {
+        List<GoodsAttachedVo> list = iGoodsAttachedService.selectList(bo);
+        return AjaxResult.success(list);
+    }
+
+
+
+
+}

+ 3 - 30
zhongzheng-api/src/main/java/com/zhongzheng/controller/goods/GoodsController.java

@@ -32,7 +32,7 @@ import java.util.List;
 @Api(value = "商品控制器", tags = {"商品管理"})
 @RequiredArgsConstructor(onConstructor_ = @Autowired)
 @RestController
-@RequestMapping("/app/common/goods")
+@RequestMapping("/goods")
 public class GoodsController extends BaseController {
 
     private final IGoodsService iGoodsService;
@@ -41,44 +41,17 @@ public class GoodsController extends BaseController {
 
 
 
-    /**
-     * 查询商品列表
-     */
-    @ApiOperation("查询商品列表")
-    @GetMapping("/list")
-    public TableDataInfo<GoodsVo> list(GoodsQueryBo bo) {
-        bo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
-        startPage();
-        List<GoodsVo> list = iGoodsService.selectList(bo);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出商品列表
-     */
-    /*selectList*/
 
     /**
      * 获取商品详细信息
      */
-    @ApiOperation("获取商品详细信息")
+    @ApiOperation("获取题库商品错题和收集题数")
     @GetMapping("/{goodsId}")
-    public AjaxResult<GoodsVo> getInfo(@PathVariable("goodsId" ) Long goodsId) {
+    public AjaxResult<GoodsVo> getBankGoodsNum(@PathVariable("goodsId" ) Long goodsId) {
         return AjaxResult.success(iGoodsService.selectDetail(goodsId));
     }
 
 
-    /**
-     * 查询题目业务层次关系列表
-     */
-    @ApiOperation("查询商品题库列表")
-    @GetMapping("/bank/list")
-    public AjaxResult<List<GoodsAttachedVo>> bankList(GoodsAttachedQueryBo bo) {
-        List<GoodsAttachedVo> list = iGoodsAttachedService.selectList(bo);
-        return AjaxResult.success(list);
-    }
-
-
 
 
 }

+ 15 - 2
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserExamWrongRecordController.java

@@ -75,11 +75,11 @@ public class UserExamWrongRecordController extends BaseController {
 
     @ApiOperation("试卷获取题目列表")
     @GetMapping("/exam_question_list")
-    public TableDataInfo<QuestionVo> selectQuestionList(UserExamWrongRecordQueryBo bo) {
+    public TableDataInfo<UserExamWrongRecordVo> selectQuestionList(UserExamWrongRecordQueryBo bo) {
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
         startPage();
-        List<QuestionVo> list = iUserExamWrongRecordService.selectQuestionList(bo);
+        List<UserExamWrongRecordVo> list = iUserExamWrongRecordService.selectQuestionList(bo);
         return getDataTable(list);
     }
 
@@ -149,4 +149,17 @@ public class UserExamWrongRecordController extends BaseController {
     public AjaxResult<Void> remove(@PathVariable Long[] wrongIds) {
         return toAjax(iUserExamWrongRecordService.deleteWithValidByIds(Arrays.asList(wrongIds), true) ? 1 : 0);
     }
+
+    /**
+     * 删除用户我的题库错题记录
+     */
+    @ApiOperation("删除用户我的题库错题记录")
+    @Log(title = "用户我的题库错题记录" , businessType = BusinessType.DELETE)
+    @PostMapping("/delete/question")
+    public AjaxResult<Void> remove_question(@RequestBody UserExamWrongRecordQueryBo bo) {
+
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        return toAjax(iUserExamWrongRecordService.remove_question(bo));
+    }
 }

+ 4 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/collect/bo/CollectQuestionQueryBo.java

@@ -48,5 +48,8 @@ public class CollectQuestionQueryBo extends BaseEntity {
 	@ApiModelProperty("类型")
 	private Long type;
 
-
+	@ApiModelProperty("试卷类型ID")
+	private Integer paperId;
+	@ApiModelProperty("商品ID")
+	private Long goodsId;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserExamWrongRecordQueryBo.java

@@ -55,4 +55,7 @@ public class UserExamWrongRecordQueryBo extends BaseEntity {
 	/** 类型 1单选 2多选 3判断题  4案列题  5简答题*/
 	@ApiModelProperty("类型 1单选 2多选 3判断题 4案列题  5简答题")
 	private Integer type;
+
+	@ApiModelProperty("试卷类型ID")
+	private Integer paperId;
 }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserExamWrongRecordMapper.java

@@ -18,7 +18,7 @@ import java.util.List;
  */
 public interface UserExamWrongRecordMapper extends BaseMapper<UserExamWrongRecord> {
     List<UserExamWrongRecordVo> selectList(UserExamWrongRecordQueryBo bo);
-    List<QuestionVo> selectQuestionList(UserExamWrongRecordQueryBo bo);
+    List<UserExamWrongRecordVo> selectQuestionList(UserExamWrongRecordQueryBo bo);
     List<UserExamWrongRecordVo> selectTypeNum(UserExamWrongRecordQueryBo bo);
     List<QuestionVo> selectTypeQuestionList(UserExamWrongRecordQueryBo bo);
 }

+ 3 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserExamWrongRecordService.java

@@ -33,7 +33,7 @@ public interface IUserExamWrongRecordService extends IService<UserExamWrongRecor
 
 	List<UserExamWrongRecordVo> selectList(UserExamWrongRecordQueryBo bo);
 
-	List<QuestionVo> selectQuestionList(UserExamWrongRecordQueryBo bo);
+	List<UserExamWrongRecordVo> selectQuestionList(UserExamWrongRecordQueryBo bo);
 
 	List<UserExamWrongRecordVo> selectTypeNum(UserExamWrongRecordQueryBo bo);
 
@@ -60,4 +60,6 @@ public interface IUserExamWrongRecordService extends IService<UserExamWrongRecor
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+	Boolean remove_question(UserExamWrongRecordQueryBo bo);
 }

+ 11 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserExamWrongRecordServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.bank.vo.QuestionVo;
+import com.zhongzheng.modules.collect.domain.CollectQuestion;
 import com.zhongzheng.modules.user.bo.UserExamWrongRecordAddBo;
 import com.zhongzheng.modules.user.bo.UserExamWrongRecordEditBo;
 import com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo;
@@ -59,7 +60,7 @@ public class UserExamWrongRecordServiceImpl extends ServiceImpl<UserExamWrongRec
     }
 
     @Override
-    public List<QuestionVo> selectQuestionList(UserExamWrongRecordQueryBo bo) {
+    public List<UserExamWrongRecordVo> selectQuestionList(UserExamWrongRecordQueryBo bo) {
         return userExamWrongRecordMapper.selectQuestionList(bo);
     }
 
@@ -126,4 +127,13 @@ public class UserExamWrongRecordServiceImpl extends ServiceImpl<UserExamWrongRec
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    public Boolean remove_question(UserExamWrongRecordQueryBo bo) {
+        return this.remove(new LambdaQueryWrapper<UserExamWrongRecord>()
+                .eq(UserExamWrongRecord::getQuestionId,bo.getQuestionId())
+                .eq(UserExamWrongRecord::getGoodsId,bo.getGoodsId())
+                .eq(UserExamWrongRecord::getExamId,bo.getExamId())
+                .eq(UserExamWrongRecord::getUserId,bo.getUserId()));
+    }
 }

+ 62 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserExamWrongRecordVo.java

@@ -51,9 +51,69 @@ public class UserExamWrongRecordVo {
 	@ApiModelProperty("错题题数")
 	private Long wrongQuestionNum;
 
-	@ApiModelProperty("题目类型")
-	private Integer type;
+
 
 	@ApiModelProperty("类型数量")
 	private Integer num;
+
+	/** 题目正文 */
+	@Excel(name = "题目正文")
+	@ApiModelProperty("题目正文")
+	private String content;
+	/** 类型 1单选 2多选 3判断题 4简答题 5案列题 */
+	@Excel(name = "类型 1单选 2多选 3判断题 4简答题 5案列题")
+	@ApiModelProperty("类型 1单选 2多选 3判断题 4简答题 5案列题")
+	private Integer type;
+	/** 答案  判断题1正确 0错误; 单选为数字; 多选数字用,拼接; 从1坐标开始; */
+	@Excel(name = "答案  判断题1正确 0错误; 单选为数字; 多选数字用,拼接; 从1坐标开始;")
+	@ApiModelProperty("答案  判断题1正确 0错误; 单选为数字; 多选数字用,拼接; 从1坐标开始;")
+	private String answerQuestion;
+	/**  状态 1正常 0关闭 */
+	@Excel(name = " 状态 1正常 0关闭")
+	@ApiModelProperty(" 状态 1正常 0关闭")
+	private Integer status;
+	/** 解析文本 */
+	@Excel(name = "解析文本")
+	@ApiModelProperty("解析文本")
+	private String analysisContent;
+	/** 图片地址,多个,拼接 */
+	@Excel(name = "图片地址,多个,拼接")
+	@ApiModelProperty("图片地址,多个,拼接")
+	private String imgUrl;
+	/** 问题内容 */
+	@Excel(name = "问题内容")
+	@ApiModelProperty("问题内容")
+	private String jsonStr;
+	/** 前缀名称 */
+	@Excel(name = "前缀名称")
+	@ApiModelProperty("前缀名称")
+	private String prefixName;
+	/** 知识点id用,拼接 */
+	@Excel(name = "知识点id用,拼接")
+	@ApiModelProperty("知识点id用,拼接")
+	private String knowledgeIds;
+	/** 发布状态 1发布 0未发布 */
+	@Excel(name = "发布状态 1发布 0未发布")
+	@ApiModelProperty("发布状态 1发布 0未发布")
+	private Integer publishStatus;
+	/** 教育类型ID */
+	@Excel(name = "教育类型ID")
+	@ApiModelProperty("教育类型ID")
+	private Long educationTypeId;
+	/** 业务层次id */
+	@Excel(name = "业务层次id")
+	@ApiModelProperty("业务层次id")
+	private Long businessId;
+	/** 科目id */
+	@Excel(name = "科目id")
+	@ApiModelProperty("科目id")
+	private Long subjectId;
+	/** 项目ID */
+	@Excel(name = "项目ID")
+	@ApiModelProperty("项目ID")
+	private Long projectId;
+	/** 编码 */
+	@Excel(name = "编码")
+	@ApiModelProperty("编码")
+	private String code;
 }

+ 18 - 2
zhongzheng-system/src/main/resources/mapper/modules/collect/CollectQuestionMapper.xml

@@ -53,7 +53,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="type != null and type != ''">
             AND q.type = #{type}
         </if>
-
+        <if test="goodsId != null and goodsId != ''">
+            AND cq.goods_id = #{goodsId}
+        </if>
     </select>
 
     <select id="selectExamList" parameterType="com.zhongzheng.modules.collect.bo.CollectQuestionQueryBo"  resultMap="CollectQuestionVoResult">
@@ -63,9 +65,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM
         collect_question cq
         LEFT JOIN exam e ON cq.exam_id = e.exam_id
+        LEFT JOIN exam_paper ep ON ep.paper_id = e.exam_paper_id
         WHERE
         1 = 1
         AND cq.user_id = #{userId}
+        <if test="paperId != null and paperId != ''">
+            AND e.exam_paper_id = #{paperId}
+        </if>
+        <if test="goodsId != null and goodsId != ''">
+            AND cq.goods_id = #{goodsId}
+        </if>
         GROUP BY
         e.exam_id
 
@@ -81,7 +90,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         1 = 1
         AND cq.exam_id = #{examId}
         AND cq.user_id = #{userId}
-
+        <if test="goodsId != null and goodsId != ''">
+            AND cq.goods_id = #{goodsId}
+        </if>
     </select>
 
     <select id="selectTypeNum" parameterType="com.zhongzheng.modules.collect.bo.CollectQuestionQueryBo"  resultMap="CollectQuestionVoResult">
@@ -91,6 +102,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM
                 ( SELECT * FROM collect_question WHERE user_id = #{userId} ) cq
                     LEFT JOIN question q ON cq.question_id = q.question_id
+        WHERE
+            1 = 1
+        <if test="goodsId != null and goodsId != ''">
+            AND cq.goods_id = #{goodsId}
+        </if>
         GROUP BY
             q.type
     </select>

+ 26 - 4
zhongzheng-system/src/main/resources/mapper/modules/user/UserExamWrongRecordMapper.xml

@@ -22,13 +22,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="userId" column="user_id"/>
         <result property="goodsId" column="goods_id"/>
         <result property="examId" column="exam_id"/>
-        <result property="createTime" column="create_time"/>
-        <result property="updateTime" column="update_time"/>
+
 
         <result property="examName" column="exam_name"/>
         <result property="wrongQuestionNum" column="wrong_question_num"/>
         <result property="type" column="type"/>
         <result property="num" column="num"/>
+
+        <result property="content" column="content"/>
+        <result property="type" column="type"/>
+        <result property="answerQuestion" column="answer_question"/>
+        <result property="status" column="status"/>
+        <result property="analysisContent" column="analysis_content"/>
+        <result property="imgUrl" column="img_url"/>
+        <result property="jsonStr" column="json_str"/>
+        <result property="prefixName" column="prefix_name"/>
+        <result property="knowledgeIds" column="knowledge_ids"/>
+        <result property="publishStatus" column="publish_status"/>
+        <result property="code" column="code"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.bank.vo.QuestionVo" id="QuestionResultVo">
@@ -54,16 +65,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM
         user_exam_wrong_record uew
         LEFT JOIN exam e ON uew.exam_id = e.exam_id
+        LEFT JOIN exam_paper ep ON ep.paper_id = e.exam_paper_id
         WHERE
         uew.user_id = #{userId}
         <if test="goodsId != null and goodsId != ''">
             AND uew.goods_id = #{goodsId}
         </if>
+        <if test="paperId != null and paperId != ''">
+            AND e.exam_paper_id = #{paperId}
+        </if>
         GROUP BY
         e.exam_id
     </select>
 
-    <select id="selectQuestionList" parameterType="com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo" resultMap="QuestionResultVo">
+    <select id="selectQuestionList" parameterType="com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo" resultMap="UserExamWrongRecordVoResult">
         SELECT DISTINCT
         q.*
         FROM
@@ -90,6 +105,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM
                 ( SELECT * FROM user_exam_wrong_record WHERE user_id = #{userId} ) uew
                     LEFT JOIN question q ON uew.question_id = q.question_id
+        WHERE
+        1 = 1
+        <if test="goodsId != null and goodsId != ''">
+            AND uew.goods_id = #{goodsId}
+        </if>
         GROUP BY
             q.type
     </select>
@@ -106,6 +126,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="type != null and type != ''">
             AND q.type = #{type}
         </if>
-
+        <if test="goodsId != null and goodsId != ''">
+            AND uew.goods_id = #{goodsId}
+        </if>
     </select>
 </mapper>