前段传递参数结构
Controller
@RestController
@Api(tags = "数据权限")
@Slf4j
@RequestMapping(value = "data-authority")
@Validated
public class DataAuthorityController{
@PostMapping("")
@ApiOperation(value = "模拟设置用户部门管辖权限", notes = "模拟设置用户部门管辖权限", httpMethod = "POST")
public RestResult<Object> testData(@RequestBody @Valid @NotNull(message = "数据集合不能为空") @Size(min = 1, message = "最少有一个集合对象") List<OrgDataAuthorityDto> list) {
iDataAuthorityService.saveDataAuthority(list);
return RestResult.success();
}
}
OrgDataAuthorityDto.java
@Data
public class OrgDataAuthorityDto {
@ApiModelProperty(value = "管辖组列表",required = true)
@NotNull(message = "管辖范围不能为空")
@Size(min = 1, message = "管辖范围最少有一个集合对象")
@Valid
private List<GroupListDto> groupList;
@NotNull(message = "用户id能为空")
@ApiModelProperty(value = "用户id",required = true)
private Long userId;
}
GroupListDto.java
@Data
public class GroupListDto {
@ApiModelProperty(value = "管辖范围列表",required = true)
@NotNull(message = "管辖范围列表能为空")
@Size(min = 1, message = "管辖范围列表最少有一个集合对象")
@Valid
private List<GovAreaListDto> govAreaList;
@NotNull(message = "资源编码列表能为空")
@Size(min = 1, message = "资源编码列表最少有一个集合对象")
@ApiModelProperty(value = "资源编码列表",required = true)
@Valid
private List<String> resourceCodeList;
}
GovAreaListDto.java
@Data
public class GovAreaListDto {
@ApiModelProperty(value = "是否穿透",required = true)
private boolean isContainChild;
@NotNull
@ApiModelProperty(value = "部门id",required = true)
private Long orgId;
}