@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); }
@Override public int countDisplayMessage() { MessageExample messageExample = new MessageExample(); messageExample.createCriteria().andDisplayEqualTo(true); return messageMapper.countByExample(messageExample); }
@Override public int updateMessage(Message message) { return messageMapper.updateByPrimaryKeySelective(message); }
public int queryMessageCount() { return messageMapper.countByExample(null); }
public int delete(Integer id) { return messageMapper.deleteByPrimaryKey(id); }
public void insert(Message message) { messageMapper.insert(message); }