67,513
社区成员
发帖
与我相关
我的任务
分享
var startAllAppoint = 0;
var limitAllAppoint = 10;
var currentPageAllAppoint = 1;
var totalPageAllAppoint = 0;
//分页参数设置
var applyId = null;
$(document).ready(function(){
getShopAuditInfo();
initpage1();
$("button").click(function(){
applyId = $(this).val();
getShopAuditInfo();
});
});
function getShopAuditInfo(){
$.ajax({
type : "post",
async : false,
url : "all_shops_reviewd",
data : {start:startAllAppoint, limit:limitAllAppoint, applyId:applyId},
success : function(data,status){
data = eval("(" + data + ")");
fillShopAuditInfo(data.root);
startAllAppoint = data.currentResult;
totalPageAllAppoint = data.totalPage;
}
});
}
function fillShopAuditInfo(data){
var s = "<tr><th>公司名称</th><th>门店名称</th><th>所在地</th><th>负责人</th><th>合伙人</th><th>电话</th><th>申请时间</th><th>当前状态</th><th>审核人</th><th>审核时间</th></tr>";
$.each(data, function(v, o){
s += '<tr><td><a href="select_shop_reviewd?shopId='+ o.shopId +'">'+ o.companyName +'</a></td>';
s += '<td>' + o.shopName + '</td>';
s += '<td>' + o.address + '</td>';
s += '<td>' + o.contactPerson + '</td>';
s += '<td>暂无</td>'
s += '<td>' + o.phone + '</td>';
s += '<td>' + o.applyTime + '</td>';
if(o.shopStatus == '0'){
s += '<td>审核中</td>';
}else if(o.shopStatus == '1'){
s += '<td>已通过</td>';
}else if(o.shopStatus == '3'){
s += '<td>已拒绝</td>';
}else{
s += '<td></td>';
}
s += '<td>' + o.userCaption + '</td>';
s += '<td>' + o.approveTime + '</td></tr>';
});
if(data.length > 0){
$("#page1").show();
$("#housesInfo").html(s);
}else{
$("#page1").hide();
$("#housesInfo").html("<br/><span style='width:10%;height:30px;display:block;margin:0 auto;'>暂无数据</span>");
}
}
function initpage1(){
$("#page1").jqPagination({
link_string : '',
current_page: currentPageAllAppoint, //设置当前页 默认为1
max_page : totalPageAllAppoint, //设置最大页 默认为1
page_string : '当前第{current_page}页,共{max_page}页',
paged : function(page) {
startAllAppoint = (page-1)*limitAllAppoint;
getShopAuditInfo();
}
});
}
@ResponseBody
@RequestMapping("/all_shops_reviewd")
public void shopReviewdList(Integer start,Integer limit, Integer applyId){
Page page = new Page();
page.setStart(start);
page.setLimit(limit);
projectService.findAllReviewedShops(page, applyId);
this.outPageString(page);
}
@Override
public void findAllReviewedShops(Page page, Integer applyId) {
Map<String, String> shopMap = new HashMap<>();
List<ShopAndUserNameDTO> shopDtoList = null;
if (applyId == null) {
String hql = "from Shops";
List<Shops> Project = baseDao.findByHql(hql, page.getStart(), page.getLimit());
List<ShopAndUserNameDTO> allProject = findShopAndUserNameDTO(Project);
String cHql = "select count(*) " + hql;
int total = baseDao.countQuery(cHql);
page.setRoot(allProject);
page.setTotal(total);
} else if (applyId == 0) { // 当applyId为0的时候表示“只显示审核中的申请”
String hql = "from Shops where shopStatus = 0";
List<Shops> Project = baseDao.findByHql(hql, page.getStart(), page.getLimit());
List<ShopAndUserNameDTO> allProject = findShopAndUserNameDTO(Project);
String cHql = "select count(*) " + hql;
int total = baseDao.countQuery(cHql);
page.setRoot(allProject);
page.setTotal(total);
} else if (applyId == 1) { // 当applyId为1的时候表示“只显示已经通过的申请”
String hql = "from Shops where shopStatus = 1";
List<Shops> Project = baseDao.findByHql(hql, page.getStart(), page.getLimit());
List<ShopAndUserNameDTO> allProject = findShopAndUserNameDTO(Project);
String cHql = "select count(*) " + hql;
int total = baseDao.countQuery(cHql);
page.setRoot(allProject);
page.setTotal(total);
} else if (applyId == 3) { // 当applyId为3的时候表示“只显示已经拒绝的申请”
String hql = "from Shops where shopStatus = 3";
List<Shops> Project = baseDao.findByHql(hql, page.getStart(), page.getLimit());
List<ShopAndUserNameDTO> allProject = findShopAndUserNameDTO(Project);
String cHql = "select count(*) " + hql;
int total = baseDao.countQuery(cHql);
page.setRoot(allProject);
page.setTotal(total);
}
}
public class Page {
/** 总记录数 */
private int total;
/** 分页结果 */
private List root;
/** 开始页码 */
private int start;
/** 每页多少 */
private int limit;
/** 查询条件 */
private String wheres;
private int currentPage; //当前页
private int currentResult; //当前记录起始索引
private int totalPage; //总页数
public int getCurrentPage() {
if(currentPage<=0)
currentPage = 1;
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getCurrentResult() {
currentResult = (getCurrentPage()-1)*getLimit();
if(currentResult<0)
currentResult = 0;
return currentResult;
}
public void setCurrentResult(int currentResult) {
this.currentResult = currentResult;
}
public int getTotalPage() {
if(total%limit==0)
totalPage = total/limit;
else
totalPage = total/limit+1;
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public List getRoot() {
return root;
}
public void setRoot(List root) {
this.root = root;
}
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
public String getWheres() {
return wheres;
}
public void setWheres(String wheres) {
this.wheres = wheres;
}
@Override
public String toString() {
return start+" "+total +" " +root;
}
}
$(function () {
$("#page").pagination({
pageIndex: ${orderEntity.page.pageNo},
pageSize: ${orderEntity.page.pageSize},
total: ${orderEntity.page.totalRecords},
debug: false,
showInfo: true,
showJump: true,
showPageSizes: true,
pageElementSort: ['$page', '$jump', '$info']
});
});
/**
* 分页类
*/
public class Page {
/**
* 当前页
*/
private int pageNo = 0;
/** 每页数据量 */
private int pageSize = Constant.PAGE_SIZE;
/**
* 总记录数
*/
private int totalRecords;
..get/set.......省略1W码。
}