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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.ld.igds.log.service;
 
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
 
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
 
import com.bstek.bdf2.core.orm.hibernate.HibernateDao;
import com.bstek.dorado.data.provider.Page;
import com.ld.igds.models.LogOperation;
import com.ld.igds.util.ContextUtil;
import com.ld.igds.util.DateUtil;
 
@Component
public class HLogOperateService extends HibernateDao {
    public void pageLog(Page<LogOperation> page, Map<String, Object> parameter)
            throws Exception {
        String hql = " from " + LogOperation.class.getName()
                + " where companyId=:companyId";
 
        Map<String, Object> args = new HashMap<String, Object>();
        args.put("companyId", ContextUtil.getCompanyId());
 
        if (null != parameter) {
            String str = (String) parameter.get("bizType");
            if (StringUtils.isNotEmpty(str)) {
                hql += " and bizType=:bizType ";
                args.put("bizType", str);
            }
 
            str = (String) parameter.get("depotId");
            if (StringUtils.isNotEmpty(str)) {
                hql += " and depotId=:depotId ";
                args.put("depotId", str);
            }
 
            Date date = (Date) parameter.get("start");
            if (null != date) {
                hql += " and operateTime >=:start ";
                args.put("start", DateUtil.getCurZero(date));
            }
 
            date = (Date) parameter.get("end");
            if (null != date) {
                hql += " and operateTime <:end ";
                args.put("end", DateUtil.getNextZero(date));
            }
        }
 
        String coutHql = " select count(*) " + hql;
        hql += " order by operateTime desc";
 
        this.pagingQuery(page, hql, coutHql, args);
    }
 
}