代码如下: public Page<Record> getPage(Integer pageNum , Map<String, String> map) { List<String> whereParams = new ArrayList<String>(); String select = "SELECT tc.number ,tc.title , tc.time , tc.price , tc.income , tc.count,tc.id,tc.novelId , tn.nName " ; StringBuffer sBuffer = new StringBuffer(" FROM t_chapter tc "); sBuffer.append(" LEFT JOIN t_novel tn ON tc.novelId = tn.id "); sBuffer.append(" WHERE 1=1 "); //筛选条件不为空时,追加筛选条件语句到sql中 this.addEqualCondition(sBuffer, whereParams , "tn.id", map.get("novelId")); this.addLikeCondition(sBuffer, whereParams ,"tn.nName", map.get("nName")); sBuffer.append(" ORDER BY tc.novelId , tc.number DESC "); return Db.paginate(pageNum, DicUtil.PAGE_SIZE, select, sBuffer.toString() , whereParams.toArray() ) ; } tc.novelId , tc.number 已创建索引