|
|
@@ -18,8 +18,13 @@ public class LitemallTopicService {
|
|
|
private Column[] columns = new Column[]{Column.id, Column.title, Column.subtitle, Column.price, Column.picUrl, Column.readCount};
|
|
|
|
|
|
public List<LitemallTopic> queryList(int offset, int limit) {
|
|
|
+ return queryList(offset, limit, "add_time", "desc");
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<LitemallTopic> queryList(int offset, int limit, String sort, String order) {
|
|
|
LitemallTopicExample example = new LitemallTopicExample();
|
|
|
example.or().andDeletedEqualTo(false);
|
|
|
+ example.setOrderByClause(sort + " " + order);
|
|
|
PageHelper.startPage(offset, limit);
|
|
|
return topicMapper.selectByExampleSelective(example, columns);
|
|
|
}
|
|
|
@@ -41,7 +46,7 @@ public class LitemallTopicService {
|
|
|
example.or().andIdEqualTo(id).andDeletedEqualTo(false);
|
|
|
List<LitemallTopic> topics = topicMapper.selectByExample(example);
|
|
|
if (topics.size() == 0) {
|
|
|
- return queryList(offset, limit);
|
|
|
+ return queryList(offset, limit, "add_time", "desc");
|
|
|
}
|
|
|
LitemallTopic topic = topics.get(0);
|
|
|
|
|
|
@@ -53,7 +58,7 @@ public class LitemallTopicService {
|
|
|
return relateds;
|
|
|
}
|
|
|
|
|
|
- return queryList(offset, limit);
|
|
|
+ return queryList(offset, limit, "add_time", "desc");
|
|
|
}
|
|
|
|
|
|
public List<LitemallTopic> querySelective(String title, String subtitle, Integer page, Integer limit, String sort, String order) {
|
|
|
@@ -94,7 +99,7 @@ public class LitemallTopicService {
|
|
|
public int updateById(LitemallTopic topic) {
|
|
|
LitemallTopicExample example = new LitemallTopicExample();
|
|
|
example.or().andIdEqualTo(topic.getId());
|
|
|
- return topicMapper.updateByExampleWithBLOBs(topic, example);
|
|
|
+ return topicMapper.updateByExampleSelective(topic, example);
|
|
|
}
|
|
|
|
|
|
public void deleteById(Integer id) {
|