예제 #1
0
 @Override
 public List<Message> queryDisplayMessage(String sort, Integer page, Integer size) {
   MessageExample messageExample = new MessageExample();
   messageExample.createCriteria().andDisplayEqualTo(true);
   String limitSql = "";
   if (size != null && size > 0) {
     if (page != null && page > 0) {
       limitSql += " limit " + (page - 1) * size + "," + size;
     } else {
       limitSql += " limit " + size;
     }
   }
   if (sort != null && !"".equals(sort)) {
     messageExample.setOrderByClause(sort + limitSql);
   } else {
     messageExample.setOrderByClause("id desc" + limitSql);
   }
   return messageMapper.selectByExampleWithBLOBs(messageExample);
 }
예제 #2
0
 @Override
 public int countDisplayMessage() {
   MessageExample messageExample = new MessageExample();
   messageExample.createCriteria().andDisplayEqualTo(true);
   return messageMapper.countByExample(messageExample);
 }