fixes bug#AL_4075
parent
1cc998c868
commit
18d5b7bea8
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>br.com.rjconsultores</groupId>
|
<groupId>br.com.rjconsultores</groupId>
|
||||||
<artifactId>ModelWeb</artifactId>
|
<artifactId>ModelWeb</artifactId>
|
||||||
<version>1.60.1</version>
|
<version>1.61.0</version>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<repository>
|
<repository>
|
||||||
|
|
|
@ -78,6 +78,7 @@ public class OperadorEmbarcadaHibernateDAO extends GenericHibernateDAO<OperadorE
|
||||||
sb.append(" USU.USUARIO_ID = :usuario_id ");
|
sb.append(" USU.USUARIO_ID = :usuario_id ");
|
||||||
// sb.append(" AND PV.EMPRESA_ID = :empresa_id ");
|
// sb.append(" AND PV.EMPRESA_ID = :empresa_id ");
|
||||||
sb.append(" AND USU.ACTIVO = 1 AND PV.ACTIVO = 1 ");
|
sb.append(" AND USU.ACTIVO = 1 AND PV.ACTIVO = 1 ");
|
||||||
|
sb.append( " AND USU.padrao=1 ");
|
||||||
|
|
||||||
SQLQuery sql = getSession().createSQLQuery(sb.toString())
|
SQLQuery sql = getSession().createSQLQuery(sb.toString())
|
||||||
.addScalar("puntoventaId", IntegerType.INSTANCE)
|
.addScalar("puntoventaId", IntegerType.INSTANCE)
|
||||||
|
|
|
@ -22,6 +22,7 @@ import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
|
import javax.persistence.OrderBy;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
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)
|
@OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||||
@Fetch(FetchMode.SELECT)
|
@Fetch(FetchMode.SELECT)
|
||||||
|
@OrderBy("padrao desc")
|
||||||
@NaoAuditar
|
@NaoAuditar
|
||||||
private List<UsuarioUbicacion> usuarioUbicacionList;
|
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
|
@Override
|
||||||
|
|
|
@ -50,6 +50,7 @@ public class UsuarioUbicacion implements Serializable {
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID")
|
@JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID")
|
||||||
private PuntoVenta puntoVenta;
|
private PuntoVenta puntoVenta;
|
||||||
|
private Boolean padrao;
|
||||||
|
|
||||||
public UsuarioUbicacion() {
|
public UsuarioUbicacion() {
|
||||||
}
|
}
|
||||||
|
@ -114,6 +115,15 @@ public class UsuarioUbicacion implements Serializable {
|
||||||
this.usuario = usuario;
|
this.usuario = usuario;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Boolean getPadrao() {
|
||||||
|
return padrao==null?false:padrao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPadrao(Boolean padrao) {
|
||||||
|
this.padrao = padrao;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 0;
|
int hash = 0;
|
||||||
|
|
Loading…
Reference in New Issue