保存菜单角色修改参数类型
This commit is contained in:
parent
10d0db0248
commit
e9e609c768
@ -53,7 +53,7 @@ public interface TyrSaasRoleApi {
|
||||
|
||||
/** OMS编辑菜单时给角色赋权限 **/
|
||||
@PostMapping("/api/saasRoleGroup/relation/saveOrUpdate")
|
||||
ApiResult<Long> saveOrUpdateFeatureRoleRelation(@RequestParam List<FeatureRoleRelationReq> saasFeatureRoleRelationReq, @RequestParam Long operatorId);
|
||||
ApiResult<Long> saveOrUpdateFeatureRoleRelation(@RequestBody @Validated FeatureRoleRelationReq saasFeatureRoleRelationReq);
|
||||
|
||||
/** 角色和组件页面的关联关系 **/
|
||||
@PostMapping("/api/saasRoleGroup/relation/query")
|
||||
|
||||
@ -5,6 +5,8 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ -13,12 +15,24 @@ import java.util.List;
|
||||
@NoArgsConstructor
|
||||
public class FeatureRoleRelationReq {
|
||||
|
||||
/** 功能Id **/
|
||||
private Long featureId;
|
||||
@NotNull(message = "操作人不能为空")
|
||||
private Long operatorId;
|
||||
|
||||
/** 应用的角色Id列表 **/
|
||||
private List<Long> roleIds;
|
||||
@NotEmpty(message = "配置信息不能为空")
|
||||
private List<RelationRoleSettings> roleSettings;
|
||||
|
||||
/** 授权类型 0-全部角色 1-指定角色 **/
|
||||
private Integer authType;
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class RelationRoleSettings {
|
||||
/** 功能Id **/
|
||||
private Long featureId;
|
||||
|
||||
/** 应用的角色Id列表 **/
|
||||
private List<Long> roleIds;
|
||||
|
||||
/** 授权类型 0-全部角色 1-指定角色 **/
|
||||
private Integer authType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,8 +106,8 @@ public class SaasRoleController implements TyrSaasRoleApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResult<Long> saveOrUpdateFeatureRoleRelation(List<FeatureRoleRelationReq> saasFeatureRoleRelationReq, Long operatorId) {
|
||||
roleService.saveOrUpdateFeatureRoleRelation(saasFeatureRoleRelationReq, operatorId);
|
||||
public ApiResult<Long> saveOrUpdateFeatureRoleRelation(FeatureRoleRelationReq saasFeatureRoleRelationReq) {
|
||||
roleService.saveOrUpdateFeatureRoleRelation(saasFeatureRoleRelationReq.getRoleSettings(), saasFeatureRoleRelationReq.getOperatorId());
|
||||
return ApiResult.ok();
|
||||
}
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ public interface RoleService extends IService<SaasRole> {
|
||||
|
||||
Page<SaasRoleRes> page(PageSaasRoleParam param);
|
||||
|
||||
void saveOrUpdateFeatureRoleRelation(List<FeatureRoleRelationReq> req, Long operatorId);
|
||||
void saveOrUpdateFeatureRoleRelation(List<FeatureRoleRelationReq.RelationRoleSettings> req, Long operatorId);
|
||||
|
||||
FeatureRoleRelationResp queryFeatureRoleRelation(Long featureId);
|
||||
|
||||
|
||||
@ -1281,8 +1281,8 @@ public class RoleServiceImpl extends ServiceImpl<SaasRoleMapper, SaasRole>
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveOrUpdateFeatureRoleRelation(List<FeatureRoleRelationReq> req, Long operatorId) {
|
||||
for (FeatureRoleRelationReq item : req) {
|
||||
public void saveOrUpdateFeatureRoleRelation(List<FeatureRoleRelationReq.RelationRoleSettings> req, Long operatorId) {
|
||||
for (FeatureRoleRelationReq.RelationRoleSettings item : req) {
|
||||
saasFeatureResourceService.updateFeatureAuthType(item.getFeatureId(), item.getAuthType());
|
||||
if (CollectionUtil.isEmpty(item.getRoleIds()) || item.getAuthType() == 0) {
|
||||
saasPgroupPermissionRelationDao.removeByPermissionPointIds(Collections.singletonList(item.getFeatureId()));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user