king
2023-09-28 cd5079f2dbe12eb03fcef2e1898e4f013848d895
src/templates/zshare/customscript/index.jsx
@@ -243,6 +243,25 @@
        duration: 5
      })
      return
    } else if (/\son\s+[a-z0-9_]+\.[a-z0-9_]+\s*=\s*[a-z0-9_]+\.[a-z0-9_]+/ig.test(values.sql)) {
      let list = values.sql.match(/\son\s+[a-z0-9_]+\.[a-z0-9_]+\s*=\s*[a-z0-9_]+\.[a-z0-9_]+/ig)
      let errors = []
      list.forEach(str => {
        str = str.replace(/^\s/, '')
        let strs = str.match(/(\s|=)[a-z0-9_]+\./ig)
        if (strs.length === 2 && (strs[0].replace(/\s|\./g, '') === strs[1].replace(/\s|\./g, ''))) {
          errors.push(str)
        }
      })
      if (errors.length > 0) {
        notification.warning({
          top: 92,
          message: '不可使用同一个表字段进行关联:' + errors.join('、'),
          duration: 5
        })
        return
      }
    }
    let error = Utils.verifySql(values.sql, 'customscript')