king
2020-06-23 c83a50317baeba1a4771e4d802eee029ed2b7e31
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