Selaa lähdekoodia

fix 题库推荐

he2802 4 vuotta sitten
vanhempi
commit
d959e89f23

+ 8 - 1
zhongzheng-api/src/main/java/com/zhongzheng/controller/bank/QuestionBankController.java

@@ -11,6 +11,8 @@ import com.zhongzheng.modules.bank.bo.QuestionBankEditBo;
 import com.zhongzheng.modules.bank.bo.QuestionBankQueryBo;
 import com.zhongzheng.modules.bank.service.IQuestionBankService;
 import com.zhongzheng.modules.bank.vo.QuestionBankVo;
+import com.zhongzheng.modules.course.bo.CourseQueryBo;
+import com.zhongzheng.modules.course.vo.CourseVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
@@ -61,5 +63,10 @@ public class QuestionBankController extends BaseController {
         return AjaxResult.success(iQuestionBankService.queryById(bankId));
     }
 
-
+    @ApiOperation("课程题库列表")
+    @GetMapping("/recommendList")
+    public AjaxResult<List<QuestionBankVo>> recommendList(QuestionBankQueryBo bo) {
+        List<QuestionBankVo> list = iQuestionBankService.queryRecommendList(bo);
+        return AjaxResult.success(list);
+    }
 }

+ 0 - 2
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserController.java

@@ -53,8 +53,6 @@ public class UserController extends BaseController {
         }
         bo.setNull();
         return toAjax(iUserService.updateByEditBo(bo) ? 1 : 0);
-
     }
 
-
 }

+ 5 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -134,4 +134,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    public Integer getCollectTotal(Long userId) {
+        return null;
+    }
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionBankMapper.java

@@ -16,4 +16,6 @@ import java.util.List;
 public interface QuestionBankMapper extends BaseMapper<QuestionBank> {
 
     List<QuestionBankVo> selectBankList(QuestionBankQueryBo bo);
+
+    List<QuestionBankVo> queryRecommendList(QuestionBankQueryBo bo);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionBankService.java

@@ -7,6 +7,8 @@ import com.zhongzheng.modules.bank.bo.QuestionBankEditBo;
 import com.zhongzheng.modules.bank.bo.QuestionBankQueryBo;
 import com.zhongzheng.modules.bank.domain.QuestionBank;
 import com.zhongzheng.modules.bank.vo.QuestionBankVo;
+import com.zhongzheng.modules.course.bo.CourseQueryBo;
+import com.zhongzheng.modules.course.vo.CourseVo;
 
 import java.util.Collection;
 import java.util.List;
@@ -31,6 +33,8 @@ public interface IQuestionBankService extends IService<QuestionBank> {
 
 	List<QuestionBankVo> selectBankList(QuestionBankQueryBo bo);
 
+	List<QuestionBankVo> queryRecommendList(QuestionBankQueryBo bo);
+
 	/**
 	 * 根据新增业务对象插入题库
 	 * @param bo 题库新增业务对象

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionBankServiceImpl.java

@@ -65,6 +65,11 @@ public class QuestionBankServiceImpl extends ServiceImpl<QuestionBankMapper, Que
         return questionBankMapper.selectBankList(bo);
     }
 
+    @Override
+    public List<QuestionBankVo> queryRecommendList(QuestionBankQueryBo bo) {
+        return questionBankMapper.queryRecommendList(bo);
+    }
+
     /**
     * 实体类转化成视图对象
     *

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserService.java

@@ -53,4 +53,7 @@ public interface IUserService extends IService<User> {
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+
+	Integer getCollectTotal(Long userId);
 }

+ 15 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionBankMapper.xml

@@ -43,4 +43,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
     </select>
 
+    <select id="queryRecommendList" parameterType="com.zhongzheng.modules.bank.bo.QuestionBankQueryBo"  resultMap="QuestionBankResult">
+        SELECT
+        bank_id,bank_name,cover_url,price
+        FROM
+        question_bank
+        WHERE
+        STATUS = 1
+        <if test="bankId != null and bankId != ''">
+            AND bank_id != #{bankId}
+        </if>
+        ORDER BY
+        RAND()
+        LIMIT 4
+    </select>
+
 </mapper>