CZT
2023-11-27 c206acfaedc69c390fb67daa81bc686f58a212ef
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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<Grain> listGrain(String depotId,Date start,Date end){
        String hql = " from " + Grain.class.getName()
                + " where companyId =:companyId";
 
        Map<String,Object> args = new HashMap<String,Object>();
        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);
    }
}