Merge pull request 'fixes bug#AL_4075' (!195) from AL_4075 into master
Reviewed-on: adm/ModelWeb#195 Reviewed-by: pinheiro <valdevir@rjconsultores.com.br>master
commit
840c1f36af
|
@ -78,6 +78,7 @@ public class OperadorEmbarcadaHibernateDAO extends GenericHibernateDAO<OperadorE
|
|||
sb.append(" USU.USUARIO_ID = :usuario_id ");
|
||||
// sb.append(" AND PV.EMPRESA_ID = :empresa_id ");
|
||||
sb.append(" AND USU.ACTIVO = 1 AND PV.ACTIVO = 1 ");
|
||||
sb.append( " AND USU.padrao=1 ");
|
||||
|
||||
SQLQuery sql = getSession().createSQLQuery(sb.toString())
|
||||
.addScalar("puntoventaId", IntegerType.INSTANCE)
|
||||
|
|
|
@ -22,6 +22,7 @@ import javax.persistence.Id;
|
|||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.OrderBy;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
|
@ -106,6 +107,7 @@ public class Usuario implements Serializable, UserDetails, Auditavel<Usuario> {
|
|||
|
||||
@OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@Fetch(FetchMode.SELECT)
|
||||
@OrderBy("padrao desc")
|
||||
@NaoAuditar
|
||||
private List<UsuarioUbicacion> usuarioUbicacionList;
|
||||
|
||||
|
@ -541,6 +543,33 @@ public class Usuario implements Serializable, UserDetails, Auditavel<Usuario> {
|
|||
}
|
||||
|
||||
|
||||
public UsuarioUbicacion getUsuarioUbicacionPadrao() {
|
||||
|
||||
if (usuarioUbicacionList != null) {
|
||||
for (UsuarioUbicacion ubicacion : usuarioUbicacionList) {
|
||||
if (ubicacion.getActivo() && ubicacion.getPadrao()) {
|
||||
return ubicacion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public List<UsuarioUbicacion> getUsuarioUbicacionPadraoctivoList() {
|
||||
List<UsuarioUbicacion> ubicacionActivos = new ArrayList<UsuarioUbicacion>();
|
||||
|
||||
if (usuarioUbicacionList != null)
|
||||
for (UsuarioUbicacion ubicacion : usuarioUbicacionList)
|
||||
if (ubicacion.getActivo() && ubicacion.getPadrao())
|
||||
ubicacionActivos.add(ubicacion);
|
||||
|
||||
return ubicacionActivos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
@ -50,6 +50,7 @@ public class UsuarioUbicacion implements Serializable {
|
|||
@OneToOne
|
||||
@JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID")
|
||||
private PuntoVenta puntoVenta;
|
||||
private Boolean padrao;
|
||||
|
||||
public UsuarioUbicacion() {
|
||||
}
|
||||
|
@ -114,6 +115,15 @@ public class UsuarioUbicacion implements Serializable {
|
|||
this.usuario = usuario;
|
||||
}
|
||||
|
||||
|
||||
public Boolean getPadrao() {
|
||||
return padrao==null?false:padrao;
|
||||
}
|
||||
|
||||
public void setPadrao(Boolean padrao) {
|
||||
this.padrao = padrao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
|
|
Loading…
Reference in New Issue