前端传过来的参数可以只要id和name,也可以全部都要!问题是现在代码方面如果传了两个值id和name就会报错,传5个值是正常的,我要怎么做判断,让传两个值跑另一段代码呢?
@BussinessLog()
@ApiOperation(value = "编辑菜单操作")
@PutMapping(value = "/updateLdTemplate")
public Object updateLdTemplate(@ApiJsonObject(name = "编辑菜单逻辑设备", value = {
@ApiJsonProperty(name = "id", example = "40", value = "逻辑设备id", dataType = "long", required = true),
@ApiJsonProperty(name = "name", example = "配电柜", value = "逻辑设备模板名", dataType = "string", required = true),
@ApiJsonProperty(name = "ipAddress", example = "192.168.31.4", value = "放电装置IP地址设置", dataType = "string", required = true),
@ApiJsonProperty(name = "ipMask", example = "192.168.31.1", value = "放电装置IP掩码设置", dataType = "string", required = true),
@ApiJsonProperty(name = "ipGateway", example = "255.255.255.0", value = "放电装置IP网关设置", dataType = "string", required = true)
}) @ApiParam(value = "逻辑设备") @RequestBody Map<String, Object> map) {
Long id = Long.parseLong(map.get("id").toString());
String ipAddress = String.valueOf(map.get("ipAddress").toString());
String ipGateway = String.valueOf(map.get("ipGateway").toString());
String ipMask = String.valueOf(map.get("ipMask").toString());
String name = map.get("name").toString();
return systemMenuService.updateLdTemplate(id, ipAddress, ipGateway, ipMask, name);
}