main
tamguo 7 years ago
parent 07eedc9144
commit 13309c11e3

@ -1,5 +1,6 @@
package com.tamguo.modules.tiku.service.impl;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
@ -36,7 +37,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperEntity> impl
List<PaperEntity> paperList = (List<PaperEntity>) cacheService.getObject(SystemConstant.HISTORY_PAPER);
if(paperList == null){
Page<PaperEntity> page = new Page<>(1 , 6);
paperList = paperMapper.selectPage(page, Condition.create().eq("type", SystemConstant.ZHENGTI_PAPER_ID).eq("area_id", SystemConstant.BEIJING_AREA_ID));
paperList = paperMapper.selectPage(page, Condition.create().eq("type", SystemConstant.ZHENGTI_PAPER_ID).eq("area_id", SystemConstant.BEIJING_AREA_ID).orderDesc(Arrays.asList("id")));
cacheService.setObject(SystemConstant.HISTORY_PAPER, paperList , 2 * 60 * 60);
}
return paperList;
@ -48,7 +49,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperEntity> impl
List<PaperEntity> paperList = (List<PaperEntity>) cacheService.getObject(SystemConstant.SIMULATION_PAPER);
if(paperList == null){
Page<PaperEntity> page = new Page<>(1 , 6);
paperList = paperMapper.selectPage(page, Condition.create().eq("type", SystemConstant.MONI_PAPER_ID).eq("area_id", SystemConstant.BEIJING_AREA_ID));
paperList = paperMapper.selectPage(page, Condition.create().eq("type", SystemConstant.MONI_PAPER_ID).eq("area_id", SystemConstant.BEIJING_AREA_ID).orderDesc(Arrays.asList("id")));
cacheService.setObject(SystemConstant.SIMULATION_PAPER, paperList , 2 * 60 * 60);
}
return paperList;
@ -60,7 +61,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperEntity> impl
List<PaperEntity> paperList = (List<PaperEntity>) cacheService.getObject(SystemConstant.HOT_PAPER);
if(paperList == null){
Page<PaperEntity> page = new Page<>(1 , 10);
paperList = paperMapper.selectPage(page, Condition.create().eq("area_id", areaId));
paperList = paperMapper.selectPage(page, Condition.create().eq("area_id", areaId).orderDesc(Arrays.asList("id")));
cacheService.setObject(SystemConstant.HOT_PAPER, paperList , 2 * 60 * 60);
}
return paperList;

@ -14,16 +14,16 @@ public class PageUtils {
private Boolean isShowPreBtn = false;
// 当前页
private String currPageNum;
private Integer currPageNum;
// 页码列表
private List<String> pageNums;
// 总页数
private String totalPage;
private Integer totalPage;
// 总数量
private String total;
private Integer total;
// 数据
private List<?> list;
@ -47,9 +47,9 @@ public class PageUtils {
pgNums.add(((Integer)(page.getCurrent() - 2)).toString());
pgNums.add(((Integer)(page.getCurrent() - 1)).toString());
pgNums.add(((Integer)page.getCurrent()).toString());
}else{
} else {
pgNums.add(((Integer)(page.getCurrent() - 1)).toString());
pgNums.add(((Integer)page.getCurrent()).toString());
pgNums.add(((Integer)(page.getCurrent())).toString());
pgNums.add(((Integer)(page.getCurrent() + 1)).toString());
}
}else{
@ -78,9 +78,9 @@ public class PageUtils {
}
pg.setPageNums(pgNums);
pg.setList(page.getRecords());
pg.setCurrPageNum(((Integer)page.getCurrent()).toString());
pg.setTotal(((Integer)page.getTotal()).toString());
pg.setTotalPage(((Integer)page.getPages()).toString());
pg.setCurrPageNum(((Integer)page.getCurrent()));
pg.setTotal(((Integer)page.getTotal()));
pg.setTotalPage(((Integer)page.getPages()));
return pg;
}
@ -120,32 +120,32 @@ public class PageUtils {
}
public String getCurrPageNum() {
public Integer getCurrPageNum() {
return currPageNum;
}
public void setCurrPageNum(String currPageNum) {
public void setCurrPageNum(Integer currPageNum) {
this.currPageNum = currPageNum;
}
public String getTotalPage() {
public Integer getTotalPage() {
return totalPage;
}
public void setTotalPage(String totalPage) {
public void setTotalPage(Integer totalPage) {
this.totalPage = totalPage;
}
public String getTotal() {
public Integer getTotal() {
return total;
}
public void setTotal(String total) {
public void setTotal(Integer total) {
this.total = total;
}
}

@ -70,6 +70,9 @@ public class PaperController {
if(!StringUtils.isEmpty(paperType) && !"0".equals(paperType)) {
condition.eq("type", paperType);
}
if(!StringUtils.isEmpty(courseId) && !"0".equals(courseId)) {
condition.eq("course_id", courseId);
}
if(!StringUtils.isEmpty(year) && !"0".equals(year)) {
condition.eq("year", year);
}

@ -165,8 +165,8 @@
<a th:href="${domainName + 'paperlist/' + subjectId + '-' + courseId+'-'+paperType+'-'+year+'-' + area +'-1.html'}">&lt;</a>
</li>
<li th:class="${paperPage.currPageNum == num} ? 'selected page-num' : 'page-num'" th:each="num,numStat:${paperPage.pageNums}">
<a th:href="${domainName + 'paperlist/' + subjectId + '-' + courseId+'-'+paperType+'-'+year+'-' + area +'-'+num+'.html'}" th:text="${num}">1</a>
<li th:class="${paperPage.currPageNum + '' == num} ? 'selected page-num' : 'page-num'" th:each="num,numStat:${paperPage.pageNums}">
<a th:href="${domainName + 'paperlist/' + subjectId + '-' + courseId+'-'+paperType+'-'+year+'-' + area +'-'+(num=='...' ? 1 : num)+'.html'}" th:text="${num}">1</a>
</li>
<li class="page-num next" th:if="${paperPage.isShowNextBtn}">

Loading…
Cancel
Save