|
|
@@ -95,5 +95,23 @@ public class LawyerCommonQuestionServiceImpl extends ServiceImpl<LawyerCommonQue
|
|
|
}
|
|
|
return R.fail("删除失败");
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R<List<LawyerCommonQuestion>> getCommonQuestionListByNum(Integer num) {
|
|
|
+ log.info("LawyerCommonQuestionServiceImpl.getCommonQuestionListByNum?num={}", num);
|
|
|
+
|
|
|
+ // 参数校验:如果 num 小于等于0,返回空列表
|
|
|
+ if (num == null || num <= 0) {
|
|
|
+ return R.data(new java.util.ArrayList<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构建查询条件:只查询未删除的记录,随机排序
|
|
|
+ LambdaQueryWrapper<LawyerCommonQuestion> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(LawyerCommonQuestion::getDeleteFlag, 0)
|
|
|
+ .last("ORDER BY RAND() LIMIT " + num);
|
|
|
+
|
|
|
+ List<LawyerCommonQuestion> list = this.list(queryWrapper);
|
|
|
+ return R.data(list);
|
|
|
+ }
|
|
|
}
|
|
|
|