jiazx0107@163.com
2023-10-22 dfd793f14e51c48c3322f1b36f543179043bd45d
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
42
43
44
45
46
47
48
49
50
51
package com.ld.igds.sec.service;
 
import com.bstek.bdf2.core.orm.hibernate.HibernateDao;
import com.bstek.dorado.data.provider.Page;
import com.ld.igds.models.SecSnapDepot;
import com.ld.igds.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
 
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
 
@Repository
public class SecSnapDepotService extends HibernateDao {
 
 
    public void pageSnapDepot(Page<SecSnapDepot> page, Map<String, Object> param) throws Exception {
 
        String hql = " from " + SecSnapDepot.class.getName()
                + " where companyId=:companyId and deptId=:deptId";
 
        Map<String, Object> args = new HashMap<>();
 
        args.put("companyId", param.get("companyId"));
        args.put("deptId", param.get("deptId"));
 
        String str = (String) param.get("depotId");
        if (StringUtils.isNotEmpty(str)) {
            hql += " and depotId =:depotId";
            args.put("depotId", str);
        }
 
        Date date = (Date) param.get("start");
        if (null != date) {
            hql += " and updateTime >=:start";
            args.put("start", DateUtil.getCurZero(date));
        }
        date = (Date) param.get("end");
        if (null != date) {
            hql += " and updateTime <:end";
            args.put("end", DateUtil.getNextZero(date));
        }
 
        String countHql = "select count(1) " + hql;
 
        hql += " order by updateTime desc";
 
        this.pagingQuery(page, hql, countHql, args);
    }
}