public Activity getEffectiveActivity() {
Date now = new Date();
Example example = new Example(Activity.class);
example.createCriteria().andEqualTo("isEnable", SystemConstants.YES)
.andEqualTo("activityType", ActivityType.RUN)
.andLessThanOrEqualTo("startDate", now)
.andGreaterThanOrEqualTo("endDate", now);
List<Activity> activities = listAllByExample(example);
if(!activities.isEmpty()) {
return activities.get(0);
} else {
return null;
}
}
SpokesmanUser entity = new SpokesmanUser();
entity.setParentId(userId);
return this.dao.selectCount(entity);
Example example = new Example(SpokesmanUser.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("parentId", userId);
criteria.andNotEqualTo("id", excludChildId);
return this.dao.selectCountByExample(example);
if (query.getStartTime() != null && query.getEndTime() != null
&& query.getEndTime().after(query.getStartTime())) {
String startTime = DateTimeUtils.formatDateTime(query.getStartTime());
String endTime = DateTimeUtils.formatDateTime(query.getEndTime());
criteria.andCondition(String.format(
"((start_time >= '%s' AND '%s' >= start_time) OR ('%s' >= start_time AND end_time >= '%s') OR (end_time >= '%s' AND '%s' >= end_time))",
startTime, endTime, startTime, endTime, startTime, endTime));
}
public List<Entity> listByCsId(String csId) {
Example example = new Example(Entity.class);
example.createCriteria().andEqualTo("csId", csId)
.andEqualTo("isAssignCs", SystemConstants.YES)
.andEqualTo("isEndSession", SystemConstants.NO);
example.setOrderByClause("update_date DESC");
return this.listAllByExample(example);
}
ChatSession updateEntity = new ChatSession();
updateEntity.setId(chatSession.getId());
updateEntity.setServiceEndDate(new Date());
updateEntity.setIsEndSession(SystemConstants.YES);
updateEntity.setRemark(remark);
updateEntity.setUpdateDate(new Date());
updateEntity.setUpdateBy(operator);
Example example = new Example(ChatSession.class);
example.createCriteria().andEqualTo("id", chatSession.getId()).andEqualTo("isEndSession", SystemConstants.NO);
int result = chatSessionRepository.updateByExample(updateEntity, example);