| | |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Component |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public DepotStore getLastData(String depotId, Date time) { |
| | | |
| | | StringBuilder hql = new StringBuilder(); |
| | | hql.append(" from " + DepotStore.class.getName() + " where depotId = :depotId "); |
| | | |
| | | Map<String, Object> args = new HashMap<>(); |
| | | args.put("depotId", depotId); |
| | | |
| | | if (null != time) { |
| | | hql.append(" and createDate <=:createDate"); |
| | | args.put("createDate", time); |
| | | } |
| | | hql.append(" order by createDate desc"); |
| | | |
| | | List<DepotStore> list = this.query(hql.toString(), args); |
| | | if (null == list || list.isEmpty()) { |
| | | return null; |
| | | } |
| | | return list.get(0); |
| | | } |
| | | } |