mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
优化收到接口注册
This commit is contained in:
@@ -39,8 +39,9 @@ public class ApiRegisterServiceImpl implements ApiRegisterService {
|
||||
apiInfoDTO.setStatus(StatusEnum.ENABLE.getValue());
|
||||
|
||||
ApiInfo apiInfo = apiInfoMapper.getByNameVersion(apiInfoDTO.getApiName(), apiInfoDTO.getApiVersion());
|
||||
|
||||
boolean isSave = false;
|
||||
if (apiInfo == null) {
|
||||
isSave = true;
|
||||
apiInfo = new ApiInfo();
|
||||
} else {
|
||||
check(apiInfo, registerDTO);
|
||||
@@ -48,7 +49,11 @@ public class ApiRegisterServiceImpl implements ApiRegisterService {
|
||||
CopyUtil.copyPropertiesIgnoreNull(apiInfoDTO, apiInfo);
|
||||
apiInfo.setRegSource(REG_SOURCE_SYS);
|
||||
// 保存到数据库
|
||||
apiInfoMapper.saveOrUpdateIgnoreNull(apiInfo);
|
||||
if (isSave) {
|
||||
apiInfoMapper.saveIgnoreNull(apiInfo);
|
||||
} else {
|
||||
apiInfoMapper.updateIgnoreNull(apiInfo);
|
||||
}
|
||||
apiInfoDTO.setId(apiInfo.getId());
|
||||
// 保存到缓存
|
||||
apiManager.save(apiInfoDTO);
|
||||
|
Reference in New Issue
Block a user