Explorar o código

add:查询所有分部

yonge %!s(int64=3) %!d(string=hai) anos
pai
achega
84dbdcfcfd

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/OrganizationService.java

@@ -21,7 +21,7 @@ public interface OrganizationService extends BaseService<Integer, Organization>
      * 获取员工坐在分部列表
      * @return
      */
-    List<Organization> queryEmployeeOrgan() throws Exception;
+    List<Organization> queryEmployeeOrgan(Integer userId) throws Exception;
 
     /**
      * 获取员工坐在分部列表

+ 1 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrganizationServiceImpl.java

@@ -42,12 +42,7 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
 	}
 
 	@Override
-	public List<Organization> queryEmployeeOrgan(){
-		SysUser sysUser = sysUserFeignService.queryUserInfo();
-		if(sysUser == null){
-			throw new BizException("获取用户信息失败");
-		}
-		Integer userId = sysUser.getId();
+	public List<Organization> queryEmployeeOrgan(Integer userId){
 		return organizationDao.queryEmployeeOrgan(userId);
 	}
 

+ 27 - 8
mec-web/src/main/java/com/ym/mec/web/controller/education/EduOrganizationController.java

@@ -1,17 +1,23 @@
 package com.ym.mec.web.controller.education;
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.entity.CooperationOrgan;
 import com.ym.mec.biz.service.CooperationOrganService;
 import com.ym.mec.biz.service.OrganizationService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
+import com.ym.mec.common.exception.BizException;
 
 @RequestMapping("eduOrganization")
 @Api(tags = "分部服务")
@@ -22,11 +28,24 @@ public class EduOrganizationController extends BaseController {
     private OrganizationService organizationService;
     @Autowired
     private CooperationOrganService cooperationOrganService;
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
+
+    @ApiOperation(value = "获取员工所在分部列表")
+    @GetMapping("/queryAllOrgan")
+    public Object queryAllOrgan() throws Exception {
+        return succeed(organizationService.queryEmployeeOrgan(null));
+    }
 
     @ApiOperation(value = "获取员工所在分部列表")
     @GetMapping("/queryEmployeeOrgan")
     public Object queryEmployeeOrgan() throws Exception {
-        return succeed(organizationService.queryEmployeeOrgan());
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if(sysUser == null){
+			throw new BizException("获取用户信息失败");
+		}
+		Integer userId = sysUser.getId();
+        return succeed(organizationService.queryEmployeeOrgan(userId));
     }
 
     @ApiOperation(value = "根据分部id获取合作单位(学校)列表")