| | |
| | | let _fieldValue = [] // 表单键值对field=value |
| | | let _value = [] // 表单值,用于错误提示 |
| | | let _labels = item.fieldlabel.split(',') // 表单提示文字 |
| | | let arr = [] // 验证主键 |
| | | |
| | | item.field.split(',').forEach((_field, index) => { |
| | | _fieldValue.push(`${_field}=@${_field}@`) |
| | | _value.push(`${_labels[index] || ''}:'+@${_field}@+'`) |
| | | arr.push(_field.toLowerCase()) |
| | | }) |
| | | |
| | | let _verifyType = '' |
| | |
| | | _verifyType = ' and deleted=0' |
| | | } |
| | | |
| | | if (!arr.includes(primaryKey.toLowerCase())) { |
| | | _fieldValue.push(`${primaryKey} !=@${primaryKey}@`) |
| | | } |
| | | |
| | | _sql += `select @tbid='', @ErrorCode='',@retmsg='' |
| | | select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')} and ${primaryKey} !=@${primaryKey}@${_verifyType} |
| | | select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')}${_verifyType} |
| | | If @tbid!='' |
| | | Begin |
| | | select @ErrorCode='${item.errorCode}',@retmsg='${_value.join(', ')} 已存在' |
| | |
| | | receiptKeys.push(item.key.toLowerCase()) |
| | | }) |
| | | |
| | | if (!receiptKeys.includes(primaryKey)) { |
| | | receiptKeys.push(primaryKey) |
| | | if (!receiptKeys.includes(primaryKey.toLowerCase())) { |
| | | receiptKeys.push(primaryKey.toLowerCase()) |
| | | } |
| | | |
| | | if (!receiptKeys.includes('bid') && BID) { |
| | |
| | | values.push('@' + item.key + '@') |
| | | }) |
| | | |
| | | if (!keys.includes(primaryKey)) { |
| | | keys.push(primaryKey) |
| | | if (!keys.includes(primaryKey.toLowerCase())) { |
| | | keys.push(primaryKey.toLowerCase()) |
| | | values.push(`@${primaryKey}@`) |
| | | } |
| | | |
| | |
| | | |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,'${_ltext}' as Ltext` |
| | | console.log(_sql) |
| | | |
| | | return _sql |
| | | } |
| | | |