From 02de694f6deabb1ab8d2fa37c923980a9e6c0538 Mon Sep 17 00:00:00 2001
From: 18756 <1875631620@qq.com>
Date: 星期五, 30 八月 2024 14:54:48 +0800
Subject: [PATCH] 借阅文档排名优化8.30

---
 src/main/java/com/product/file/service/DocumentService.java |   35 ++++++++++++++++++++++++++---------
 1 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/product/file/service/DocumentService.java b/src/main/java/com/product/file/service/DocumentService.java
index be2548c..a53d8b6 100644
--- a/src/main/java/com/product/file/service/DocumentService.java
+++ b/src/main/java/com/product/file/service/DocumentService.java
@@ -634,9 +634,26 @@
 	@Override
 	public DataTableEntity getApplyDocument(FieldSetEntity fse) throws BaseException {
 
-        String sub_uuid = fse.getString("sub_uuid");
-		String filter=" uuid in ("+sub_uuid+")";
-        DataTableEntity product_sys_attachments = baseDao.listTable("product_sys_attachments", filter, new Object[]{});
+		String sub_uuid = fse.getString("sub_uuid");
+		String sub_uuid_replace = sub_uuid.replace("\"", "");
+		String[] sub_uuid_split = sub_uuid_replace.split(",");
+		String sub_uuids="";
+		for (int i = 0; i < sub_uuid_split.length; i++) {
+
+			if(i==sub_uuid_split.length-1){
+				sub_uuids=sub_uuids+"\""+sub_uuid_split[i]+"\"";
+			}else {
+				sub_uuids=sub_uuids+"\""+sub_uuid_split[i]+"\",";
+			}
+		}
+		List<String> param = new ArrayList<>();
+		StringBuilder sb=new StringBuilder();
+		sb.append(" SELECT a.*,f.show_name");
+		sb.append(" FROM product_sys_attachments a  ");
+		sb.append(" LEFT JOIN  product_sys_staffs f ");
+		sb.append(" on a.created_by =f.user_id ");
+		sb.append(" where a.uuid in ("+sub_uuids+")");
+        DataTableEntity product_sys_attachments = baseDao.listTable(sb.toString(),param.toArray());
         return product_sys_attachments;
 	}
 
@@ -692,14 +709,14 @@
 		StringBuilder sb = new StringBuilder();
 		List<String> param = new ArrayList<>();
 		sb.append(" SELECT b.* FROM (");
-		sb.append(" SELECT t.uuid,t.file_name,t.file_size,s.show_name,t.created_utc_datetime,count(t.uuid) as applyCount");
+		sb.append(" SELECT t.uuid,t.file_name,t.attachment_size as file_size,s.show_name,t.created_utc_datetime,count(t.uuid) as applyCount");
 		sb.append(" FROM product_oa_document_borrow_sub b");
-		sb.append(" JOIN product_oa_document t");
+		sb.append(" JOIN product_sys_attachments t");
 		sb.append(" on b.sub_uuid=t.uuid");
 		sb.append(" JOIN product_sys_staffs s ");
 		sb.append(" on t.created_by=s.user_id");
-		sb.append(" group by t.file_name,t.uuid,s.show_name,t.created_utc_datetime,t.file_size");
-		sb.append(" )b order by  b.applyCount asc");
+		sb.append(" group by t.file_name,t.uuid,s.show_name,t.created_utc_datetime,t.attachment_size");
+		sb.append(" )b order by  b.applyCount DESC");
 		DataTableEntity dataTableEntity = baseDao.listTable(sb.toString(), param.toArray());
 		return dataTableEntity;
 	}
@@ -723,14 +740,14 @@
 		sb.append(" FROM product_oa_document_borrow  w ");
 		sb.append(" left JOIN product_oa_document_borrow_sub b");
 		sb.append(" on b.borrow_uuid=w.uuid");
-		sb.append(" left JOIN product_oa_document t");
+		sb.append(" left JOIN product_sys_attachments t");
 		sb.append(" on b.sub_uuid=t.uuid");
 		sb.append(" left JOIN product_sys_staffs s");
 		sb.append(" on w.borrower=s.user_id");
 		sb.append(" GROUP BY w.borrower,s.show_name");
 		sb.append(" )a )b");
 		sb.append(" on a.borrower=b.borrower ");
-		sb.append(" order by a.applayCount,b.applayFileCount asc");
+		sb.append(" order by a.applayCount,b.applayFileCount DESC");
 		DataTableEntity dataTableEntity = baseDao.listTable(sb.toString(), param.toArray());
 		return dataTableEntity;
 	}

--
Gitblit v1.9.2