فهرست منبع

增加一个全部的类型(年级级别,任何条件都可查询)

liyanbo 1 ماه پیش
والد
کامیت
30115cb948

+ 9 - 2
byzs-course/src/main/java/cn/iocoder/byzs/module/bjdx/dal/mysql/coursetype/CourseTypeMapper.java

@@ -33,8 +33,15 @@ public interface CourseTypeMapper extends BaseMapperX<CourseTypeDO> {
 
     private static LambdaQueryWrapperX<CourseTypeDO> getCourseTypeDOLambdaQueryWrapperX(CourseTypeListReqVO reqVO) {
         LambdaQueryWrapperX<CourseTypeDO> queryWrapper = new LambdaQueryWrapperX<CourseTypeDO>()
-                .likeIfPresent(CourseTypeDO::getCtType, reqVO.getCtType())
-                .eqIfPresent(CourseTypeDO::getCtParentId, reqVO.getCtParentId());
+                .likeIfPresent(CourseTypeDO::getCtType, reqVO.getCtType());
+
+        if (reqVO.getCtParentId() != null) {
+            queryWrapper.and(wrapper -> wrapper
+                .eq(CourseTypeDO::getCtParentId, reqVO.getCtParentId())
+                .or()
+                .eq(CourseTypeDO::getCtParentId, "-1")
+            );
+        }
 
         // 处理getCtTypeNode的特殊条件:不为空且不等于0时,同时查询该值和0
         Object ctTypeNode = reqVO.getCtTypeNode();

+ 1 - 1
byzs-course/src/main/resources/mapper/course/CourseMapper.xml

@@ -29,7 +29,7 @@
                 AND c.course_is_inspect = #{courseIsInspect}
             </if>
             <if test="ctTypeNode!= null and ctTypeNode!= ''">
-                AND ct.ct_type_node = #{ctTypeNode}
+                AND (ct.ct_type_node = #{ctTypeNode} OR ct.ct_type_node = '-1')
             </if>
         </where>
         ORDER BY ct.ct_type_sort, c.course_order

+ 8 - 0
byzs-web/src/main/java/cn/iocoder/byzs/module/web/controller/admin/ai/WebAiController.java

@@ -107,6 +107,14 @@ public class WebAiController {
         pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
         pageReqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
         PageResult<AiChatRoleDO> pageResult = chatRoleService.getChatRoleMyPage(pageReqVO, getLoginUserId());
+
+        pageReqVO.setCategory("全部");
+        PageResult<AiChatRoleDO> pageResultAll = chatRoleService.getChatRoleMyPage(pageReqVO, getLoginUserId());
+        List<AiChatRoleDO> list = pageResult.getList();
+        list.addAll(pageResultAll.getList());
+        pageResult.setList(list);
+        pageResult.setTotal(pageResult.getTotal() + pageResultAll.getTotal());
+
         return success(BeanUtils.toBean(pageResult, WebAiChatRoleVO.class));
     }