From c83a50317baeba1a4771e4d802eee029ed2b7e31 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 23 六月 2020 18:23:43 +0800
Subject: [PATCH] 2020-06-23

---
 src/utils/utils.js |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/utils/utils.js b/src/utils/utils.js
index 483aad4..8042fad 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -1162,16 +1162,16 @@
       let datasource = setting.dataresource
       if (/\s/.test(datasource)) { // 鎷兼帴鍒悕
         datasource = '(' + datasource + ') tb'
+      } else {
+        datasource = datasource + ' tb'
       }
 
       verify.uniques.forEach(item => {
-        let _primaryKey = item.field.split(',').includes(primaryKey) ? '' : ',' + primaryKey
-
         _sql += `
         /* 鍚岀被鏁版嵁楠岃瘉 */
         Set @tbid=''
 
-        Select top 1 @tbid='X' from (select ${item.field}${_primaryKey},1 as n from ${datasource} ) tb  inner join (select ID from  dbo.SplitComma(@ID@)) sp on tb.${primaryKey}=sp.ID group by ${item.field} having sum(n)>1
+        Select top 1 @tbid='X' from (select distinct ${item.field},1 as n from ${datasource} inner join (select ID from  dbo.SplitComma(@ID@)) sp on tb.${primaryKey}=sp.ID ) a group by ${item.field} having sum(n)>1
         
         If @tbid!=''
         Begin

--
Gitblit v1.8.0