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