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; }
public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; }
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; } }
@Override public List<SmsFlashPromotionSession> list() { SmsFlashPromotionSessionExample example = new SmsFlashPromotionSessionExample(); return promotionSessionMapper.selectByExample(example); }
@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; } }
public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; }