lucas.calixto 2017-02-22 16:51:28 +00:00
parent 56fa62d48e
commit 6951582b55
4 changed files with 110 additions and 0 deletions

View File

@ -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, Integer> {
EstacionSitef buscar(Empresa empresa, Integer numempresa, Integer numfilial, String numpdv);
}

View File

@ -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<EstacionSitef, Integer> 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<EstacionSitef> estacionsSitef = c.list();
return estacionsSitef.isEmpty() ? null : estacionsSitef.get(0);
}
}

View File

@ -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);
}

View File

@ -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);
}
}