public int publish( ReceiveType type,String value,String msgId ){
return getDao().publish(type, value, msgId);
}
public ListPage<Publish> list(ListPage<Publish> page ,Publish t){
SearchCondition sc = new SearchCondition();
if( t != null ){
if( t.getUser() != null && t.getUser().getId() != null ){
sc.equal("user.id", t.getUser().getId() );
}
if( t.getPeriod() != null ){
Calendar cal = Calendar.getInstance();
Date start = t.getPeriod().getStart();
Date end = t.getPeriod().getEnd();
if( start != null ){
cal.setTime(start);
sc.greateThanOrEqual("createdTime",cal);
}
if( end != null ){
Calendar cal_end = Calendar.getInstance();
cal_end.setTime(end);
cal_end.add(Calendar.DAY_OF_MONTH, 1);
cal_end.add(Calendar.SECOND, -1);
sc.lessThanOrEqual("createdTime",cal_end);
}
}
if( t.getRead() != null ){
if( Boolean.TRUE.equals( t.getRead() ) )
sc.isNotNull("readTime");
else
sc.isNull("readTime");
}
if( t.getMessage() != null ){
Message msg = t.getMessage();
if( StringUtils.isNotEmpty( msg.getTitle() ) ){
sc.like("message.title", msg.getTitle().trim() );
}
if( StringUtils.isNotEmpty( msg.getCreator() ) ){
sc.equal("message.creator", msg.getCreator().trim() );
}
}
}
return dao.list(page, sc);