Commit ad30a304 authored by 郭凡凡's avatar 郭凡凡

服务树 应用树 模糊查询 bug 修复

省测模糊查询和编辑接口的编写
parent 17703c83
......@@ -210,8 +210,8 @@ public class ApiBasicManagementController {
@ApiOperation("服务分类层级")
@GetMapping("/apiBaseTreeOther")
public ResponseVO<List<OcpGroupBaseDto>> apiBaseTreeOther(String apiGroupCompanyCode, String apiGroupCode, Integer apiGroupPromotionType,String apiCode,String apiPromotion) {
List<OcpGroupBaseDto> apiTreeGroupDtos = apiBasicManagementService.apiBaseTreeOther(apiGroupCompanyCode, apiGroupCode, apiGroupPromotionType,apiCode,apiPromotion);
public ResponseVO<List<OcpGroupBaseDto>> apiBaseTreeOther(String apiGroupCompanyCode, String apiGroupCode, Integer apiGroupPromotionType,String apiCode) {
List<OcpGroupBaseDto> apiTreeGroupDtos = apiBasicManagementService.apiBaseTreeOther(apiGroupCompanyCode, apiGroupCode, apiGroupPromotionType,apiCode);
return ResponseVO.ok(apiTreeGroupDtos);
}
......@@ -222,4 +222,16 @@ public class ApiBasicManagementController {
return ResponseVO.ok(apiBaseList);
}
@ApiOperation("个人信息编辑中的模糊查询")
@GetMapping("/selectByCondition")
public ResponseVO <PageInfo<OcpApiBase>>selectByCondition(@RequestParam(required = false) String apiCode,
@RequestParam(required = false) String apiName,
@RequestParam(required = false) String apiCenterCode,
@RequestParam(required = false) Integer pageNum,
@RequestParam(required = false) Integer pageSize){
return apiBasicManagementService.selectByCondition(apiCode,apiName,apiCenterCode,pageNum,pageSize);
}
}
......@@ -42,8 +42,8 @@ public class ApiProvinceTreeController {
@ApiOperation("服务分类层级")
@GetMapping("/apiBaseTreeOther")
public ResponseVO<List<OcpGroupBaseDto>> apiBaseTreeOther(String apiGroupCompanyCode, String apiGroupCode, Integer apiGroupPromotionType,String apiCode,String apiPromotion) {
List<OcpGroupBaseDto> apiTreeGroupDtos = apiBasicManagementService.apiBaseTreeOther(apiGroupCompanyCode, apiGroupCode, apiGroupPromotionType,apiCode,apiPromotion);
public ResponseVO<List<OcpGroupBaseDto>> apiBaseTreeOther(String apiGroupCompanyCode, String apiGroupCode, Integer apiGroupPromotionType,String apiCode) {
List<OcpGroupBaseDto> apiTreeGroupDtos = apiBasicManagementService.apiBaseTreeOther(apiGroupCompanyCode, apiGroupCode, apiGroupPromotionType,apiCode);
return ResponseVO.ok(apiTreeGroupDtos);
}
......
......@@ -121,10 +121,11 @@ public class TenantBasicManagementController {
return tenantBasicManagementService.getBaseByGroupCode(tenantDto);
}
@ApiOperation("注册查询信息")
@GetMapping("/select/register")
public ResponseVO<OcpTenantGroup> selectRegister(@RequestParam(required = false) String tenantGroupCode, @RequestParam(required = false) String tenantGroupCompanyCode) {
OcpTenantGroup ocpTenantGroup = tenantBasicManagementService.selectRegister(tenantGroupCode, tenantGroupCompanyCode);
return ResponseVO.ok(ocpTenantGroup);
@ApiOperation("个人信息中-编辑")
@PostMapping("/update")
public ResponseVO update(@RequestBody OcpBaseTiocnDto ocpBaseTiocnDto){
return tenantBasicManagementService.updateByCondition(ocpBaseTiocnDto);
}
}
......@@ -17,4 +17,6 @@ public interface ApiBasicManagementMapper extends BaseMapper<OcpApiBase> {
List<OcpApiBaseVo> selectApiExport(List<String> list);
List<OcpApiBaseVo> queryOcpApiBaseDto(@Param("keyword") String keyword,@Param("apiUnit") String apiUnit, @Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime, @Param("apiCode") String apiCode, @Param("pageSize") int pageSize, @Param("pageNum") int pageNum);
List<OcpApiBase> selectByCondition(@Param("apiCode") String apiCode, @Param("apiName") String apiName, @Param("apiCenterCode") String apiCenterCode);
}
......@@ -22,9 +22,9 @@ public interface OcpApiGroupMapper extends BaseMapper<OcpApiGroup> {
List<OcpApiBaseVo> selectPageLists(ApiBaseDto apiBaseReq);
List<OcpGroupBaseDto> apiTree(String apiGroupCompanyCode, String apiGroupPcode, Integer apiGroupPromotionType,String apiPromotion);
List<OcpGroupBaseDto> apiTree(String apiGroupCompanyCode, String apiGroupPcode, Integer apiGroupPromotionType);
List<OcpGroupBaseDto> selectBase(String apiGroupCompanyCode, String apiGroupPcode,String apiPromotion);
List<OcpGroupBaseDto> selectBase(String apiGroupCompanyCode, String apiGroupPcode,Integer apiGroupPromotionType);
// List<WholeLinkTreeVo> queryApiTreeData1();
}
......@@ -19,7 +19,7 @@ public interface OcpTenantGroupMapper extends BaseMapper<OcpTenantGroup> {
List<OcpTenantBaseDto> selectPageLists(TenantDto tenantDto);
OcpTenantGroup selectRegister(@Param("tenantGroupCode") String tenantGroupCode, @Param("tenantGroupCompanyCode") String tenantGroupCompanyCode);
List<GroupDto> selectBase(@Param("tenantGroupCode") String tenantGroupCode, String tenantGroupCompanyCode);
}
package com.pms.ocp.model.dto;
import com.pms.ocp.model.entity.OcpTenantBase;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "应用信息图标储存表dto")
public class OcpBaseTiocnDto extends OcpTenantBase implements Serializable {
/**
* 图标种类tenant:应用图标api:服务图标
*/
@ApiModelProperty(value = "图标种类——tenant:应用图标,api:服务图标")
private String iocnType;
// /**
// * 编码值
// */
// @ApiModelProperty(value = "编码值")
// private String codeNo;
/**
* 应用调用的服务数量图标数据
*/
@ApiModelProperty(value = "应用调用的服务数量图标数据")
private Object iocn;
@ApiModelProperty(value = "服务编码字符串")
private String apiCodes;
public String getIocnType() {
return iocnType;
}
public void setIocnType(String iocnType) {
this.iocnType = iocnType;
}
public Object getIocn() {
return iocn;
}
public void setIocn(Object iocn) {
this.iocn = iocn;
}
public String getApiCodes() {
return apiCodes;
}
public void setApiCodes(String apiCodes) {
this.apiCodes = apiCodes;
}
}
......@@ -40,7 +40,7 @@ public class OcpApiExtent {
@ApiModelProperty("部署信息")
private String deployment;
//'0: ''待审核'',1: ''已审核'',2: ''未通过'', 3: ''未提交'',4:''建设中'',5:''下架'',6:''发布'''7.未发布
@ApiModelProperty("服务状态0未发布1已发布")
private String apiState;
......
......@@ -72,7 +72,7 @@ public interface ApiBasicManagementService extends IService<OcpApiBase> {
* @param apiGroupPcode
* @return
*/
List<OcpGroupBaseDto> apiBaseTreeOther(String apiGroupCompanyCode, String apiGroupPcode, Integer apiGroupPromotionType, String apiCode,String apiPromotion);
List<OcpGroupBaseDto> apiBaseTreeOther(String apiGroupCompanyCode, String apiGroupPcode, Integer apiGroupPromotionType, String apiCode);
/**
* 根据分组code获取列表
......@@ -89,6 +89,16 @@ public interface ApiBasicManagementService extends IService<OcpApiBase> {
*/
List<OcpApiBase> apiBaseTreeApiList(String apiGroupCompanyCode, String apiGroupPcode);
/**
* 编辑中的模糊查询
* @param apiCode
* @param apiName
* @param apiCenterCode
* @return
*/
ResponseVO<PageInfo<OcpApiBase>> selectByCondition(String apiCode, String apiName, String apiCenterCode,Integer pageNum,Integer pageSize);
// /**
// * 服务列表2
// * @param wholeLinkParamDto
......
package com.pms.ocp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pms.ocp.model.entity.OcpTenantIocn;
public interface OcpTenantIocnService extends IService<OcpTenantIocn> {
}
......@@ -80,21 +80,22 @@ public interface TenantBasicManagementService extends IService<OcpTenantBase> {
*/
List<OcpTenantBase> tenantBaseTree(String tenantGroupCode, String tenantGroupCompanyCode);
/**
* 应用注册查询
* 查询基础表
* @param tenantGroupCode
* @param tenantGroupCompanyCode
* @return
*/
OcpTenantGroup selectRegister(String tenantGroupCode, String tenantGroupCompanyCode);
List<GroupDto> selectBase(String tenantGroupCode, String tenantGroupCompanyCode);
/**
* 查询基础表
* @param tenantGroupCode
* @param tenantGroupCompanyCode
* 个人信息中编辑
* @param ocpBaseTiocnDto
* @return
*/
List<GroupDto> selectBase(String tenantGroupCode, String tenantGroupCompanyCode);
ResponseVO updateByCondition(OcpBaseTiocnDto ocpBaseTiocnDto);
/**
* 应用树
......
......@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pms.ocp.mapper.ApiBasicManagementMapper;
import com.pms.ocp.mapper.OcpApiExtentMapper;
import com.pms.ocp.mapper.OcpApiGroupMapper;
......@@ -176,15 +175,15 @@ public class ApiBasicManagementServiceImpl extends ServiceImpl<ApiBasicManagemen
}
@Override
public List<OcpGroupBaseDto> apiBaseTreeOther(String apiGroupCompanyCode, String apiGroupPcode, Integer apiGroupPromotionType, String apiCode, String apiPromotion) {
List<OcpGroupBaseDto> ocpApiGroups = ocpApiGroupMapper.apiTree(apiGroupCompanyCode, apiGroupPcode, apiGroupPromotionType, apiPromotion);
public List<OcpGroupBaseDto> apiBaseTreeOther(String apiGroupCompanyCode, String apiGroupPcode, Integer apiGroupPromotionType, String apiCode) {
List<OcpGroupBaseDto> ocpApiGroups = ocpApiGroupMapper.apiTree(apiGroupCompanyCode, apiGroupPcode, apiGroupPromotionType);
if (ocpApiGroups.size() != 0) {
return ocpApiGroups;
} else {
if (StringUtils.isNotEmpty(apiCode)) {
return Collections.EMPTY_LIST;
} else {
List<OcpGroupBaseDto> ocpGroupBaseDto = ocpApiGroupMapper.selectBase(apiGroupCompanyCode, apiGroupPcode, apiPromotion);
List<OcpGroupBaseDto> ocpGroupBaseDto = ocpApiGroupMapper.selectBase(apiGroupCompanyCode, apiGroupPcode, apiGroupPromotionType);
if (ocpGroupBaseDto.size() != 0) {
return ocpGroupBaseDto;
}
......@@ -273,4 +272,23 @@ public class ApiBasicManagementServiceImpl extends ServiceImpl<ApiBasicManagemen
return ocpApiGroups.stream().map(OcpApiGroup::getApiGroupCode).collect(Collectors.toList());
}
/**
* 编辑中的模糊查询
*
* @param apiCode
* @param apiName
* @param apiCenterCode
* @return
*/
@Override
public ResponseVO<PageInfo<OcpApiBase>> selectByCondition(String apiCode, String apiName, String apiCenterCode, Integer pageNum, Integer pageSize) {
if (pageNum == null || pageSize == null) {
return ResponseVO.error("分页参数不能为空");
}
PageHelper.startPage(pageNum, pageSize);
List<OcpApiBase> list = apiBasicManagementMapper.selectByCondition(apiCode, apiName, apiCenterCode);
PageInfo<OcpApiBase> pageInfo = new PageInfo<>(list);
return ResponseVO.ok(pageInfo);
}
}
package com.pms.ocp.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pms.ocp.mapper.OcpTenantIocnMapper;
import com.pms.ocp.model.entity.OcpTenantIocn;
import com.pms.ocp.service.OcpTenantIocnService;
import org.springframework.stereotype.Service;
@Service
public class OcpTenantIocnServiceImpl extends ServiceImpl<OcpTenantIocnMapper,OcpTenantIocn> implements OcpTenantIocnService {
}
......@@ -5,18 +5,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pms.ocp.mapper.OcpTenantAuditMapper;
import com.pms.ocp.mapper.OcpTenantExtentMapper;
import com.pms.ocp.mapper.OcpTenantGroupMapper;
import com.pms.ocp.mapper.TenantBasicManagementMapper;
import com.pms.ocp.mapper.*;
import com.pms.ocp.model.dto.GroupDto;
import com.pms.ocp.model.dto.OcpBaseTiocnDto;
import com.pms.ocp.model.dto.OcpTenantBaseDto;
import com.pms.ocp.model.dto.TenantDto;
import com.pms.ocp.model.entity.*;
import com.pms.ocp.model.vo.ResponseVO;
import com.pms.ocp.model.vo.TenantGroupVo;
import com.pms.ocp.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -32,7 +31,7 @@ import java.util.List;
import java.util.stream.Collectors;
@Service
@Slf4j
public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicManagementMapper, OcpTenantBase> implements TenantBasicManagementService {
@Autowired
private TenantBasicManagementMapper tenantBasicManagementMapper;
......@@ -48,7 +47,8 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
private OcpTenantGroupMapper ocpTenantGroupMapper;
@Autowired
private OcpTenantAuditMapper ocpTenantAuditMapper;
@Autowired
private OcpTenantIocnService ocpTenantIocnService;
List<String> tenantGroup = new ArrayList<>();
/**
......@@ -266,7 +266,7 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
if (groupDtos.size() != 0) {
return groupDtos;
}
return Collections.EMPTY_LIST;
return Collections.EMPTY_LIST;
}
}
......@@ -314,28 +314,83 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
}
/**
* 应用注册查询
* 应用树底层
*
* @param tenantGroupCode
* @param tenantGroupCompanyCode
* @return
*/
@Override
public OcpTenantGroup selectRegister(String tenantGroupCode, String tenantGroupCompanyCode) {
OcpTenantGroup ocpTenantGroup = ocpTenantGroupMapper.selectRegister(tenantGroupCode, tenantGroupCompanyCode);
return ocpTenantGroup;
public List<GroupDto> selectBase(String tenantGroupCode, String tenantGroupCompanyCode) {
List<GroupDto> groupDto = ocpTenantGroupMapper.selectBase(tenantGroupCode, tenantGroupCompanyCode);
return groupDto;
}
/**
* 应用树底层
* 个人信息-编辑
*
* @param tenantGroupCode
* @param tenantGroupCompanyCode
* @param ocpBaseTiocnDto
* @return
*/
public List<GroupDto> selectBase(String tenantGroupCode, String tenantGroupCompanyCode) {
List<GroupDto> groupDto = ocpTenantGroupMapper.selectBase(tenantGroupCode, tenantGroupCompanyCode);
return groupDto;
@Override
public ResponseVO updateByCondition(OcpBaseTiocnDto ocpBaseTiocnDto) {
String tenantCode = ocpBaseTiocnDto.getTenantCode();
OcpTenantBase ocpTenantBase = new OcpTenantBase();
BeanUtils.copyProperties(ocpBaseTiocnDto, ocpTenantBase);
LambdaQueryWrapper<OcpTenantBase> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
lambdaQueryWrapper2.eq(OcpTenantBase::getTenantCode, tenantCode);
boolean flag = this.update(ocpTenantBase, lambdaQueryWrapper2);
if (flag) {
log.info("应用基础表修改成功");
System.out.println("应用基础表修改成功");
}
LambdaQueryWrapper<OcpTenantIocn> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(OcpTenantIocn::getCodeNo, tenantCode);
boolean remove = ocpTenantIocnService.remove(lambdaQueryWrapper);
if (remove) {
log.info("图标表删除成功");
System.out.println("图标表删除成功");
}
//添加新的数据到图标表
OcpTenantIocn ocpTenantIocn = new OcpTenantIocn();
Object iocn = ocpBaseTiocnDto.getIocn();
String ownerCompanyCode = ocpBaseTiocnDto.getOwnerCompanyCode();
ocpTenantIocn.setCodeNo(tenantCode);
ocpTenantIocn.setIocnType("tenant");
ocpTenantIocn.setIocn(iocn);
ocpTenantIocn.setCompanyCode(ownerCompanyCode);
boolean save = ocpTenantIocnService.save(ocpTenantIocn);
if (save) {
log.info("添加图标表成功");
System.out.println("添加图标表成功");
}
//先删除应用服务关联
LambdaQueryWrapper<OcpApiTenantRel> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
lambdaQueryWrapper1.eq(OcpApiTenantRel::getTenantCode, tenantCode);
boolean remove1 = ocpApiTenantRelService.remove(lambdaQueryWrapper1);
if (remove1) {
log.info("要是有关联先删除,删除成功");
}
String apiCodes = ocpBaseTiocnDto.getApiCodes();
if (StringUtils.isEmpty(apiCodes)) {
return ResponseVO.error("请选择你要关联的服务");
}
String[] split = apiCodes.split(",");
List<String> apiCode = Arrays.asList(split);
for (String s : apiCode) {
OcpApiTenantRel ocpApiTenantRel = new OcpApiTenantRel();
ocpApiTenantRel.setTenantCode(tenantCode);
ocpApiTenantRel.setApiCode(s);
ocpApiTenantRel.setApiDepCompanyCode(ownerCompanyCode);
ocpApiTenantRel.setTenantDepCompanyCode(ownerCompanyCode);
ocpApiTenantRel.setApiTenantRelCtime(Timestamp.valueOf(LocalDateTime.now()));
ocpApiTenantRel.setApiTenantRelMtime(Timestamp.valueOf(LocalDateTime.now()));
boolean save1 = ocpApiTenantRelService.save(ocpApiTenantRel);
if (save1) {
log.info("添加关联表成功");
}
}
return ResponseVO.ok();
}
/**
......
......@@ -68,4 +68,22 @@
</where>
limit #{pageNum} offset #{pageSize}
</select>
<select id="selectByCondition" resultType="com.pms.ocp.model.entity.OcpApiBase">
select api_name,api_code,api_version,owner_company_code,api_description ,api_center_code from ocp_api_base
<where>
<if test="apiCode!=null and apiCode!=''">
and api_code=#{apiCode}
</if>
<if test="apiName!=null and apiName!=''">
and api_name=#{apiName}
</if>
<if test="apiCenterCode!=null and apiCenterCode!=''">
and api_center_code=#{apiCenterCode}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -65,9 +65,7 @@
<if test="apiGroupPromotionType!=null and apiGroupPromotionType!=''">
and api_group_promotion_type =#{apiGroupPromotionType}
</if>
<if test="test=apiPromotion!=null and apiPromotion!=''">
and api_group_promotion_type=#{apiPromotion}
</if>
</select>
......@@ -117,8 +115,8 @@
<if test="apiGroupCompanyCode!=null and apiGroupCompanyCode!=''">
and owner_company_code =#{apiGroupCompanyCode}
</if>
<if test="test=apiPromotion!=null and apiPromotion!=''">
and api_promotion=#{apiPromotion}
<if test="test=apiGroupPromotionType!=null and apiGroupPromotionType!=''">
and api_promotion=#{apiGroupPromotionType}
</if>
</where>
......
......@@ -21,7 +21,7 @@
tenant_group_code,tenant_group_name,tenant_group_pcode ,tenant_group_level from ocp_tenant_group
where is_delete = 0
<if test="tenantGroupCode == null">
and tenant_group_pcode = ''
and tenant_group_pcode is null
</if>
<if test="tenantGroupCompanyCode !=null and tenantGroupCompanyCode !=''">
and tenant_group_company_code=#{tenantGroupCompanyCode}
......@@ -68,17 +68,7 @@
<!-- and otb.tenant_code like CONCAT('%', #{keyword}::text,'%')-->
<!-- </if>-->
</select>
<select id="selectRegister" resultType="com.pms.ocp.model.entity.OcpTenantGroup">
select * from ocp_tenant_group where is_delete = 0
<if test="tenantGroupCode !=null and tenantGroupCode!=''">
and tenant_group_code=#{tenantGroupCode}
</if>
<if test="tenantGroupCompanyCode !=null and tenantGroupCompanyCode !=''">
and tenant_group_company_code=#{tenantGroupCompanyCode}
</if>
</select>
<select id="selectBase" resultType="com.pms.ocp.model.dto.GroupDto">
select obj_id,tenant_name,tenant_code ,tenant_group_code from ocp_tenant_base
<where>
......
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