|
|
|
|
@ -11,7 +11,9 @@ import com.evolute.utils.sql.Expression;
|
|
|
|
|
import com.evolute.utils.sql.Field;
|
|
|
|
|
import com.evolute.utils.sql.Select;
|
|
|
|
|
import com.evolute.utils.sql.Select2;
|
|
|
|
|
|
|
|
|
|
import db.data.siprp.outer.EmpresasData;
|
|
|
|
|
import db.data.siprp.outer.EstabelecimentosData;
|
|
|
|
|
import db.data.siprp.outer.UtilizadoresData;
|
|
|
|
|
import db.entidades.Utilizador;
|
|
|
|
|
import utils.Global;
|
|
|
|
|
@ -107,12 +109,28 @@ public class UtilizadoresDataProvider extends GenericDataProvider
|
|
|
|
|
public List< Utilizador > getUtilizadoresListByTipo( Integer tipo, String responsavel_loja, Integer estabelecimento_id )
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Select selectEmpresa =
|
|
|
|
|
new Select2( EstabelecimentosData.TABLENAME,
|
|
|
|
|
new Field( EstabelecimentosData.ID_FULL ).isEqual( estabelecimento_id ), EstabelecimentosData.EMPRESA_ID_FULL );
|
|
|
|
|
Virtual2DArray array = getExecuter().executeQuery( selectEmpresa );
|
|
|
|
|
Integer empresaIds[];
|
|
|
|
|
if( array.rowCount() > 0 && array.get( 0, 0 ) != null )
|
|
|
|
|
{
|
|
|
|
|
empresaIds = new Integer[]{ ( Integer ) array.get( 0, 0 ), Global.SIPRP };
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
empresaIds = new Integer[]{ Global.SIPRP };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List< Utilizador > list = new LinkedList< Utilizador >();
|
|
|
|
|
int type = tipo;
|
|
|
|
|
|
|
|
|
|
Expression where = new Field( UtilizadoresData.ACTIVO_FULL ).isEqual( "y" );
|
|
|
|
|
where = where.and( new Field( UtilizadoresData.APAGADO_FULL ).isEqual( "n" ) );
|
|
|
|
|
where = where.and( new Field( UtilizadoresData.TIPO_FULL ).isEqual( type ) );
|
|
|
|
|
where = where.and( new Field( UtilizadoresData.EMPRESA_ID_FULL ).in( empresaIds ) );
|
|
|
|
|
if ( type == Global.RESPONSAVEL_SEGURANCA || type == Global.DIRECTOR_LOJA )
|
|
|
|
|
{
|
|
|
|
|
where = where.and( new Field( UtilizadoresData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) );
|
|
|
|
|
|