Histórico da Página
...
Bloco de código | ||||
---|---|---|---|---|
| ||||
DECLARE @NOMETABELA VARCHAR(MAX) = 'HATENDIMENTOARQUIVOSANEXOS'
SELECT cast( ',"'+GDIC.APINAME+
'": {"description": "'+GDIC.DESCRICAO+
'","type": '+
case c.name
when 'int' then '"integer", "format": "int32"'
when 'varchar' then '"string", "maxLength": "'+convert(varchar(5),b.length) +'"'
when 'decimal' then '"number", "format":"double"'
when 'datetime' then '"string","format": "date-time"'
when 'smallint' then '"integer", "format": "int32"'
else '"string"'
end+
', "x-totvs": [{ "product": "RM", "field": "' + @NOMETABELA +'.'+GDIC.COLUNA+
'", "required": false,"type": '+
case c.name
when 'int' then '"integer"'
when 'varchar' then '"varchar", "maxLength": "'+convert(varchar(5),b.length) +'"'
when 'decimal' then '"decimal"'
when 'datetime' then '"datetime"'
when 'smallint' then '"smallint"'
else '"string"'
end+
',"note" : "", "available": true, "canUpdate": true}]}'as VarChar(Max)) campos
FROM GDIC, SYSOBJECTS A, SYSCOLUMNS B, SYSTYPES C
WHERE GDIC.TABELA = @NOMETABELA
AND GDIC.APINAME IS NOT NULL
AND A.NAME = GDIC.TABELA
AND B.ID = A.ID
AND B.NAME = GDIC.COLUNA
AND C.XUSERTYPE = B.XTYPE
ORDER BY GDIC.COLUNA
|
...
4 - Consulta que gera a classe referente ao Schema da API.
Bloco de código | ||
---|---|---|
| ||
SELECT char(10)+'///'+char(10)+ '/// '+ GDIC.DESCRICAO + ' - '+ GDIC.COLUNA + char(10)+ '///'
+char(10)+'public '+
case c.name
when 'int' then 'int'
when 'varchar' then 'string'
when 'decimal' then 'decimal'
when 'datetime' then 'DateTime'
when 'smallint' then 'short'
else '"string"'
end + ' ' + GDIC.APINAME -- concat(Upper(substring (GDIC.APINAME, 1,1)), lower(substring(GDIC.COLUNA, 2,len(GDIC.COLUNA))))
+ ' { get; set; } ' as prop
FROM GDIC, SYSOBJECTS A, SYSCOLUMNS B, SYSTYPES C
WHERE GDIC.TABELA = 'HATENDIMENTOBASE'
AND GDIC.APINAME IS NOT NULL
AND A.NAME = GDIC.TABELA
AND B.ID = A.ID
AND B.NAME = GDIC.COLUNA
AND C.XUSERTYPE = B.XTYPE
ORDER BY GDIC.COLUNA |
Exemplo de resultado gerado:
Bloco de código | ||
---|---|---|
| ||
///
/// Autor da última modificação no registro - RECMODIFIEDBY
///
public string ModifiedUserCode { get; set; }
///
/// Data da última modificação no registro - RECMODIFIEDON
///
public DateTime ModifiedDate { get; set; }
///
/// Tamanho do arquivo - TAMANHOARQUIVO
///
public string size { get; set; }
///
/// Status - TIPOALTERACAO
///
public string Status { get; set; } |
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas