package com.ld.igds.m.service; import com.bstek.bdf2.core.orm.hibernate.HibernateDao; import com.ld.igds.models.Grain; import com.ld.igds.util.ContextUtil; import com.ld.igds.util.DateUtil; import org.springframework.stereotype.Component; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author chen */ @Component public class HGrainSupportService extends HibernateDao { public List listGrain(String depotId,Date start,Date end){ String hql = " from " + Grain.class.getName() + " where companyId =:companyId"; Map args = new HashMap(); args.put("companyId",ContextUtil.getCompanyId()); hql += " and depotId like:depotId"; args.put("depotId", depotId); hql += " and receiveDate >=:start"; args.put("start", DateUtil.getCurZero(start)); hql += " and receiveDate <=:end"; args.put("end", DateUtil.getNextZero(end)); hql += " order by receiveDate desc"; return this.query(hql, args); } }