From 77be1acf594b9db9f36cb0fc2d9896c79ba0cd60 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期六, 18 三月 2023 09:45:39 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/controller/data/PublishController.java |   61 +++++++++++++++++++-----------
 1 files changed, 39 insertions(+), 22 deletions(-)

diff --git a/src/main/java/com/lf/server/controller/data/PublishController.java b/src/main/java/com/lf/server/controller/data/PublishController.java
index 23ca76c..52a7cfd 100644
--- a/src/main/java/com/lf/server/controller/data/PublishController.java
+++ b/src/main/java/com/lf/server/controller/data/PublishController.java
@@ -3,8 +3,10 @@
 import com.lf.server.annotation.SysLog;
 import com.lf.server.controller.all.BaseController;
 import com.lf.server.entity.all.ResponseMsg;
+import com.lf.server.entity.data.MetaEntity;
 import com.lf.server.entity.data.PublishEntity;
 import com.lf.server.entity.sys.UserEntity;
+import com.lf.server.helper.StringHelper;
 import com.lf.server.service.data.PublishService;
 import com.lf.server.service.sys.TokenService;
 import io.swagger.annotations.Api;
@@ -21,7 +23,7 @@
  * 鏁版嵁鍙戝竷
  * @author WWW
  */
-@Api(tags = "杩愮淮绠$悊\\鏁版嵁鍙戝竷")
+@Api(tags = "鏁版嵁绠$悊\\鍙戝竷绠$悊")
 @RestController
 @RequestMapping("/publish")
 public class PublishController extends BaseController {
@@ -32,43 +34,58 @@
     TokenService tokenService;
 
     @SysLog()
-    @ApiOperation(value = "鏌ヨ璁板綍鏁�")
+    @ApiOperation(value = "鍒嗛〉鏌ヨ鍏冩暟鎹�")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", required = false, example = "")
-    })
-    @GetMapping({"/selectCount"})
-    public ResponseMsg<Integer> selectCount(String name) {
-        try {
-            int count = publishService.selectCount(name);
-
-            return success(count);
-        } catch (Exception ex) {
-            return fail(ex.getMessage(), -1);
-        }
-    }
-
-    @SysLog()
-    @ApiOperation(value = "鍒嗛〉鏌ヨ")
-    @ApiImplicitParams({
+            @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"),
+            @ApiImplicitParam(name = "dircode", value = "鐩綍缂栫爜", dataType = "String", paramType = "query", example = "00"),
+            @ApiImplicitParam(name = "verid", value = "鐗堟湰ID", dataType = "Integer", paramType = "query", example = "0"),
+            @ApiImplicitParam(name = "type", value = "绫诲埆", dataType = "String", paramType = "query", example = "DOM"),
             @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""),
             @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"),
             @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1")
     })
-    @GetMapping(value = "/selectByPage")
-    public ResponseMsg<List<PublishEntity>> selectByPage(String name, Integer pageSize, Integer pageIndex) {
+    @GetMapping(value = "/selectMetasByPage")
+    public ResponseMsg<Object> selectMetasByPage(String depcode, String dircode, Integer verid, String type, String name, Integer pageSize, Integer pageIndex) {
         try {
             if (pageSize < 1 || pageIndex < 1) {
                 return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null);
             }
+            if (StringHelper.isEmpty(type)) {
+                return fail("璇疯緭鍏ユ暟鎹被鍒�");
+            }
 
-            List<PublishEntity> rs = publishService.selectByPage(name, pageSize, pageSize * (pageIndex - 1));
+            String types = getType(type);
+            int count = publishService.selectMetasByCount(depcode, dircode, verid, types, name);
+            if (count == 0) {
+                return success(0, null);
+            }
 
-            return success(rs);
+            List<MetaEntity> rs = publishService.selectMetasByPage(depcode, dircode, verid, types, name, pageSize, pageSize * (pageIndex - 1));
+
+            return success(count, rs);
         } catch (Exception ex) {
             return fail(ex.getMessage(), null);
         }
     }
 
+    /**
+     * 鑾峰彇绫诲瀷
+     */
+    private String getType(String type) throws Exception {
+        switch (type) {
+            case "DOM":
+                return "and type in ('tif', 'tiff', 'img')";
+            case "MPT":
+                return "and type = 'mpt'";
+            case "3DML":
+                return "and type = '3dml'";
+            case "BIM":
+                return "and type in ('ifc', 'fbx', 'rvt')";
+            default:
+                throw new Exception("鏁版嵁绫诲瀷涓嶅尮閰�");
+        }
+    }
+
     @SysLog()
     @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟")
     @ApiImplicitParams({

--
Gitblit v1.9.3