首页 > 其他分享 >踩坑 - mybatispilus中saveorupdate

踩坑 - mybatispilus中saveorupdate

时间:2022-09-21 15:02:20浏览次数:55  
标签:saveorupdate mybatispilus deviceInfo id saveOrUpdateDevice 主键

    @ApiOperation(value = "新增或者修改设备")
    @PostMapping("saveOrUpdateDevice")
    public void saveOrUpdateDevice (@RequestBody DeviceInfo deviceInfo){
        deviceInfoService.saveInOrUpdate(deviceInfo);
    }

使用时,出现只更新的情况

1、检查实体类主键 主键是否使用注解 @TableId
2、传递的参数中主键id 为空时。判断为新增,携带id则指定更新

标签:saveorupdate,mybatispilus,deviceInfo,id,saveOrUpdateDevice,主键
From: https://www.cnblogs.com/lnkD/p/16715575.html

相关文章