|
|
@@ -15,6 +15,7 @@ import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -39,8 +40,12 @@ public class UserCorpController {
|
|
|
*/
|
|
|
@GetMapping("/getAuthUserCorps")
|
|
|
public Object getAuthUserCorps(@AuthUser User authUser) {
|
|
|
-
|
|
|
- List<Corp> res = userCorpService.getCorpsByUserId(authUser.getId());
|
|
|
+ List<Corp> res = new ArrayList<Corp>();
|
|
|
+ if(authUser.getIsSuperAdmin() == 1){
|
|
|
+ res = userCorpService.getAllCorps();
|
|
|
+ }else{
|
|
|
+ res = userCorpService.getCorpsByUserId(authUser.getId());
|
|
|
+ }
|
|
|
return AjaxResult.success(Constants.SUCCESS, res);
|
|
|
}
|
|
|
|
|
|
@@ -80,6 +85,7 @@ public class UserCorpController {
|
|
|
|
|
|
/**
|
|
|
* 解绑企业和账户
|
|
|
+ *
|
|
|
* @param unSetUserCorpHandle
|
|
|
* @param authUser
|
|
|
* @param bindingResult
|
|
|
@@ -91,7 +97,7 @@ public class UserCorpController {
|
|
|
return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
|
}
|
|
|
if (authUser.getIsSuperAdmin() == 1) {
|
|
|
- Boolean res = userCorpService.unSetUserCorp(unSetUserCorpHandle.getUserId(),unSetUserCorpHandle.getCorpId());
|
|
|
+ Boolean res = userCorpService.unSetUserCorp(unSetUserCorpHandle.getUserId(), unSetUserCorpHandle.getCorpId());
|
|
|
} else {
|
|
|
return AjaxResult.error("Permission denied");
|
|
|
}
|
|
|
@@ -100,17 +106,17 @@ public class UserCorpController {
|
|
|
|
|
|
/**
|
|
|
* 获取指定企业的小前台管理员列表
|
|
|
+ *
|
|
|
* @param corpId
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/getUserByCorpId")
|
|
|
- public Object getUserCorpsByUserId(@RequestParam(name="corpId") Integer corpId){
|
|
|
- if (corpId == null || corpId == 0){
|
|
|
+ public Object getUserCorpsByUserId(@RequestParam(name = "corpId") Integer corpId) {
|
|
|
+ if (corpId == null || corpId == 0) {
|
|
|
return AjaxResult.error("corpId null");
|
|
|
}
|
|
|
List<User> res = userCorpService.selectUserByCorpId(corpId);
|
|
|
return AjaxResult.success(res);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|