Explorar el Código

1、优化帮助中心-栏目管理新增和修改、帮助中心-栏目管理列表、帮助中心-栏目管理列表白名单接口,增加栏目名称、栏目排序和关联菜单的三个字段展示,修改接口文档,测试接口;
2、优化帮助中心-内容管理列表接口,将菜单名称改为栏目名称取值,修改接口文档,测试接口;

james hace 1 semana
padre
commit
b3b213814c

+ 5 - 4
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/domain/HceArticle.java

@@ -4,11 +4,12 @@ import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
-import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
 /**
  * <p>
  * 帮助中心_内容管理
@@ -93,8 +94,8 @@ public class HceArticle implements Serializable {
     private Integer sortindex;
 
     /**
-     * 菜单名称
+     * 栏目名称
      */
     @TableField(exist = false)
-    private String menuName;
+    private String categoryName;
 }

+ 2 - 4
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/impl/HceArticleServiceImpl.java

@@ -6,18 +6,16 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.usky.common.core.bean.ApiResult;
 import com.usky.common.core.bean.CommonPage;
 import com.usky.common.core.exception.BusinessException;
+import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.system.domain.HceArticle;
 import com.usky.system.domain.HceCategory;
 import com.usky.system.mapper.HceArticleMapper;
 import com.usky.system.mapper.HceCategoryMapper;
 import com.usky.system.service.HceArticleService;
-import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.system.service.vo.HceArticleVO;
 import org.springframework.stereotype.Service;
-import org.springframework.web.util.HtmlUtils;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
@@ -70,7 +68,7 @@ public class HceArticleServiceImpl extends AbstractCrudService<HceArticleMapper,
                         Integer categoryId1 = page.getRecords().get(i).getCategoryid();
                         Integer categoryId2 = list.get(j).getId();
                         if(categoryId1.equals(categoryId2)){
-                            page.getRecords().get(i).setMenuName(list.get(j).getMenuName());
+                            page.getRecords().get(i).setCategoryName(list.get(j).getCategoryName());
                         }
                     }
                 }

+ 17 - 21
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/impl/HceCategoryServiceImpl.java

@@ -1,23 +1,19 @@
 package com.usky.system.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.usky.common.core.exception.BusinessException;
+import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.common.security.utils.SecurityUtils;
 import com.usky.system.domain.HceArticle;
 import com.usky.system.domain.HceCategory;
 import com.usky.system.domain.SysUser;
 import com.usky.system.mapper.HceArticleMapper;
 import com.usky.system.mapper.HceCategoryMapper;
-import com.usky.system.service.HceArticleService;
 import com.usky.system.service.HceCategoryService;
-import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.system.service.ISysUserService;
 import com.usky.system.service.vo.HceCategoryListVO;
 import com.usky.system.service.vo.HceCategoryVO;
-import org.apache.tomcat.jni.Local;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -109,15 +105,15 @@ public class HceCategoryServiceImpl extends AbstractCrudService<HceCategoryMappe
         }
 
         //新增栏目时校验对应上级栏目是否存在,不存在要先新增上级栏目后再新增本栏目
-        Integer pid = baseMapper.selectPidByMenuid(hceCategory.getMenuId());
-        if(pid != null && pid != 0){
-            LambdaQueryWrapper<HceCategory> queryWrapper2 = Wrappers.lambdaQuery();
-            queryWrapper2.eq(HceCategory::getMenuId,pid);
-            List<HceCategory> list2 = this.list(queryWrapper2);
-            if(list2.size() <= 0){
-                throw new BusinessException("上级栏目不存在,请先添加上级栏目");
-            }
-        }
+//        Integer pid = baseMapper.selectPidByMenuid(hceCategory.getMenuId());
+//        if(pid != null && pid != 0){
+//            LambdaQueryWrapper<HceCategory> queryWrapper2 = Wrappers.lambdaQuery();
+//            queryWrapper2.eq(HceCategory::getMenuId,pid);
+//            List<HceCategory> list2 = this.list(queryWrapper2);
+//            if(list2.size() <= 0){
+//                throw new BusinessException("上级栏目不存在,请先添加上级栏目");
+//            }
+//        }
 
         hceCategory.setCreatedate(LocalDateTime.now());
         this.save(hceCategory);
@@ -152,13 +148,13 @@ public class HceCategoryServiceImpl extends AbstractCrudService<HceCategoryMappe
         if(list.size() > 0){
             throw new BusinessException("该栏目存在栏目内容不可删除");
         }
-        LambdaQueryWrapper<HceCategory> queryWrapper1 = Wrappers.lambdaQuery();
-        queryWrapper1.eq(HceCategory::getPid,id)
-                .eq(HceCategory::getStatus,1);
-        List<HceCategory> list1 = this.list(queryWrapper1);
-        if(list1.size()>0){
-            throw new BusinessException("该栏目存在子栏目不可删除");
-        }
+//        LambdaQueryWrapper<HceCategory> queryWrapper1 = Wrappers.lambdaQuery();
+//        queryWrapper1.eq(HceCategory::getPid,id)
+//                .eq(HceCategory::getStatus,1);
+//        List<HceCategory> list1 = this.list(queryWrapper1);
+//        if(list1.size()>0){
+//            throw new BusinessException("该栏目存在子栏目不可删除");
+//        }
         this.removeById(id);
 
     }

+ 10 - 2
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/vo/HceCategoryListVO.java

@@ -1,7 +1,5 @@
 package com.usky.system.service.vo;
 
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.usky.system.domain.HceCategory;
 import lombok.Data;
 
 import java.time.LocalDateTime;
@@ -51,6 +49,16 @@ public class HceCategoryListVO {
      */
     private Integer categoryId;
 
+    /**
+     * 栏目名称
+     */
+    private String categoryName;
+
+    /**
+     * 栏目排序
+     */
+    private Integer sortindex;
+
     /**
      * 栏目图片;
      */

+ 13 - 6
base-modules/service-system/service-system-biz/src/main/resources/mapper/system/HceCategoryMapper.xml

@@ -28,6 +28,8 @@
                         m.is_frame as isFrame,
                         m.is_cache as isCache,
                         h.id as categoryId,
+                        h.category_name as categoryName,
+                        h.sortindex as sortindex,
                         h.imagePath as imagePath,
                         h.createdate as createdate,
                         h.modifydate as modifydate,
@@ -40,12 +42,12 @@
           and m.visible = 0
           and m.status = 0
           <if test="categoryName != null">
-              and m.menu_name = #{categoryName}
+              and h.category_name = #{categoryName}
           </if>
           <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
               and h.createdate between #{startTime} and #{endTime}
           </if>
-        order by m.parent_id, m.order_num
+        order by m.parent_id, h.sortindex
     </select>
     <select id="selectMenuTreeByUserId" resultType="com.usky.system.service.vo.HceCategoryListVO">
         select distinct m.menu_id as menuId,
@@ -56,6 +58,8 @@
                         m.is_frame as isFrame,
                         m.is_cache as isCache,
                         h.id as categoryId,
+                        h.category_name as categoryName,
+                        h.sortindex as sortindex,
                         h.imagePath as imagePath,
                         h.createdate as createdate,
                         h.modifydate as modifydate,
@@ -73,12 +77,12 @@
           and m.status = 0
           AND ro.status = 0
         <if test="categoryName != null">
-            and m.menu_name = #{categoryName}
+            and h.category_name = #{categoryName}
         </if>
         <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
             and h.createdate between #{startTime} and #{endTime}
         </if>
-        order by m.parent_id, m.order_num
+        order by m.parent_id, h.sortindex
     </select>
     <select id="selectMenuTreeByUserIdOne" resultType="com.usky.system.service.vo.HceCategoryListVO">
         SELECT
@@ -90,6 +94,8 @@
                     m.is_frame as isFrame,
                     m.is_cache as isCache,
                     h.id as categoryId,
+                    h.category_name as categoryName,
+                    h.sortindex as sortindex,
                     h.imagePath as imagePath,
                     h.createdate as createdate,
                     h.modifydate as modifydate,
@@ -104,12 +110,12 @@
           and m.status = 0
           AND t.tenant_id=#{tenantId}
         <if test="categoryName != null">
-            and m.menu_name = #{categoryName}
+            and h.category_name = #{categoryName}
         </if>
         <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
             and h.createdate between #{startTime} and #{endTime}
         </if>
-        ORDER BY m.parent_id, m.order_num
+        ORDER BY m.parent_id, h.sortindex
     </select>
     <select id="getMenuNameList" resultType="com.usky.system.domain.HceCategory">
         SELECT
@@ -120,6 +126,7 @@
                     m.is_frame as isFrame,
                     m.is_cache as isCache,
                     h.id as id,
+                    h.category_name as categoryName,
                     h.imagePath as imagePath,
                     h.createdate as createdate,
                     h.modifydate as modifydate,