albertshaw лет назад: 8
Родитель
Сommit
384cf365db

+ 11 - 1
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -1,5 +1,6 @@
 package com.goafanti.admin.service.impl;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -72,12 +73,21 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 		if (pageSize == null || pageSize < 0 || pageSize > 10) {
 			pageSize = 10;
 		}
+		if (province != null) {
+			List<Integer> provinceList = new ArrayList<>();
+			provinceList.add(province);
+			params.put("provinceList", provinceList);
+		}
 		if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
-			return (Pagination<AdminListBo>) findPage("findAdminListByPage", "findAdminCount", params, pageNo,
+			return (Pagination<AdminListBo>) findPage("findAreaAdminListByPage", "findAreaAdminCount", params, pageNo,
 					pageSize);
 		} else if (TokenManager.hasRole(AFTConstants.AREAADMIN)) {
 			List<Integer> provinceList = adminLocationMapper
 					.selectProvinceWhereCityIsNullByAdminId(TokenManager.getAdminId());
+			if (province != null && provinceList.contains(province)) {
+				provinceList = new ArrayList<>();
+				provinceList.add(province);
+			}
 			List<Integer> cityList = adminLocationMapper.selectCityByAdminId(TokenManager.getAdminId());
 			provinceList.addAll(cityList);
 			if (null != provinceList && provinceList.size() > 0) {

+ 42 - 42
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -175,46 +175,6 @@
     where mobile = #{mobile,jdbcType=VARCHAR}
   </select> 
   
-  <select id= "findAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo" >
-  	select 
-   		 a.number, a.mobile, a.name, 
-   		 a.position, a.email, a.id,
-   		 a.create_time as createTime, GROUP_CONCAT(DISTINCT(al.province)) AS province,
-   		 aa.name as superior, a.superior_id as superiorId
-    from admin a 
-    left join admin_location al on a.id = al.admin_id
-    left join admin aa on aa.id = a.superior_id
-    where a.id <![CDATA[ <> ]]> '1'
-    <if test = "mobile != null"> 
-    	and a.mobile = #{mobile,jdbcType=VARCHAR}
-    </if>
-    <if test = "name != null"> 
-    	and a.name = #{name,jdbcType=VARCHAR}
-    </if>
-    <if test = "number != null">
-    	and a.number = #{number,jdbcType=INTEGER}
-    </if>
-    group by a.id  
-    order by a.number 
-    <if test="page_sql!=null">
-			${page_sql}
-	</if>
-  </select>
-  
-  <select id = "findAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
-   select count(1) from admin
-     where id <![CDATA[ <> ]]> '1'
-    <if test = "mobile != null"> 
-    	and mobile = #{mobile,jdbcType=VARCHAR}
-    </if>
-     <if test = "name != null"> 
-    	and name = #{name,jdbcType=VARCHAR}
-    </if>
-    <if test = "number != null">
-    	and number = #{number,jdbcType=INTEGER}
-    </if>
-  </select>
-  
   <select id="selectRolesByPrimaryKey" parameterType="java.lang.String">
    select r.name, r.id, r.type
     from role r
@@ -350,7 +310,33 @@
 	</if>
    </select>
    
-    <select id= "findAreaAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo" >
+    <select id= "findAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo" >
+  	select 
+   		 a.number, a.mobile, a.name, 
+   		 a.position, a.email, a.id,
+   		 a.create_time as createTime, GROUP_CONCAT(DISTINCT(al.province)) AS province,
+   		 aa.name as superior, a.superior_id as superiorId
+    from admin a 
+    left join admin_location al on a.id = al.admin_id
+    left join admin aa on aa.id = a.superior_id
+    where a.id <![CDATA[ <> ]]> '1'
+    <if test = "mobile != null"> 
+    	and a.mobile = #{mobile,jdbcType=VARCHAR}
+    </if>
+    <if test = "name != null"> 
+    	and a.name = #{name,jdbcType=VARCHAR}
+    </if>
+    <if test = "number != null">
+    	and a.number = #{number,jdbcType=INTEGER}
+    </if>
+    group by a.id  
+    order by a.number 
+    <if test="page_sql!=null">
+			${page_sql}
+	</if>
+  </select>
+  
+  <select id= "findAreaAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo" >
   	select 
    		 a.number, a.mobile, a.name, 
    		 a.position, a.email, a.id,
@@ -376,7 +362,7 @@
 			#{plist}
 		</foreach>
 	</if>
-	<if test = "provinceList != null &amp;&amp; cityList != null">
+	<if test = "provinceList != null and cityList != null">
 	or 
 	</if>
 	<if test="cityList != null">
@@ -395,6 +381,20 @@
 	</if>
   </select>
   
+  <select id = "findAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
+   select count(1) from admin
+     where id <![CDATA[ <> ]]> '1'
+    <if test = "mobile != null"> 
+    	and mobile = #{mobile,jdbcType=VARCHAR}
+    </if>
+     <if test = "name != null"> 
+    	and name = #{name,jdbcType=VARCHAR}
+    </if>
+    <if test = "number != null">
+    	and number = #{number,jdbcType=INTEGER}
+    </if>
+  </select>
+  
   <select id = "findAreaAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
    select count(distinct(a.number))  
    from admin a 

+ 2 - 1
src/main/webapp/WEB-INF/views/common.html

@@ -230,7 +230,8 @@
 				mobile:  /*[[${adminData.mobile}]]*/'',
 				name: /*[[${adminData.name}]]*/'',
 				email: /*[[${adminData.email}]]*/'',
-				createTime: /*[[${adminData.createTime}]]*/''
+				createTime: /*[[${adminData.createTime}]]*/'',
+				uid: /*[[${adminData.id}]]*/''
 			}
 			window.showUserManage = /*[[${shiro.hasRole('999999') || shiro.isPermitted('admin/userManage')}]]*/false;
 			window.showServices = /*[[${shiro.hasRole('999999') || shiro.isPermitted('admin/services')}]]*/false;