📄 goodshomeservice.java
字号:
package com.shunshi.ssh.home.service;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import com.shunshi.ssh.entity.Goods;
import com.shunshi.ssh.entity.Page;
import com.shunshi.ssh.home.dao.GoodsHomeDao;
public class GoodsHomeService {
private GoodsHomeDao dao;
public GoodsHomeDao getDao() {
return dao;
}
public void setDao(GoodsHomeDao dao) {
this.dao = dao;
}
public Goods findById(Long id) {
return dao.findById(id);
}
public List perList() {
List<Goods> l=dao.preList();
System.out.println(l.size());
List tempList=new ArrayList();
for(Goods g:l){
Goods g1=new Goods();
g1.setTopic(StringUtils.abbreviate(g.getTopic(), 5));
g1.setId(g.getId());
g1.setSource(g.getSource());
g1.setTarget(g.getTarget());
g1.setPublishTime(g.getPublishTime());
tempList.add(g1);
}
return tempList;
}
public List listAll(int toPageNo){
int total= dao.getTotalRowsByState(2).intValue();
PageController pc = new PageController(total,toPageNo);
List all= dao.listAll(2,pc.getPageStartRow(), pc.getPageSize());
return all;
}
public int getTotalPageCount() {
int totalRow=dao.getTotalRowsByState(2).intValue();
if(totalRow==0){
return 1;
}
PageController pc = new PageController();
pc.setTotalRowsAmount(totalRow);
return pc.getTotalPages();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -