Commit 016088d5 authored by 郭凡凡's avatar 郭凡凡

修复bug 添加应用服务关系

parent bb673013
......@@ -221,4 +221,5 @@ public class ApiBasicManagementController {
}
}
......@@ -131,8 +131,13 @@ public class TenantBasicManagementController {
return tenantBasicManagementService.updateByCondition(ocpBaseTiocnDto);
}
@ApiOperation("个人信息中-查询和应用关联的服务")
@PostMapping("/selectOcpByApi")
@GetMapping("/selectOcpByApi")
public ResponseVO<List<OcpApiBase>> selectOcpByApi(@RequestParam(required = false) String tenantCode){
return tenantBasicManagementService.selectOcpByApi(tenantCode);
}
@ApiOperation("添加应用服务关系")
@PostMapping("/saveTenantAndApi")
public ResponseVO saveTenantAndApi(@RequestBody OcpBaseTiocnDto ocpBaseTiocnDto){
return tenantBasicManagementService.saveTenantAndApi(ocpBaseTiocnDto);
}
}
......@@ -102,6 +102,13 @@ public interface TenantBasicManagementService extends IService<OcpTenantBase> {
*/
ResponseVO <List<OcpApiBase>>selectOcpByApi(String tenantCode);
/**
* 添加应用服务关系
* @return
*/
ResponseVO saveTenantAndApi( OcpBaseTiocnDto ocpBaseTiocnDto);
/**
* 应用树
* @param tenantGroupCode
......
......@@ -424,6 +424,42 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
return ResponseVO.ok();
}
/**
* 添加应用服务关系
*
* @return
*/
@Override
public ResponseVO saveTenantAndApi(OcpBaseTiocnDto ocpBaseTiocnDto) {
String apiCodes = ocpBaseTiocnDto.getApiCodes();
String tenantCode = ocpBaseTiocnDto.getTenantCode();
String[] split = apiCodes.split(",");
List<String> apiCode = Arrays.asList(split);
if (apiCode.size() == 0) {
return ResponseVO.error("请选择你要关联的服务");
}
//先删除之前关联的
LambdaQueryWrapper<OcpApiTenantRel> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StringUtils.isNotEmpty(tenantCode), OcpApiTenantRel::getTenantCode, tenantCode);
ocpApiTenantRelMapper.delete(queryWrapper);
for (String s : apiCode) {
OcpApiTenantRel rel = new OcpApiTenantRel();
rel.setApiCode(s);
rel.setTenantCode(tenantCode);
rel.setApiTenantRelMtime(new Timestamp(System.currentTimeMillis()));
rel.setApiTenantRelCtime(new Timestamp(System.currentTimeMillis()));
rel.setApiDepCompanyCode(ocpBaseTiocnDto.getOwnerCompanyCode());
rel.setTenantDepCompanyCode(ocpBaseTiocnDto.getOwnerCompanyCode());
int insert = ocpApiTenantRelMapper.insert(rel);
if (insert > 0) {
return ResponseVO.ok("添加成功");
} else {
return ResponseVO.error("添加失败");
}
}
return ResponseVO.error("系统异常");
}
/**
* 应用树2
*
......
......@@ -53,7 +53,7 @@
<select id="apiTree" resultType="com.pms.ocp.model.dto.OcpGroupBaseDto">
select api_group_code,api_group_name,api_group_pcode,api_group_level from ocp_api_group where is_delete = 0
<if test="apiGroupPcode == null">
<if test="apiGroupPcode == null ">
and api_group_pcode is null or api_group_pcode =''
</if>
<if test="apiGroupPcode!=null and apiGroupPcode!=''">
......
......@@ -20,7 +20,7 @@
select
tenant_group_code,tenant_group_name,tenant_group_pcode ,tenant_group_level from ocp_tenant_group
where is_delete = 0
<if test="tenantGroupCode == null">
<if test="tenantGroupCode == null ">
and tenant_group_pcode = '' or tenant_group_pcode is null
</if>
<if test="tenantGroupCompanyCode !=null and tenantGroupCompanyCode !=''">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment