|
@@ -3,7 +3,6 @@ package com.yc.education.controller.admin;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.yc.education.model.Authentication;
|
|
|
import com.yc.education.model.Provider;
|
|
|
-import com.yc.education.model.Uda;
|
|
|
import com.yc.education.model.UserInfo;
|
|
|
import com.yc.education.service.IAuthenticationService;
|
|
|
import com.yc.education.service.IProviderService;
|
|
@@ -15,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -143,45 +141,37 @@ public class UserInfoAdminController {
|
|
|
district = null;
|
|
|
}
|
|
|
|
|
|
- List<Uda> listUdaInfo = iUdaService.listUdaInfo(province, city, district);//查询用户省市区
|
|
|
-
|
|
|
- List<Object> list = new ArrayList<>();
|
|
|
- if (listUdaInfo != null && listUdaInfo.size() != 0){ //如果根据省市区查询为空,就将0添加进去,如果不为空,就将查出的id添加到list中传到sql
|
|
|
- for (Uda uda : listUdaInfo){
|
|
|
- list.add(uda.getUserId());
|
|
|
- }
|
|
|
- }else {
|
|
|
- list.add(0);
|
|
|
- }
|
|
|
-
|
|
|
- List<UserInfo> listOwnerCarInfo = iUserInfoService.listOwnerCarInfo(list,nickName,phone,pageNum,pageSize);
|
|
|
+ Integer offset = (pageNum-1) * pageSize;
|
|
|
|
|
|
+ List<UserInfo> listOwnerCarInfo = iUserInfoService.listOwnerCarInfo(province,city,nickName,phone,offset,pageSize);
|
|
|
|
|
|
- if (listOwnerCarInfo != null && listUdaInfo != null){
|
|
|
- for (UserInfo userInfo : listOwnerCarInfo){
|
|
|
- for (Uda uda : listUdaInfo){
|
|
|
- if (userInfo.getId().equals(uda.getUserId()) ){ //根据id匹配将省市区赋值给车主
|
|
|
- userInfo.setProvince(uda.getProvince());//省
|
|
|
- userInfo.setCity(uda.getCity());//市
|
|
|
- userInfo.setDistrict(uda.getDistrict());//区
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ int total = iUserInfoService.listOwnerCarInfo(province, city, nickName, phone, null, null).size( );
|
|
|
+ PageInfo< UserInfo > pager = new PageInfo<>( );
|
|
|
+ pager.setList(listOwnerCarInfo);
|
|
|
+ pager.setTotal(total);
|
|
|
+ int jy = (total-1)/pageSize+1 >= 8 ? 8:(total-1)/pageSize+1;
|
|
|
+ int[] jya = new int[jy];
|
|
|
+ jya[0] = pageNum;
|
|
|
+ for (int i = 1; i <= jy-1; i++) {
|
|
|
+ jya[i] = pageNum+i;
|
|
|
}
|
|
|
+ pager.setNavigatepageNums(jya);
|
|
|
+ pager.setPageSize(pageSize);
|
|
|
+ pager.setPageNum(pageNum);
|
|
|
|
|
|
- mav.addObject("pageInfo",new PageInfo<UserInfo>(listOwnerCarInfo));
|
|
|
- mav.addObject("province",province);
|
|
|
|
|
|
+ int zym = (total-1)/pageSize+1;
|
|
|
+ int nextPage = zym - pageNum > 0 ? pageNum +1 : pageNum;
|
|
|
+ int prePage = pageNum!= 1 ? pageNum - 1 : 1;
|
|
|
+ pager.setPrePage(prePage);
|
|
|
+ pager.setNextPage(nextPage);
|
|
|
+ mav.addObject("pageInfo",pager);
|
|
|
+ mav.addObject("province",province);
|
|
|
mav.addObject("city",city);
|
|
|
-
|
|
|
mav.addObject("district",district);
|
|
|
-
|
|
|
mav.addObject("nickName",nickName);
|
|
|
-
|
|
|
mav.addObject("phone",phone);
|
|
|
-
|
|
|
mav.addObject("pageNum",pageNum);
|
|
|
-
|
|
|
mav.addObject("pageSize",pageSize);
|
|
|
|
|
|
return mav;
|