|
@@ -9,6 +9,8 @@ import com.jpsoft.smart.modules.common.dto.Sort;
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
import com.jpsoft.smart.modules.base.entity.CompanyInfo;
|
|
import com.jpsoft.smart.modules.base.entity.CompanyInfo;
|
|
import com.jpsoft.smart.modules.base.service.CompanyInfoService;
|
|
import com.jpsoft.smart.modules.base.service.CompanyInfoService;
|
|
|
|
+import com.jpsoft.smart.modules.sys.entity.User;
|
|
|
|
+import com.jpsoft.smart.modules.sys.service.UserService;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -29,7 +31,8 @@ public class CompanyInfoController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private CompanyInfoService companyInfoService;
|
|
private CompanyInfoService companyInfoService;
|
|
-
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private UserService userService;
|
|
@Autowired
|
|
@Autowired
|
|
private CompanyPositionService companyPositionService;
|
|
private CompanyPositionService companyPositionService;
|
|
|
|
|
|
@@ -307,10 +310,17 @@ public class CompanyInfoController {
|
|
|
|
|
|
@ApiOperation(value="所有单位列表")
|
|
@ApiOperation(value="所有单位列表")
|
|
@RequestMapping(value = "list",method = RequestMethod.POST)
|
|
@RequestMapping(value = "list",method = RequestMethod.POST)
|
|
- public MessageResult<List<CompanyInfo>> list(){
|
|
|
|
|
|
+ public MessageResult<List<CompanyInfo>> list(@RequestAttribute String subject){
|
|
MessageResult<List<CompanyInfo>> msgResult = new MessageResult<>();
|
|
MessageResult<List<CompanyInfo>> msgResult = new MessageResult<>();
|
|
|
|
+ User user = userService.get(subject);
|
|
|
|
+ List<CompanyInfo> list = new ArrayList<>();
|
|
|
|
|
|
- List<CompanyInfo> list = companyInfoService.list();
|
|
|
|
|
|
+ if (userService.hasRole(subject,"SYSADMIN")) {
|
|
|
|
+ list = companyInfoService.list();
|
|
|
|
+ }
|
|
|
|
+ if(userService.hasRole(subject,"ADMIN")){
|
|
|
|
+ list.add(companyInfoService.get(user.getCompanyId()));
|
|
|
|
+ }
|
|
|
|
|
|
msgResult.setResult(true);
|
|
msgResult.setResult(true);
|
|
msgResult.setData(list);
|
|
msgResult.setData(list);
|