Michael лет назад: 8
Родитель
Сommit
cc5475e544

+ 34 - 1
src/main/java/com/goafanti/admin/bo/AdminListBo.java

@@ -46,7 +46,7 @@ public class AdminListBo {
 	private String city;
 	
 	/**
-	 * 
+	 * 
 	 */
 	private String	position;
 
@@ -66,6 +66,39 @@ public class AdminListBo {
 	/** 部门名称 **/
 	private String departmentName;
 	
+	/** 用户状态 **/
+	private String status;
+	
+	/** 用户编号 **/
+	private String userNo;
+	
+	/** 职务 **/
+	private String duty;
+	
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public String getUserNo() {
+		return userNo;
+	}
+
+	public void setUserNo(String userNo) {
+		this.userNo = userNo;
+	}
+
+	public String getDuty() {
+		return duty;
+	}
+
+	public void setDuty(String duty) {
+		this.duty = duty;
+	}
+
 	public String getSuperiorId() {
 		return superiorId;
 	}

+ 47 - 0
src/main/java/com/goafanti/admin/controller/AdminSuperviserApiController.java

@@ -0,0 +1,47 @@
+package com.goafanti.admin.controller;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import com.goafanti.admin.bo.AdminListBo;
+import com.goafanti.admin.service.AdminLocationService;
+import com.goafanti.admin.service.AdminService;
+import com.goafanti.admin.service.NewAdminService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.utils.PasswordUtil;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.user.service.UserService;
+
+@Controller
+@RequestMapping(value = "open/api/admin/superviser")
+public class AdminSuperviserApiController extends CertifyApiController {
+	@Resource
+	private NewAdminService			newAdminService;
+	@Resource(name = "passwordUtil")
+	private PasswordUtil			passwordUtil;
+	@Resource
+	private AdminLocationService	adminLocationService;
+	@Resource
+	private UserService				userService;
+	/**管理员列表*/
+	@RequestMapping(value = "/adminList", method = RequestMethod.GET)
+	public Result adminList(AdminListBo alb, String rid, String pageNo,
+			String pageSize) {
+		Result res = new Result();
+		Integer pNo = 1;
+		Integer pSize = 10;
+		if (StringUtils.isNumeric(pageSize)) {
+			pSize = Integer.parseInt(pageSize);
+		}
+		if (StringUtils.isNumeric(pageNo)) {
+			pNo = Integer.parseInt(pageNo);
+		}
+		res.setData(newAdminService.listAdmin(alb,rid, pNo, pSize));
+		return res;
+	}
+	
+}

+ 8 - 0
src/main/java/com/goafanti/admin/service/NewAdminService.java

@@ -0,0 +1,8 @@
+package com.goafanti.admin.service;
+
+import com.goafanti.admin.bo.AdminListBo;
+import com.goafanti.core.mybatis.page.Pagination;
+
+public interface NewAdminService {
+	Pagination<AdminListBo> listAdmin(AdminListBo alb,String rid,Integer pageNo, Integer pageSize);
+}

+ 43 - 0
src/main/java/com/goafanti/admin/service/impl/NewAdminServiceImpl.java

@@ -0,0 +1,43 @@
+package com.goafanti.admin.service.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.goafanti.admin.bo.AdminListBo;
+import com.goafanti.admin.service.NewAdminService;
+import com.goafanti.common.dao.AdminLocationMapper;
+import com.goafanti.common.dao.AdminMapper;
+import com.goafanti.common.dao.UserRoleMapper;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+
+@Service
+public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements NewAdminService {
+	@Autowired
+	private AdminMapper			adminMapper;
+	@Autowired
+	private UserRoleMapper		userRoleMapper;
+	@Autowired
+	private AdminLocationMapper	adminLocationMapper;
+	
+	@Override
+	public Pagination<AdminListBo> listAdmin(AdminListBo alb, String rid, Integer pageNo, Integer pageSize) {
+		Map<String,Object> params = new HashMap<String, Object>();
+		if(StringUtils.isNotBlank(alb.getName())) params.put("name", alb.getName());
+		if(StringUtils.isNotBlank(alb.getDepartmentId())) params.put("departmentId", alb.getDepartmentId());
+		if(StringUtils.isNotBlank(rid)) params.put("rid", rid);
+		if(StringUtils.isNotBlank(alb.getDuty())) params.put("duty",alb.getDuty());
+		if(StringUtils.isNotBlank(alb.getPosition())) params.put("position", alb.getPosition());
+		if(StringUtils.isNotBlank(alb.getStatus())) params.put("status", alb.getStatus());
+		if(StringUtils.isNotBlank(alb.getMobile())) params.put("mobile", alb.getMobile());
+		if(StringUtils.isNotBlank(alb.getSuperiorId())) params.put("superiorId", alb.getSuperiorId());		
+		@SuppressWarnings("unchecked")
+		Pagination<AdminListBo> p=(Pagination<AdminListBo>)findPage("selectAdminListByPage","selectAdminCount",params,pageNo,pageSize);
+		return p;
+	}
+
+}

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

@@ -370,4 +370,81 @@
   <select id="listAdminByName" parameterType="java.lang.String" resultMap="BaseResultMap">
 	select id,name from admin where name like concat('%',#{name},'%')  
   </select>
+  <!--*************************************************************************-->
+  <select id= "selectAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo" >
+  	select 
+   		 a.user_no as userNo, a.mobile, a.name, 
+   		 a.position, a.email, a.id,
+   		 a.province,
+   		 a.city,
+   		 a.create_time as createTime, 
+   		 aa.name as superior, 
+   		 a.superior_id as superiorId,
+   		 a.department_id as departmentId,
+   		 dm.name as departmentName,
+   		 a.duty,a.status
+    from admin a 
+    left join admin_location al on a.id = al.admin_id
+    left join admin aa on aa.id = a.superior_id
+    left join department_management dm on a.department_id = dm.id
+    left join user_role ur on a.id=ur.uid
+    where a.id <![CDATA[ <> ]]> '1'
+    <if test = "name != null"> 
+    	and a.name = #{name,jdbcType=VARCHAR}
+    </if>
+    <if test = "departmentId != null">
+    	and a.department_id = #{departmentId,jdbcType=VARCHAR}
+    </if>
+    <if test = "rid != null">
+    	and ur.rid = #{rid,jdbcType=VARCHAR}
+    </if>
+    <if test = "duty != null">
+    	and a.duty = #{duty,jdbcType=VARCHAR}
+    </if>
+    <if test = "position != null">
+    	and a.position = #{position,jdbcType=VARCHAR}
+    </if>
+    <if test = "status != null">
+    	and a.status = #{status,jdbcType=VARCHAR}
+    </if>
+    <if test = "mobile != null"> 
+   		and a.mobile = #{mobile,jdbcType=VARCHAR}
+    </if>
+    <if test = "superiorId != null"> 
+   		and a.superior_id = #{superiorId,jdbcType=VARCHAR}
+    </if>    
+    order by a.number 
+    <if test="page_sql!=null">
+			${page_sql}
+	</if>
+  </select>
+  <select id = "selectAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
+   	select count(1) from admin a
+   	left join user_role ur on a.id=ur.uid
+    where id <![CDATA[ <> ]]> '1'
+    <if test = "name != null"> 
+    	and a.name = #{name,jdbcType=VARCHAR}
+    </if>
+    <if test = "departmentId != null">
+    	and a.department_id = #{departmentId,jdbcType=VARCHAR}
+    </if>
+    <if test = "rid != null">
+    	and ur.rid = #{rid,jdbcType=VARCHAR}
+    </if>
+    <if test = "duty != null">
+    	and a.duty = #{duty,jdbcType=VARCHAR}
+    </if>
+    <if test = "position != null">
+    	and a.position = #{position,jdbcType=VARCHAR}
+    </if>
+    <if test = "status != null">
+    	and a.status = #{status,jdbcType=VARCHAR}
+    </if>
+    <if test = "mobile != null"> 
+   		and a.mobile = #{mobile,jdbcType=VARCHAR}
+    </if>
+    <if test = "superiorId != null"> 
+   		and a.superior_id = #{superiorId,jdbcType=VARCHAR}
+    </if>
+  </select>
 </mapper>