|
|
@ -1,5 +1,7 @@ |
|
|
|
package com.ccsens.carbasics.api; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.ccsens.cloudutil.annotation.MustLogin; |
|
|
|
import com.ccsens.common.bean.dto.CRoleDto; |
|
|
|
import com.ccsens.common.bean.vo.CRoleVo; |
|
|
@ -17,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestMethod; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author 逗 |
|
|
@ -35,6 +39,32 @@ public class RoleController { |
|
|
|
public JsonResponse<CRoleVo.QueryRole> queryByProjectId(@ApiParam @Validated @RequestBody QueryDto<CRoleDto.QueryRoleById> params) { |
|
|
|
params.getParam().setNum(0); |
|
|
|
CRoleVo.QueryRole queryRole = roleService.queryShowRole(params.getParam(), params.getUserId()); |
|
|
|
List<CRoleVo.RoleInfo> r1 = new ArrayList<>(); |
|
|
|
List<CRoleVo.RoleInfo> r2 = new ArrayList<>(); |
|
|
|
//处理角色,只查看自己所属的角色
|
|
|
|
if(ObjectUtil.isNotNull(queryRole)){ |
|
|
|
if(CollectionUtil.isNotEmpty(queryRole.getVisibleList())){ |
|
|
|
queryRole.getVisibleList().forEach(roleInfo -> { |
|
|
|
if(roleInfo.getMine() == 1){ |
|
|
|
r1.add(roleInfo); |
|
|
|
}else { |
|
|
|
r2.add(roleInfo); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
if(CollectionUtil.isNotEmpty(queryRole.getInvisibleList())){ |
|
|
|
queryRole.getInvisibleList().forEach(roleInfo -> { |
|
|
|
if(roleInfo.getMine() == 1){ |
|
|
|
r1.add(roleInfo); |
|
|
|
}else { |
|
|
|
r2.add(roleInfo); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
queryRole.setVisibleList(r1); |
|
|
|
queryRole.setInvisibleList(r2); |
|
|
|
|
|
|
|
return JsonResponse.newInstance().ok(queryRole); |
|
|
|
} |
|
|
|
|
|
|
|