| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.hibernate.Session; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | throws Exception { |
| | | String hql = " from " + Granary.class.getName() |
| | | + " where companyId=:companyId"; |
| | | |
| | | Map<String, Object> args = new HashMap<String, Object>(); |
| | | args.put("companyId", ContextUtil.getCompanyId()); |
| | | |
| | | if (null != param) { |
| | | |
| | | String str = (String) param.get("depotId"); |
| | | if (StringUtils.isNotEmpty(str)) { |
| | | hql += " and cfbh =:depotId"; |
| | | args.put("depotId", str); |
| | | if (null == param) { |
| | | param = new HashMap<>(); |
| | | } |
| | | String companyId = (String) param.get("companyId"); |
| | | if (StringUtils.isEmpty(companyId)) { |
| | | companyId = ContextUtil.getCompanyId(); |
| | | } |
| | | Map<String, Object> args = new HashMap<String, Object>(); |
| | | args.put("companyId", companyId); |
| | | |
| | | String str = (String) param.get("deptId"); |
| | | if (StringUtils.isNotEmpty(str)) { |
| | | hql += " and deptId =:deptId"; |
| | | args.put("deptId", str); |
| | | } |
| | | |
| | | str = (String) param.get("name"); |
| | | if (StringUtils.isNotEmpty(str)) { |
| | | hql += " and ajmc like:name"; |
| | | args.put("name", "%" + str + "%"); |
| | | } |
| | | |
| | | } |
| | | |
| | | String count = "select count(*) " + hql; |
| | | |
| | | hql += " order by updateTime desc"; |
| | | |
| | | this.pagingQuery(page, hql, count, args); |