修改代码,使用insertTenantBySid 在sid 为空时写入新生成的id
时间: 2024-03-08 21:45:27 浏览: 12
public ResultDto editScmTenant(ScmTenantEditRequest editRequest) {
if (LongUtil.isEmpty(editRequest.getSid()) && exitsTaxcode(editRequest.getTaxCode())) {
return ResultDto.fail(ResponseStatusConstants.Code.DATA_EXISTS, "数据已存在");
}
if (LongUtil.isEmpty(editRequest.getSid())) {
editRequest.setSid(SnowFlake.getInstance().newId());
int result = tenantMapper.insertTenantBySid(editRequest);
if (result == 0) {
return ResultDto.fail(ResponseStatusConstants.Code.ERROR, "插入数据失败");
}
} else if (exitsSid(editRequest.getSid())) {
return ResultDto.fail(ResponseStatusConstants.Code.DATA_EXISTS, "数据已存在");
}
return ResultDto.ok();
}
其中,insertTenantBySid 方法的参数为 ScmTenantEditRequest 对象,而不是之前的多个参数。
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)