private SmsFlashPromotionSession getFlashPromotionSession(Date date) { Date currTime = DateUtil.getTime(date); SmsFlashPromotionSessionExample sessionExample = new SmsFlashPromotionSessionExample(); sessionExample.createCriteria() .andStartTimeLessThanOrEqualTo(currTime) .andEndTimeGreaterThanOrEqualTo(currTime); List<SmsFlashPromotionSession> promotionSessionList = promotionSessionMapper.selectByExample(sessionExample); if (!CollectionUtils.isEmpty(promotionSessionList)) { return promotionSessionList.get(0); } return null; } }
private SmsFlashPromotionSession getNextFlashPromotionSession(Date date) { SmsFlashPromotionSessionExample sessionExample = new SmsFlashPromotionSessionExample(); sessionExample.createCriteria() .andStartTimeGreaterThan(date); sessionExample.setOrderByClause("start_time asc"); List<SmsFlashPromotionSession> promotionSessionList = promotionSessionMapper.selectByExample(sessionExample); if (!CollectionUtils.isEmpty(promotionSessionList)) { return promotionSessionList.get(0); } return null; }
@Override public List<SmsFlashPromotionSessionDetail> selectList(Long flashPromotionId) { List<SmsFlashPromotionSessionDetail> result = new ArrayList<>(); SmsFlashPromotionSessionExample example = new SmsFlashPromotionSessionExample(); example.createCriteria().andStatusEqualTo(1); List<SmsFlashPromotionSession> list = promotionSessionMapper.selectByExample(example); for (SmsFlashPromotionSession promotionSession : list) { SmsFlashPromotionSessionDetail detail = new SmsFlashPromotionSessionDetail(); BeanUtils.copyProperties(promotionSession, detail); int count = relationService.getCount(flashPromotionId, promotionSession.getId()); detail.setProductCount(count); result.add(detail); } return result; } }
protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; }