浏览代码

新增文档文件列表接口

FengChaoYu 1 月之前
父节点
当前提交
fac8dc51ea

+ 43 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsDocumentsFileVO.java

@@ -0,0 +1,43 @@
+package com.gree.mall.manager.bean.goods;
+
+import com.gree.mall.manager.annotation.ZfireField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel
+@ZfireField(tbName = "a")
+public class GoodsDocumentsFileVO {
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "id")
+    private String id;
+
+    @ApiModelProperty(value = "文件夹名称")
+    private String folderName;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "父分类id")
+    private String parentCategoryId;
+
+    @ZfireField(tbName = "b", colName = "name", ignoreSelect = true)
+    @ApiModelProperty(value = "父分类名称")
+    private String parentCategoryName;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "分类id")
+    private String categoryId;
+
+    @ZfireField(tbName = "c")
+    @ApiModelProperty(value = "分类名称")
+    private String name;
+
+    @ZfireField(hide = true, tbName = "e", colName = "id", ignoreSelect = true)
+    @ApiModelProperty(value = "文件名id")
+    private String fileId;
+
+    @ZfireField(tbName = "e", colName = "name", ignoreSelect = true)
+    @ApiModelProperty(value = "文件名")
+    private String fileName;
+}

+ 7 - 0
mall-server-api/src/main/java/com/gree/mall/manager/commonmapper/CommonMapper.java

@@ -634,4 +634,11 @@ public interface CommonMapper {
      * @return
      */
     IPage<GoodsDocumentsVO> goodsDocumentsList(Page page, @Param("ex") ZfireParamBean zfireParamBean);
+
+    /**
+     * 商品文件夹列表
+     * @param page
+     * @return
+     */
+    IPage<GoodsDocumentsFileVO> goodsDocumentsFileList(Page page, @Param("ex") ZfireParamBean zfireParamBean);
 }

+ 11 - 0
mall-server-api/src/main/java/com/gree/mall/manager/controller/goods/GoodsDocumentsController.java

@@ -4,6 +4,7 @@ import cn.hutool.core.lang.TypeReference;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.gree.mall.manager.annotation.ZfireList;
 import com.gree.mall.manager.bean.goods.GoodsDocumentsBean;
+import com.gree.mall.manager.bean.goods.GoodsDocumentsFileVO;
 import com.gree.mall.manager.bean.goods.GoodsDocumentsVO;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.helper.ResponseHelper;
@@ -36,6 +37,16 @@ public class GoodsDocumentsController {
         return ResponseHelper.success(page, new TypeReference<GoodsDocumentsVO>() {});
     }
 
+    @ZfireList
+    @PostMapping("/file/list")
+    @ApiOperation(value = "文件列表")
+    public ResponseHelper<IPage<GoodsDocumentsFileVO>> filePage(
+            @RequestBody ZfireParamBean zfireParamBean
+    ) throws Exception {
+        IPage<GoodsDocumentsFileVO> page = goodsDocumentsLogic.filePage(zfireParamBean);
+        return ResponseHelper.success(page, new TypeReference<GoodsDocumentsFileVO>() {});
+    }
+
     @PostMapping("/detail")
     @ApiOperation(value = "详情")
     public ResponseHelper<GoodsDocumentsBean> detail(

+ 12 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/goods/GoodsDocumentsLogic.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.bean.goods.GoodsDocumentsBean;
+import com.gree.mall.manager.bean.goods.GoodsDocumentsFileVO;
 import com.gree.mall.manager.bean.goods.GoodsDocumentsVO;
 import com.gree.mall.manager.commonmapper.CommonMapper;
 import com.gree.mall.manager.constant.Constant;
@@ -88,4 +89,15 @@ public class GoodsDocumentsLogic {
     public void del(String id) {
         goodsDocumentsService.removeById(id);
     }
+
+    public IPage<GoodsDocumentsFileVO> filePage(ZfireParamBean zfireParamBean) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        if (Objects.nonNull(adminUser.getAdminCompanyWechat())) {
+            adminUser.setAdminCompanyWechat(null);
+        }
+        FieldUtils.supplyParam(zfireParamBean, GoodsDocumentsFileVO.class, adminUser);
+        IPage<GoodsDocumentsFileVO> list = commonMapper.goodsDocumentsFileList(new Page(zfireParamBean.getPageNum(),
+                zfireParamBean.getPageSize()), zfireParamBean);
+        return list;
+    }
 }

+ 17 - 0
mall-server-api/src/main/resources/mapper/CommonMapper.xml

@@ -1209,5 +1209,22 @@
         ${ex.orderBy}
     </select>
 
+    <select id="goodsDocumentsFileList" resultType="com.gree.mall.manager.bean.goods.GoodsDocumentsFileVO">
+        SELECT
+        ${ex.selected},
+        b.name AS parent_category_name,
+        e.id AS file_id,
+        e.name AS file_name
+        FROM goods_documents a
+            JOIN common_file e on a.id = e.obj_id AND e.obj_type = 'goods_documents'
+        LEFT JOIN goods_category b ON a.parent_category_id = b.category_id
+        LEFT JOIN goods_category c ON a.category_id = c.category_id
+        ${ex.query}
+        <if test="ex.orderBy == null or ex.orderBy ==''">
+            ORDER BY a.create_time DESC
+        </if>
+        ${ex.orderBy}
+    </select>
+
 
 </mapper>