diff --git a/src/com/rjconsultores/ventaboletos/dao/EstacionSitefDAO.java b/src/com/rjconsultores/ventaboletos/dao/EstacionSitefDAO.java new file mode 100644 index 000000000..d6511541d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EstacionSitefDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EstacionSitef; + +/** + * + * @author Lucas + * + */ +public interface EstacionSitefDAO extends GenericDAO { + + EstacionSitef buscar(Empresa empresa, Integer numempresa, Integer numfilial, String numpdv); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionSitefHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionSitefHibernateDAO.java new file mode 100644 index 000000000..a198280fc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionSitefHibernateDAO.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EstacionSitefDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EstacionSitef; + +/** + * + * @author Lucas + * + */ +@Repository("estacionSitefDAO") +public class EstacionSitefHibernateDAO extends GenericHibernateDAO implements EstacionSitefDAO { + + @Autowired + public EstacionSitefHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public EstacionSitef buscar(Empresa empresa, Integer numempresa, Integer numfilial, String numpdv) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.eq("numempresa", numempresa)); + c.add(Restrictions.eq("numfilial", numfilial)); + c.add(Restrictions.eq("numpdv", numpdv)); + List estacionsSitef = c.list(); + return estacionsSitef.isEmpty() ? null : estacionsSitef.get(0); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/EstacionSitefService.java b/src/com/rjconsultores/ventaboletos/service/EstacionSitefService.java new file mode 100644 index 000000000..037328d87 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EstacionSitefService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EstacionSitef; + +/** + * + * @author Lucas + * + */ +public interface EstacionSitefService { + + EstacionSitef buscar(Empresa empresa, Integer numempresa, Integer numfilial, String numpdv); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EstacionSitefServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EstacionSitefServiceImpl.java new file mode 100644 index 000000000..7befa5ac6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EstacionSitefServiceImpl.java @@ -0,0 +1,27 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.EstacionSitefDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EstacionSitef; +import com.rjconsultores.ventaboletos.service.EstacionSitefService; + +/** + * + * @author Lucas + * + */ +@Service("estacionSitefService") +public class EstacionSitefServiceImpl implements EstacionSitefService { + + @Autowired + private EstacionSitefDAO estacionSitefDAO; + + @Override + public EstacionSitef buscar(Empresa empresa, Integer numempresa, Integer numfilial, String numpdv) { + return estacionSitefDAO.buscar(empresa, numempresa, numfilial, numpdv); + } + +}