caolong 4 jaren geleden
bovenliggende
commit
261e451497

+ 4 - 6
src/main/java/com/yc/education/controller/admin/ProviderAdminController.java

@@ -1,8 +1,5 @@
 package com.yc.education.controller.admin;
 
-import com.baidu.ueditor.ActionEnter;
-import com.baidu.ueditor.define.ActionMap;
-import com.baidu.ueditor.define.BaseState;
 import com.github.pagehelper.PageInfo;
 import com.yc.education.controller.BaseController;
 import com.yc.education.mapper.ProviderMapper;
@@ -10,7 +7,6 @@ import com.yc.education.model.*;
 import com.yc.education.service.*;
 import com.yc.education.util.*;
 import com.yc.education.vo.ProviderDetailAdminVo;
-import jxl.write.DateTime;
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -24,7 +20,6 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.multipart.MultipartFile;
@@ -32,7 +27,10 @@ import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.io.*;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.math.BigDecimal;
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;

+ 0 - 2
src/main/java/com/yc/education/controller/admin/ServiceCategoryAdminController.java

@@ -306,8 +306,6 @@ public class ServiceCategoryAdminController {
                 }
             }
         }
-
-
         result.addObject("findall", findall);
         return result;
     }

+ 21 - 31
src/main/java/com/yc/education/controller/admin/UserInfoAdminController.java

@@ -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;

+ 1 - 1
src/main/java/com/yc/education/mapper/UserInfoMapper.java

@@ -53,7 +53,7 @@ public interface UserInfoMapper extends MyMapper<UserInfo> {
      * @param nickName
      * @return
      */
-    List<UserInfo> listOwnerCarInfo(@Param("list")List<Object> list,@Param("nickName") String nickName,@Param("phone") String phone);
+    List<UserInfo> listOwnerCarInfo(@Param("province") String province ,@Param("city") String city,@Param("nickName") String nickName,@Param("phone") String phone,@Param("offset") Integer offset,@Param("pageSize") Integer pageSize);
     List<UserInfo> listOwnerCarInfo();
 
     /**

+ 2 - 1
src/main/java/com/yc/education/service/IUserInfoService.java

@@ -69,7 +69,8 @@ public interface IUserInfoService  extends IService<UserInfo>  {      //继承
      * @param pageSize
      * @return
      */
-    List<UserInfo> listOwnerCarInfo(List<Object> list,String nickName, String phone,Integer pageNum, Integer pageSize);
+    List<UserInfo> listOwnerCarInfo(String province ,String city,String nickName, String phone,Integer offset, Integer pageSize);
+
     List<UserInfo> listOwnerCarInfo();
 
     int  listUserNumber();

+ 2 - 4
src/main/java/com/yc/education/service/impl/UserInfoServiceImpl.java

@@ -133,14 +133,12 @@ public class UserInfoServiceImpl extends BaseService<UserInfo> implements IUserI
      *
      * @param nickName
      * @param phone
-     * @param pageNum
      * @param pageSize
      * @return
      */
     @Override
-    public List<UserInfo> listOwnerCarInfo(List<Object> list,String nickName, String phone, Integer pageNum, Integer pageSize) {
-        PageHelper.startPage(pageNum, pageSize);
-        return userInfoMapper.listOwnerCarInfo(list,nickName,phone);
+    public List<UserInfo> listOwnerCarInfo(String province ,String city,String nickName, String phone, Integer offset, Integer pageSize) {
+        return userInfoMapper.listOwnerCarInfo(province,city,nickName,phone,offset,pageSize);
     }
 
     @Override

+ 28 - 0
src/main/java/com/yc/education/test/BigNumberDecimal.java

@@ -0,0 +1,28 @@
+package com.yc.education.test;
+
+/**
+ * @ProjectName: nvrnetwork
+ * @Package: com.yc.education.test
+ * @ClassName: BigNumberDecimal
+ * @Author: Jzdsh
+ * @Description:
+ * @Date: 2020/1/20 14:27
+ * @Version: 1.0
+ */
+public class BigNumberDecimal {
+
+    private static String IPad(String now,int exp,char padd){
+        if(now == null || now.length() >= exp){
+            return now;
+        }
+        StringBuilder buf = new StringBuilder(exp);
+        for (int i = 0 ,  paddLength = exp - now.length(); i< padd; i++) {
+            buf.append(padd);
+        }
+        return buf.append(now).toString();
+    }
+
+    public static void main(String [] args){
+
+    }
+}

+ 36 - 0
src/main/java/com/yc/education/test/SampleChineseSort.java

@@ -0,0 +1,36 @@
+package com.yc.education.test;
+
+import java.text.Collator;
+import java.util.*;
+
+/**
+ * @ProjectName: nvrnetwork
+ * @Package: com.yc.education.test
+ * @ClassName: SampleChineseSort
+ * @Author: Jzdsh
+ * @Description:
+ * @Date: 2020/1/20 13:42
+ * @Version: 1.0
+ */
+public class SampleChineseSort {
+
+    private final static Comparator CHINA_COMPARE = Collator.getInstance(Locale.CHINA);
+
+    private static void sortList(){
+        List< String > list = Arrays.asList("张三", "李四", "王五");
+        Collections.sort(list,CHINA_COMPARE);
+        for (String str : list) {
+            System.out.println(str );
+        }
+    }
+
+    private static void sortArray(){
+        String[] arr = {"张三", "李四", "王五"};
+        Arrays.sort(arr,CHINA_COMPARE);
+        for (String str : arr) {
+            System.out.println(str );
+        }
+    }
+
+
+}

+ 12 - 10
src/main/resources/mapper/UserInfoMapper.xml

@@ -122,24 +122,26 @@
     </select>
     <!--查询车主信息并分页-->
     <select id="listOwnerCarInfo" resultMap="BaseResultMap">
-        select * from user_info
+        select a.*,b.province,b.city from user_info a,uda b
         <where>
-            role = 0
+            a.role = 0 and a.id = b.user_id
             <if test="nickName != null and nickName != ''">
-                and nick_Name like concat('%',#{nickName},'%')
+                and a.nick_Name like concat('%',#{nickName},'%')
             </if>
             <if test="phone != null and phone != ''">
                 and phone = #{phone}
             </if>
-            <if test="list != null and list.size()!= 0">
-                and id in
-                <foreach collection="list" item="id" open="(" separator="," close=")">
-                    #{id}
-                </foreach>
+            <if test="province != null and province != ''">
+                and b.province = #{province}
+            </if>
+            <if test="city != null and city != ''">
+                and b.city = #{city}
+            </if>
+            order by a.create_date desc
+            <if test="offset != null">
+                limit #{offset} ,#{pageSize}
             </if>
         </where>
-
-        order by id desc,create_date desc
     </select>
     <!--查询服务商信息-->
     <select id="listProviderInfo" resultMap="BaseResultMap">

+ 2 - 2
src/main/webapp/WEB-INF/jsp/admin/ownerCarList.jsp

@@ -63,7 +63,7 @@
             </select>
 		</span>--%>
            <div id="show"></div>
-         <select id="s_province" name ="province" style="width: 100px;height: 30px;font-size: 14px"></select>
+         <select id="s_province" name ="province" style="width: 100px;height: 30px;font-size: 14px" ></select>
           <select id="s_city" name ="city" style="width: 100px;height: 30px;font-size: 14px"></select>
           <select id="s_county" name ="district" style="width: 100px;height: 30px;font-size: 14px"></select>
 
@@ -184,7 +184,7 @@
                     <c:forEach items="${pageInfo.navigatepageNums}" var="nav">
                         <c:if test="${nav == pageInfo.pageNum}">
                             <li><a href="ownerCarList.html?nickName=${nickName}&pageNum=${nav}&pageSize=${pageInfo.pageSize}"
-                                   class="active">${nav}</a></li>
+                                     <c:if test="${pageNum == pageInfo.pageNum}"> class="active" </c:if>>${nav}</a></li>
                         </c:if>
                         <c:if test="${nav != pageInfo.pageNum}">
                             <li>