|
|
|
|
@ -17,6 +17,7 @@ import com.evolute.utils.db.keyretrievers.*;
|
|
|
|
|
import com.evolute.utils.metadb.*;
|
|
|
|
|
import com.evolute.utils.ui.search.*;
|
|
|
|
|
import com.evolute.utils.sql.*;
|
|
|
|
|
import com.evolute.utils.strings.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
@ -263,10 +264,10 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
|
|
|
|
|
|
|
|
|
|
public Virtual2DArray searchEmpresas( String pattern ) throws Exception {
|
|
|
|
|
Select select = new Select( new String[]{ T_EMPRESAS },
|
|
|
|
|
new String[]{ ID, DESIGNACAO_SOCIAL },
|
|
|
|
|
new Field( DESIGNACAO_SOCIAL ).isLike( "%" + pattern + "%" ).and(
|
|
|
|
|
new String[]{ ID, DESIGNACAO_SOCIAL, "designacao_social_plain" },
|
|
|
|
|
new Field( "designacao_social_plain" ).isLike( "%" + StringPlainer.convertString( pattern, false, false ) + "%" ).and(
|
|
|
|
|
new Field( INACTIVO ).isDifferent( "y" ) ),
|
|
|
|
|
new String[]{ "lower(" + DESIGNACAO_SOCIAL + ")" }, null );
|
|
|
|
|
new String[]{ "designacao_social_plain" }, null );
|
|
|
|
|
// Select select = new Select( "SELECT e.id, e.designacao_social FROM empresas e ORDER BY lower( e.designacao_social );" );
|
|
|
|
|
return executer.executeQuery( select );
|
|
|
|
|
}
|
|
|
|
|
@ -275,11 +276,11 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
|
|
|
|
|
// Select select = new Select( "SELECT e.id, e.nome FROM estabelecimentos e WHERE empresa_id = " + SEARCH_EMPRESAS_ID
|
|
|
|
|
// + " ORDER BY lower( e.nome )");
|
|
|
|
|
Select select = new Select( new String[]{ T_ESTABELECIMENTOS },
|
|
|
|
|
new String[]{ ID, NOME },
|
|
|
|
|
new Field( NOME ).isLike( "%" + pattern + "%" ).and(
|
|
|
|
|
new String[]{ ID, NOME, "nome_plain" },
|
|
|
|
|
new Field( "nome_plain" ).isLike( "%" + StringPlainer.convertString( pattern, false, false ) + "%" ).and(
|
|
|
|
|
new Field( EMPRESA_ID ).isEqual( new Integer( SEARCH_EMPRESAS_ID ) ) ).and(
|
|
|
|
|
new Field( INACTIVO ).isDifferent( "y" ) ),
|
|
|
|
|
new String[]{ "lower(" + NOME + ")" }, null );
|
|
|
|
|
new String[]{ "nome_plain" }, null );
|
|
|
|
|
return executer.executeQuery( select );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -290,12 +291,12 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
|
|
|
|
|
// + " AND es.empresa_id = " + SEARCH_EMPRESAS_ID + " ORDER BY lower(t.nome);" );
|
|
|
|
|
Select select = new Select( new String[]{ T_TRABALHADORES, T_ESTABELECIMENTOS },
|
|
|
|
|
new String[]{ T_TRABALHADORES + "." + ID, T_TRABALHADORES + "." + NOME },
|
|
|
|
|
new Field( T_TRABALHADORES + "." + NOME ).isLike( "%" + pattern + "%" ).and(
|
|
|
|
|
new Field( T_TRABALHADORES + ".nome_plain" ).isLike( "%" + StringPlainer.convertString( pattern, false, false ) + "%" ).and(
|
|
|
|
|
new Field( ESTABELECIMENTO_ID ).isEqual( new Field( T_ESTABELECIMENTOS + "." + ID ) ) ).and(
|
|
|
|
|
new Field( ESTABELECIMENTO_ID ).isEqual( new Integer( SEARCH_ESTABELECIMENTOS_ID ) ) ).and(
|
|
|
|
|
new Field( EMPRESA_ID ).isEqual( new Integer( SEARCH_EMPRESAS_ID ) ) ).and(
|
|
|
|
|
new Field( T_TRABALHADORES + "." + INACTIVO ).isDifferent( "y" ) ),
|
|
|
|
|
new String[]{ "lower(" + T_TRABALHADORES + "." + NOME + ")" }, null );
|
|
|
|
|
new String[]{ T_TRABALHADORES + ".nome_plain" }, null );
|
|
|
|
|
return executer.executeQuery( select );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -377,10 +378,10 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
Select select = new Select( new String[]{ T_ESTABELECIMENTOS },
|
|
|
|
|
new String[]{ ID, NOME },
|
|
|
|
|
new String[]{ ID, NOME, "nome_plain" },
|
|
|
|
|
new Field( EMPRESA_ID ).isEqual( empresaID ).and(
|
|
|
|
|
new Field( INACTIVO ).isDifferent( "y" ) ),
|
|
|
|
|
new String[]{ "lower(" + NOME + ")" }, null );
|
|
|
|
|
new String[]{ "nome_plain" }, null );
|
|
|
|
|
Virtual2DArray array = executer.executeQuery( select );
|
|
|
|
|
IDObject objects[] = new IDObject[ array.columnLength() ];
|
|
|
|
|
for( int n = 0; n < objects.length; n++ )
|
|
|
|
|
@ -397,11 +398,12 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
|
|
|
|
|
{
|
|
|
|
|
Select select = new Select( new String[]{ T_TRABALHADORES, T_ESTABELECIMENTOS },
|
|
|
|
|
new String[]{ T_TRABALHADORES + "." + ID,
|
|
|
|
|
T_TRABALHADORES + "." + NOME },
|
|
|
|
|
T_TRABALHADORES + "." + NOME,
|
|
|
|
|
T_TRABALHADORES + ".nome_plain" },
|
|
|
|
|
new Field( T_ESTABELECIMENTOS + "." + EMPRESA_ID ).isEqual( empresaID ).and(
|
|
|
|
|
new Field( T_TRABALHADORES + "." + ESTABELECIMENTO_ID ).isEqual(
|
|
|
|
|
new Field( T_ESTABELECIMENTOS + "." + ID ) ) ),
|
|
|
|
|
new String[]{ "lower(" + T_TRABALHADORES + "." + NOME + ")" }, null );
|
|
|
|
|
new String[]{ T_TRABALHADORES + ".nome_plain" }, null );
|
|
|
|
|
Virtual2DArray array = executer.executeQuery( select );
|
|
|
|
|
IDObject objects[] = new IDObject[ array.columnLength() ];
|
|
|
|
|
for( int n = 0; n < objects.length; n++ )
|
|
|
|
|
@ -417,10 +419,10 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
Select select = new Select( new String[]{ T_TRABALHADORES },
|
|
|
|
|
new String[]{ ID, NOME },
|
|
|
|
|
new String[]{ ID, NOME, "nome_plain" },
|
|
|
|
|
new Field( ESTABELECIMENTO_ID ).isEqual( estabelecimentoID ).and(
|
|
|
|
|
new Field( INACTIVO ).isDifferent( "y" ) ),
|
|
|
|
|
new String[]{ "lower(" + NOME + ")" }, null );
|
|
|
|
|
new String[]{ "nome_plain" }, null );
|
|
|
|
|
Virtual2DArray array = executer.executeQuery( select );
|
|
|
|
|
IDObject objects[] = new IDObject[ array.columnLength() ];
|
|
|
|
|
for( int n = 0; n < objects.length; n++ )
|
|
|
|
|
@ -469,9 +471,9 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
Select select = new Select( new String[]{ T_EMPRESAS },
|
|
|
|
|
new String[]{ ID, DESIGNACAO_SOCIAL },
|
|
|
|
|
new String[]{ ID, DESIGNACAO_SOCIAL, "designacao_social_plain" },
|
|
|
|
|
new Field( INACTIVO ).isEqual( "y" ),
|
|
|
|
|
new String[]{ "lower(" + DESIGNACAO_SOCIAL + ")" }, null );
|
|
|
|
|
new String[]{ "designacao_social_plain" }, null );
|
|
|
|
|
Virtual2DArray array = executer.executeQuery( select );
|
|
|
|
|
IDObject empresas[] = new IDObject[ array.columnLength() ];
|
|
|
|
|
for( int n = 0; n < array.columnLength(); n++ )
|
|
|
|
|
@ -487,10 +489,10 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
Select select = new Select( new String[]{ T_ESTABELECIMENTOS },
|
|
|
|
|
new String[]{ ID, NOME },
|
|
|
|
|
new String[]{ ID, NOME, "nome_plain" },
|
|
|
|
|
new Field( EMPRESA_ID ).isEqual( empresaID ).and(
|
|
|
|
|
new Field( INACTIVO ).isEqual( "y" ) ),
|
|
|
|
|
new String[]{ "lower(" + NOME + ")" }, null );
|
|
|
|
|
new String[]{ "nome_plain" }, null );
|
|
|
|
|
Virtual2DArray array = executer.executeQuery( select );
|
|
|
|
|
IDObject objects[] = new IDObject[ array.columnLength() ];
|
|
|
|
|
for( int n = 0; n < objects.length; n++ )
|
|
|
|
|
@ -506,10 +508,10 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
Select select = new Select( new String[]{ T_TRABALHADORES },
|
|
|
|
|
new String[]{ ID, NOME },
|
|
|
|
|
new String[]{ ID, NOME, "nome_plain" },
|
|
|
|
|
new Field( ESTABELECIMENTO_ID ).isEqual( estabelecimentoID ).and(
|
|
|
|
|
new Field( INACTIVO ).isEqual( "y" ) ),
|
|
|
|
|
new String[]{ "lower(" + NOME + ")" }, null );
|
|
|
|
|
new String[]{ "nome_plain" }, null );
|
|
|
|
|
Virtual2DArray array = executer.executeQuery( select );
|
|
|
|
|
IDObject objects[] = new IDObject[ array.columnLength() ];
|
|
|
|
|
for( int n = 0; n < objects.length; n++ )
|
|
|
|
|
|