Commit fcb7189f authored by liukai's avatar liukai

Merge remote-tracking branch 'origin/master'

parents 6d2d6bcd 3582a38e
......@@ -17,6 +17,7 @@ public class RandomStringUtils {
String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
Random random=new Random();
StringBuffer sb=new StringBuffer();
for(int i=0;i<length;i++){
int number=random.nextInt(62);
sb.append(str.charAt(number));
......
......@@ -5,6 +5,7 @@ import com.pms.ocp.common.utils.ExcelUtils;
import com.pms.ocp.common.utils.FileExport;
import com.pms.ocp.common.utils.FileUtil;
import com.pms.ocp.model.dto.ApiBaseDto;
import com.pms.ocp.model.dto.OcpGroupBaseDto;
import com.pms.ocp.model.entity.OcpApiBase;
import com.pms.ocp.model.entity.OcpApiGroup;
import com.pms.ocp.model.vo.OcpApiBaseVo;
......@@ -209,8 +210,8 @@ public class ApiBasicManagementController {
@ApiOperation("服务分类层级")
@GetMapping("/apiBaseTreeOther")
public ResponseVO<List<OcpApiGroup>> apiBaseTreeOther(String apiGroupCompanyCode, String apiGroupCode, Integer apiGroupPromotionType) {
List<OcpApiGroup> apiTreeGroupDtos = apiBasicManagementService.apiBaseTreeOther(apiGroupCompanyCode, apiGroupCode, apiGroupPromotionType);
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);
return ResponseVO.ok(apiTreeGroupDtos);
}
......
package com.pms.ocp.controller;
import com.github.pagehelper.PageInfo;
import com.pms.ocp.model.dto.*;
......@@ -21,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.sql.Timestamp;
import java.util.List;
/**
* @author guofanfan
*/
......@@ -86,12 +86,24 @@ public class TenantBasicManagementController {
@ApiOperation("应用树层级")
@GetMapping("/tenantBaseTreeOther")
public ResponseVO<List<GroupDto>> tenantBaseTreeOther(@RequestParam(required = false) String tenantGroupCode, @RequestParam(required = false) String tenantGroupCompanyCode
public ResponseVO<List<GroupDto>> tenantBaseTreeOther(@RequestParam(required = false) String tenantGroupCode, @RequestParam(required = false) String tenantGroupCompanyCode,
@RequestParam(required = false) String tenantCode
) {
List<GroupDto> ocpApiGroups = tenantBasicManagementService.tenantBaseTreeOther(tenantGroupCode, tenantGroupCompanyCode);
List<GroupDto> ocpApiGroups = tenantBasicManagementService.tenantBaseTreeOther(tenantGroupCode, tenantGroupCompanyCode,tenantCode);
// if (ocpApiGroups.size() != 0) {
// return ResponseVO.ok(ocpApiGroups);
// } else {
// List<GroupDto> ocpBaseGroupDto = tenantBasicManagementService.selectBase(tenantGroupCode, tenantGroupCompanyCode);
//
// }
return ResponseVO.ok(ocpApiGroups);
}
/**
* @param tenantGroupCode
* @param tenantGroupCompanyCode
* @return
*/
@ApiOperation("应用树底层")
@GetMapping("/tenantBaseTree")
public ResponseVO<List<OcpTenantBase>> tenantBaseTree(@RequestParam(required = false) String tenantGroupCode,
......
......@@ -19,5 +19,7 @@ public interface ModelSubscribeMapper extends BaseMapper<ModelSubscribe> {
List<TreeNode> selectOrganData();
List<TreeNode> selectModelAndModelGroup(@Param("searchCondition") String searchCondition);
List<TreeNode> selectModelAndModelGroup();
List<TreeNode> getModelList(@Param("searchCondition") String searchCondition);
}
......@@ -2,6 +2,7 @@ package com.pms.ocp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pms.ocp.model.dto.ApiBaseDto;
import com.pms.ocp.model.dto.OcpGroupBaseDto;
import com.pms.ocp.model.entity.OcpApiBase;
import com.pms.ocp.model.entity.OcpApiGroup;
import com.pms.ocp.model.vo.OcpApiBaseVo;
......@@ -21,5 +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> selectBase(String apiGroupCompanyCode, String apiGroupPcode,String apiPromotion);
// List<WholeLinkTreeVo> queryApiTreeData1();
}
......@@ -39,4 +39,7 @@ public interface OcpApiTreeMapper extends BaseMapper<OcpApiGroup> {
//根据code查询整条数据
OcpApiGroup selectCode(String code);
//根据code查询是否=含有下级服务
List<OcpApiGroup> selectGroupPcode();
}
......@@ -3,10 +3,11 @@ package com.pms.ocp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pms.ocp.model.dto.GroupDto;
import com.pms.ocp.model.dto.OcpTenantBaseDto;
import com.pms.ocp.model.dto.TenantDto;
import com.pms.ocp.model.entity.OcpTenantGroup;
import com.pms.ocp.model.vo.ResponseVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -19,4 +20,6 @@ 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);
}
......@@ -23,6 +23,10 @@ public class GroupDto extends OcpTenantGroup implements Serializable {
@ApiModelProperty("应用代码")
private String tenantCode;
@ApiModelProperty("flag")
private Integer flag;
/**
* 应用分类代码
*/
......
package com.pms.ocp.model.dto;
import com.pms.ocp.model.entity.OcpApiGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author guofanfan
* 服务组dto
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OcpGroupBaseDto extends OcpApiGroup implements Serializable {
@ApiModelProperty("服务代码")
private String apiCode;
@ApiModelProperty("服务接口中文名称")
private String apiName;
@ApiModelProperty("服务分类代码")
private String apiGroupCode;
}
......@@ -8,7 +8,7 @@ import java.sql.Timestamp;
/**
* 分页查询dto
*/
public class PageGroupDto extends PageParam {
public class PageGroupDto{
@ApiModelProperty("主键ID")
......@@ -57,6 +57,29 @@ public class PageGroupDto extends PageParam {
@ApiModelProperty("模糊查询字段")
private String keyword;
@ApiModelProperty("分页条数")
private int currentPage;
@ApiModelProperty("分页树")
private int pageSize;
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public String getKeyword() {
return keyword;
}
......
......@@ -4,7 +4,6 @@ package com.pms.ocp.model.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.pms.ocp.common.constants.StringUtils;
import com.pms.ocp.model.entity.OcpTenantGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
......@@ -10,6 +10,7 @@ import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
/**
* @Auther: wangjian
......@@ -83,4 +84,6 @@ public class ModelClassify {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date groupUpdateTime;
@TableField(exist = false)
private List<ModelClassify> childrenList;
}
......@@ -60,6 +60,19 @@ public class OcpApiGroup {
@ApiModelProperty("分层树层级 1中台层 2中心层 3 服务组层 4服务层 ")
private String apiGroupLevel;
@ApiModelProperty("上级分类名称")
@TableField(exist = false)
private String classIfy;
public String getClassIfy() {
return classIfy;
}
public void setClassIfy(String classIfy) {
this.classIfy = classIfy;
}
public String getApiGroupLevel() {
return apiGroupLevel;
}
......
......@@ -34,6 +34,9 @@ public class TreeNode implements Serializable {
@ApiModelProperty("公司编码")
private String companyCode;
@ApiModelProperty("子类")
private String modelGroupCode;
@ApiModelProperty("子类")
private int belongLevel;
......@@ -52,4 +55,7 @@ public class TreeNode implements Serializable {
return companyCode == null ? "":companyCode;
}
public String getModelGroupCode() {
return modelGroupCode == null ? "":modelGroupCode;
}
}
......@@ -3,10 +3,7 @@ package com.pms.ocp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.pms.ocp.model.QueryResponseResult;
import com.pms.ocp.model.dto.ApiBaseDto;
import com.pms.ocp.model.dto.ApiTreeGroupDto;
import com.pms.ocp.model.dto.OcpApiBaseDto;
import com.pms.ocp.model.dto.WholeLinkParamDto;
import com.pms.ocp.model.dto.*;
import com.pms.ocp.model.entity.OcpApiBase;
import com.pms.ocp.model.entity.OcpApiExtent;
import com.pms.ocp.model.entity.OcpApiGroup;
......@@ -75,7 +72,7 @@ public interface ApiBasicManagementService extends IService<OcpApiBase> {
* @param apiGroupPcode
* @return
*/
List<OcpApiGroup> apiBaseTreeOther(String apiGroupCompanyCode, String apiGroupPcode,Integer apiGroupPromotionType);
List<OcpGroupBaseDto> apiBaseTreeOther(String apiGroupCompanyCode, String apiGroupPcode, Integer apiGroupPromotionType, String apiCode,String apiPromotion);
/**
* 根据分组code获取列表
......
......@@ -2,10 +2,7 @@ package com.pms.ocp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.pms.ocp.model.dto.GroupDto;
import com.pms.ocp.model.dto.OcpTenantBaseDto;
import com.pms.ocp.model.dto.TenantDto;
import com.pms.ocp.model.dto.WholeLinkParamDto;
import com.pms.ocp.model.dto.*;
import com.pms.ocp.model.entity.OcpApiGroup;
import com.pms.ocp.model.entity.OcpTenantBase;
import com.pms.ocp.model.entity.OcpTenantGroup;
......@@ -64,7 +61,7 @@ public interface TenantBasicManagementService extends IService<OcpTenantBase> {
* @param tenantGroupCompanyCode
* @return
*/
List<GroupDto> tenantBaseTreeOther(String tenantGroupCode, String tenantGroupCompanyCode);
List<GroupDto> tenantBaseTreeOther(String tenantGroupCode, String tenantGroupCompanyCode,String tenantCode);
/**
* 应用列表
......@@ -91,6 +88,14 @@ public interface TenantBasicManagementService extends IService<OcpTenantBase> {
*/
OcpTenantGroup selectRegister(String tenantGroupCode, String tenantGroupCompanyCode);
/**
* 查询基础表
* @param tenantGroupCode
* @param tenantGroupCompanyCode
* @return
*/
List<GroupDto> selectBase(String tenantGroupCode, String tenantGroupCompanyCode);
/**
* 应用树
* @param tenantGroupCode
......
......@@ -2,24 +2,21 @@ package com.pms.ocp.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pms.ocp.common.constants.StringUtils;
import com.pms.ocp.common.exception.BeagleException;
import com.pms.ocp.common.utils.MenuTree;
import com.pms.ocp.mapper.ApiBasicManagementMapper;
import com.pms.ocp.mapper.OcpApiExtentMapper;
import com.pms.ocp.mapper.OcpApiGroupMapper;
import com.pms.ocp.mapper.OcpApiSubsMapper;
import com.pms.ocp.model.CommonCode;
import com.pms.ocp.model.QueryResponseResult;
import com.pms.ocp.model.dto.ApiBaseDto;
import com.pms.ocp.model.dto.OcpApiBaseDto;
import com.pms.ocp.model.dto.WholeLinkParamDto;
import com.pms.ocp.model.dto.OcpGroupBaseDto;
import com.pms.ocp.model.entity.OcpApiBase;
import com.pms.ocp.model.entity.OcpApiExtent;
import com.pms.ocp.model.entity.OcpApiGroup;
......@@ -29,7 +26,7 @@ import com.pms.ocp.model.vo.*;
import com.pms.ocp.service.ApiBasicManagementService;
import com.pms.ocp.service.OcpApiExtentService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -39,6 +36,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
......@@ -57,6 +55,7 @@ public class ApiBasicManagementServiceImpl extends ServiceImpl<ApiBasicManagemen
private OcpApiGroupMapper ocpApiGroupMapper;
List<String> apiGroupCode = new ArrayList<>();
/**
* 导出查询
*
......@@ -98,6 +97,7 @@ public class ApiBasicManagementServiceImpl extends ServiceImpl<ApiBasicManagemen
ocpApiSubsMapper.insert(ocpApiSubs);
}
}
/**
* 条件查询
*
......@@ -114,7 +114,6 @@ public class ApiBasicManagementServiceImpl extends ServiceImpl<ApiBasicManagemen
return apiBasicManagementMapper.queryOcpApiBaseDto(keyword, apiUnit, startTime, endTime, apiCode, pageSize, pageNum);
}
/**
* 导入添加到数据库
*
......@@ -177,19 +176,32 @@ public class ApiBasicManagementServiceImpl extends ServiceImpl<ApiBasicManagemen
}
@Override
public List<OcpApiGroup> apiBaseTreeOther(String apiGroupCompanyCode, String apiGroupPcode,Integer apiGroupPromotionType) {
List<OcpApiGroup> ocpApiGroups = ocpApiGroupMapper.apiBaseTreeOther(apiGroupCompanyCode,apiGroupPcode,apiGroupPromotionType);
return ocpApiGroups;
public List<OcpGroupBaseDto> apiBaseTreeOther(String apiGroupCompanyCode, String apiGroupPcode, Integer apiGroupPromotionType, String apiCode, String apiPromotion) {
List<OcpGroupBaseDto> ocpApiGroups = ocpApiGroupMapper.apiTree(apiGroupCompanyCode, apiGroupPcode, apiGroupPromotionType, apiPromotion);
if (ocpApiGroups.size() != 0) {
return ocpApiGroups;
} else {
if (StringUtils.isNotEmpty(apiCode)) {
return Collections.EMPTY_LIST;
} else {
List<OcpGroupBaseDto> ocpGroupBaseDto = ocpApiGroupMapper.selectBase(apiGroupCompanyCode, apiGroupPcode, apiPromotion);
if (ocpGroupBaseDto.size() != 0) {
return ocpGroupBaseDto;
}
return Collections.EMPTY_LIST;
}
}
}
@Override
public ResponseVO<PageInfo<OcpApiBaseVo>> getBaseByGroupCode(ApiBaseDto apiBaseReq) {
if (apiBaseReq.getPageNum() == null || apiBaseReq.getPageSize() == null) {
return ResponseVO.error("分页参数不能为空");
return ResponseVO.error("分页参数不能为空");
}
apiGroupCode.add(apiBaseReq.getApiGroupCode());
setGroupIdValue(apiBaseReq.getApiGroupCompanyCode() ,apiBaseReq.getApiGroupCode(),apiBaseReq.getApiPromotion());
PageHelper.startPage(apiBaseReq.getPageNum(),apiBaseReq.getPageSize());
setGroupIdValue(apiBaseReq.getApiGroupCompanyCode(), apiBaseReq.getApiGroupCode(), apiBaseReq.getApiPromotion());
PageHelper.startPage(apiBaseReq.getPageNum(), apiBaseReq.getPageSize());
apiBaseReq.setApiGroupCodeList(apiGroupCode);
List<OcpApiBaseVo> ocpApiBaseVos = ocpApiGroupMapper.selectPageLists(apiBaseReq);
apiGroupCode.clear();
......@@ -207,7 +219,7 @@ public class ApiBasicManagementServiceImpl extends ServiceImpl<ApiBasicManagemen
qw.eq("owner_company_code", apiGroupCompanyCode);
}
return apiBasicManagementMapper.selectList(qw);
return apiBasicManagementMapper.selectList(qw);
}
// /**
......@@ -238,24 +250,26 @@ public class ApiBasicManagementServiceImpl extends ServiceImpl<ApiBasicManagemen
* @param
* @param
*/
private void setGroupIdValue(String apiGroupCompanyCode ,String code,Integer apiGroupPromotionType) {
List<String> codes = getIdsByPIdPub(apiGroupCompanyCode,code,apiGroupPromotionType);
if(codes.size()>0){
for (String cod : codes ){
setGroupIdValue(apiGroupCompanyCode,cod,apiGroupPromotionType);
private void setGroupIdValue(String apiGroupCompanyCode, String code, Integer apiGroupPromotionType) {
List<String> codes = getIdsByPIdPub(apiGroupCompanyCode, code, apiGroupPromotionType);
if (codes.size() > 0) {
for (String cod : codes) {
setGroupIdValue(apiGroupCompanyCode, cod, apiGroupPromotionType);
apiGroupCode.add(cod);
};
}
;
}
}
/**
* pcode服务分组
*
* @param apiGroupCompanyCode
* @param code
* @return
*/
public List<String> getIdsByPIdPub(String apiGroupCompanyCode,String code,Integer apiGroupPromotionType) {
List<OcpApiGroup> ocpApiGroups = ocpApiGroupMapper.apiBaseTreeOther(apiGroupCompanyCode, code,apiGroupPromotionType);
public List<String> getIdsByPIdPub(String apiGroupCompanyCode, String code, Integer apiGroupPromotionType) {
List<OcpApiGroup> ocpApiGroups = ocpApiGroupMapper.apiBaseTreeOther(apiGroupCompanyCode, code, apiGroupPromotionType);
return ocpApiGroups.stream().map(OcpApiGroup::getApiGroupCode).collect(Collectors.toList());
}
......
......@@ -18,6 +18,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.LinkedList;
import java.util.List;
import java.util.function.BiFunction;
/**
* @Auther: wangjian
......@@ -99,18 +100,31 @@ public class ModelSubscribeServiceImpl implements ModelSubscribeService {
@Override
public ResponseVO modelListNavigation(String searchCondition) {
//查询模型和模型属性表列表
List<TreeNode> modelProperList = modelSubscribeMapper.selectModelAndModelGroup(searchCondition);
if (CollectionUtil.isEmpty(modelProperList)){
List<TreeNode> modelGroupList = modelSubscribeMapper.selectModelAndModelGroup();
List<TreeNode> modelList = modelSubscribeMapper.getModelList(searchCondition);
List<TreeNode> groupAndChildrenList = setChildren(modelList,modelGroupList , (org, group) ->
org.getModelGroupCode().equals(group.getModelGroupCode())
);
if (CollectionUtil.isEmpty(groupAndChildrenList)){
return ResponseVO.error(CodeEnum.NO_DATA);
}
List<TreeNode> modelGroupList = TreeUtils.build(modelProperList);
List<TreeNode> newModelGroupList = TreeUtils.build(groupAndChildrenList);
//查询组织机构表
List<TreeNode> organList = modelSubscribeMapper.selectOrganData();
//将分类放入各自所属于的组织机构下
List<TreeNode> groupOrgList = setChildren(newModelGroupList, organList,(org, group) ->
org.getCompanyCode().equals(group.getCompanyCode())
);
List<TreeNode> result = TreeUtils.build(groupOrgList);
return ResponseVO.ok(result);
}
private List<TreeNode> setChildren(List<TreeNode> modelGroupList, List<TreeNode> organList, BiFunction<TreeNode,TreeNode,Boolean> function) {
organList.forEach(org
->{
modelGroupList.forEach(group->{
if (org.getCompanyCode().equals(group.getCompanyCode())){
//org.getCompanyCode().equals(group.getCompanyCode()
if (function.apply(org,group)){
if(org.getChildren() == null){
org.setChildren(new LinkedList<>());
}
......@@ -118,7 +132,6 @@ public class ModelSubscribeServiceImpl implements ModelSubscribeService {
}
});
});
List<TreeNode> result = TreeUtils.build(organList);
return ResponseVO.ok(result);
return organList;
}
}
......@@ -91,6 +91,9 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper, OcpApiG
if ("sys_center".equals(ocpApiGroup.getApiGroupLevel())) {
ocpApiGroup.setApiGroupLevel("api_group");
}
if (StringUtils.isBlank(ocpApiGroup.getApiGroupLevel())) {
ocpApiGroup.setApiGroupLevel("Middleground");
}
mapper.insert(ocpApi);
} else {
return ocpApi;
......@@ -132,16 +135,12 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper, OcpApiG
public boolean deleteOcpTree(OcpApiGroup ocpApiGroup) {
boolean flag = true;
LambdaQueryWrapper<OcpApiGroup> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OcpApiGroup::getApiGroupCode, ocpApiGroup.getApiGroupCode());
queryWrapper.eq(OcpApiGroup::getApiGroupPcode, ocpApiGroup.getApiGroupCode());
String objId = ocpApiGroup.getObjId();
if (StringUtils.isBlank(ocpApiGroup.getApiGroupCode())) {
flag = false;
} else {
LambdaQueryWrapper<OcpApiGroup> eq = queryWrapper.eq(OcpApiGroup::getApiGroupPcode, ocpApiGroup.getApiGroupCode());
if (StringUtils.isBlank(eq.toString())) {
flag = false;
}
List<OcpApiGroup> list = mapper.selectGroupPcode();
if (list.size() >= 1) {
flag = false;
}
if (flag) {
mapper.deleteById(objId);
......@@ -158,24 +157,33 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper, OcpApiG
*/
@Override
public Page<OcpApiGroup> getOnePages(PageGroupDto pageGroupDto) {
Page pageInfo = new Page(pageGroupDto.getPageNum(), pageGroupDto.getPageSize());
Page<OcpApiGroup> pageInfo = new Page(pageGroupDto.getCurrentPage(), pageGroupDto.getPageSize());
LambdaQueryWrapper<OcpApiGroup> qw = new LambdaQueryWrapper<>();
if (StringUtils.isBlank(pageGroupDto.getKeyword())) {
if (StringUtils.isBlank(pageGroupDto.getApiGroupCode())){
if (StringUtils.isBlank(pageGroupDto.getApiGroupCode())) {
qw.eq(OcpApiGroup::getApiGroupPromotionType, pageGroupDto.getApiGroupPromotionType());
mapper.selectPage(pageInfo, qw);
mapper.selectPage(pageInfo, qw);
} else if(!(StringUtils.isNotBlank(pageGroupDto.getApiGroupPcode()))){
} else if (!(StringUtils.isNotBlank(pageGroupDto.getApiGroupPcode()))) {
List<OcpApiGroup> ocpApiGroups = mapper.selectLists(pageGroupDto.getApiGroupPromotionType(), pageGroupDto.getApiGroupCode());
qw.eq(OcpApiGroup::getApiGroupPromotionType, pageGroupDto.getApiGroupPromotionType()).and(c -> c.eq(OcpApiGroup::getApiGroupPcode, pageGroupDto.getApiGroupCode()));
pageInfo.setRecords(ocpApiGroups);
pageInfo.setTotal(ocpApiGroups.size());
mapper.selectPage(pageInfo, qw);
List<OcpApiGroup> records = pageInfo.getRecords();
for (OcpApiGroup record : records) {
OcpApiGroup ocpApiGroup = mapper.selectCode(record.getApiGroupPcode());
record.setClassIfy(ocpApiGroup.getApiGroupName());
}
}
} else if(StringUtils.isNotBlank(pageGroupDto.getKeyword())){
} else if (StringUtils.isNotBlank(pageGroupDto.getKeyword())) {
LambdaQueryWrapper<OcpApiGroup> ocpTenantGroupLambdaQueryWrapper = qw.and(c -> c.like(OcpApiGroup::getApiGroupName, pageGroupDto.getKeyword()))
.and(c->c.eq(OcpApiGroup::getApiGroupPcode, pageGroupDto.getApiGroupCode()));
.and(c -> c.eq(OcpApiGroup::getApiGroupPcode, pageGroupDto.getApiGroupCode()));
mapper.selectPage(pageInfo, ocpTenantGroupLambdaQueryWrapper);
}
return pageInfo;
}
}
......
......@@ -10,6 +10,7 @@ import com.pms.ocp.mapper.OcpTenantExtentMapper;
import com.pms.ocp.mapper.OcpTenantGroupMapper;
import com.pms.ocp.mapper.TenantBasicManagementMapper;
import com.pms.ocp.model.dto.GroupDto;
import com.pms.ocp.model.dto.OcpTenantBaseDto;
import com.pms.ocp.model.dto.TenantDto;
import com.pms.ocp.model.entity.*;
......@@ -20,10 +21,13 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
......@@ -250,10 +254,22 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
* @return
*/
@Override
public List<GroupDto> tenantBaseTreeOther(String tenantGroupCode, String tenantGroupCompanyCode) {
public List<GroupDto> tenantBaseTreeOther(String tenantGroupCode, String tenantGroupCompanyCode, String tenantCode) {
List<GroupDto> ocpTenantGroups = ocpTenantGroupMapper.tenantBaseTreeOther(tenantGroupCode, tenantGroupCompanyCode);
if (ocpTenantGroups.size() != 0) {
return ocpTenantGroups;
} else {
if (StringUtils.isNotEmpty(tenantCode)) {
return Collections.EMPTY_LIST;
} else {
List<GroupDto> groupDtos = ocpTenantGroupMapper.selectBase(tenantGroupCode, tenantGroupCompanyCode);
if (groupDtos.size() != 0) {
return groupDtos;
}
return Collections.EMPTY_LIST;
}
return ocpTenantGroups;
}
}
......@@ -310,6 +326,18 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
return ocpTenantGroup;
}
/**
* 应用树底层
*
* @param tenantGroupCode
* @param tenantGroupCompanyCode
* @return
*/
public List<GroupDto> selectBase(String tenantGroupCode, String tenantGroupCompanyCode) {
List<GroupDto> groupDto = ocpTenantGroupMapper.selectBase(tenantGroupCode, tenantGroupCompanyCode);
return groupDto;
}
/**
* 应用树2
*
......
......@@ -173,20 +173,14 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, OcpTenantGroup>
OcpTenantGroup ocpTenantGroup = tenantMapper.selectGroupCode(tenantGroupCode);
Page<OcpTenantGroup> page = new Page<>(currentPage, pageSize);
if (StringUtils.isBlank(keyword)) {
if ("".equals(lev) || "1".equals(lev)) {
if (StringUtils.isBlank(lev) || "1".equals(lev) ) {
LambdaQueryWrapper<OcpTenantGroup> eq = qw.eq(OcpTenantGroup::getTenantGroupCompanyCode, tenantGroupCompanyCode);
tenantMapper.selectPage(page, eq);
} else if ("2".equals(lev) || "3".equals(lev)) {
List<OcpTenantGroup> ocpTenantGroupList = tenantMapper.selectTenantGroupsList(tenantGroupCode, tenantGroupCompanyCode);
for (OcpTenantGroup tenantGroup : ocpTenantGroupList) {
String tenantGroupCode1 = tenantGroup.getTenantGroupCode();
OcpTenantGroup ocpTenantGroup1 = tenantMapper.selectGroupName(tenantGroupCode1);
tenantGroup.setClassIfy(ocpTenantGroup1.getTenantGroupName());
}
// LambdaQueryWrapper<OcpTenantGroup> eq = qw.or(wq -> wq.eq(OcpTenantGroup::getTenantGroupCompanyCode, tenantGroupCompanyCode)).eq(OcpTenantGroup::getTenantGroupPcode, tenantGroupCode);
page.setRecords(ocpTenantGroupList);
LambdaQueryWrapper<OcpTenantGroup> eq = qw.or(wq -> wq.eq(OcpTenantGroup::getTenantGroupCompanyCode, tenantGroupCompanyCode)).eq(OcpTenantGroup::getTenantGroupPcode, tenantGroupCode);
tenantMapper.selectPage(page,eq);
}
} else if (!(StringUtils.isBlank(keyword))) {
LambdaQueryWrapper<OcpTenantGroup> ocpTenantGroupLambdaQueryWrapper = qw.and(c -> c.like(OcpTenantGroup::getTenantGroupCompanyCode, keyword))
......@@ -201,7 +195,14 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, OcpTenantGroup>
// page.setRecords(ocpTenantGroupList);
// page.setTotal(ocpTenantGroupList.size());
}
if (StringUtils.isBlank(page.toString())) {
List<OcpTenantGroup> records = page.getRecords();
for (OcpTenantGroup record : records) {
String tenantGroupCode1 = record.getTenantGroupName();
OcpTenantGroup ocpTenantGroup1 = tenantMapper.selectGroupName(tenantGroupCode1);
record.setClassIfy(ocpTenantGroup1.getTenantGroupName());
}
}
return page;
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pms.ocp.mapper.ModelSubscribeMapper">
<resultMap id="modelAndModelGroupMap" type="com.pms.ocp.model.entity.TreeNode" >
<result column="model_group_code" property="code"/>
<result column="model_group_pcode" property="pCode"/>
<result column="group_company_code" property="companyCode"/>
<result column="model_group_name" property="name"/>
<result column="groupModelBelongLevel" property="belongLevel"/>
<collection property="children" ofType="com.pms.ocp.model.entity.TreeNode">
<result column="model_name" property="name"/>
<result column="model_code" property="code"/>
<result column="modelLevel" property="belongLevel"/>
</collection>
</resultMap>
<select id="selectModelAndModelGroup" parameterType="java.lang.String" resultMap="modelAndModelGroupMap">
<select id="selectModelAndModelGroup" resultType="com.pms.ocp.model.entity.TreeNode">
select
2 AS groupModelBelongLevel,
3 AS modelLevel,
omg.model_group_pcode,
omg.group_company_code,
omg.model_group_name,
omg.model_group_code,
omb.model_name,
omb.model_code
omg.model_group_name as name,
2 as belongLevel,
omg.model_group_pcode as pCode,
omg.model_group_code as code,
omg.model_group_code as modelGroupCode,
omg.group_company_code as companyCode
from
ocp_model_group as omg
left join
ocp_model_base omb
on omg.model_group_code = omb.model_group_code
</select>
<select id="getModelList" parameterType="java.lang.String" resultType="com.pms.ocp.model.entity.TreeNode">
select
3 as belongLevel,
model_name as name ,
model_code as code,
model_group_code as modelGroupCode
from
ocp_model_base
<if test="searchCondition != null and searchCondition != '' ">
where
model_name LIKE concat('%',#{searchCondition}::text ,'%')
model_name like concat('%',#{searchCondition}::text ,'%')
</if>
</select>
<select id="selectOrganData" resultType="com.pms.ocp.model.entity.TreeNode">
select
1 AS belongLevel,
......
......@@ -22,7 +22,7 @@
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">
and api_group_pcode is null
and api_group_pcode is null
</if>
<if test="apiGroupPcode!=null and apiGroupPcode!=''">
and api_group_pcode = #{apiGroupPcode}
......@@ -36,7 +36,7 @@
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">
and api_group_pcode is null
and api_group_pcode is null
</if>
<if test="apiGroupPcode!=null and apiGroupPcode!=''">
and api_group_pcode = #{apiGroupPcode}
......@@ -48,6 +48,29 @@
and api_group_promotion_type =#{apiGroupPromotionType}
</if>
</select>
<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">
and api_group_pcode is null
</if>
<if test="apiGroupPcode!=null and apiGroupPcode!=''">
and api_group_pcode = #{apiGroupPcode}
</if>
<if test="apiGroupCompanyCode!=null and apiGroupCompanyCode!=''">
and api_group_company_code =#{apiGroupCompanyCode}
</if>
<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>
<select id="selectPageLists" resultType="com.pms.ocp.model.vo.OcpApiBaseVo">
select
oab.obj_id,oab.api_code,oae.api_code,oab.api_name,oae.cluster_name,
......@@ -56,17 +79,17 @@
on oab.api_code = oae.api_code
where oab.is_delete = 0
<if test="apiGroupCodeList !=null ">
and oab.api_group_code in
and oab.api_group_code in
<foreach item="apiGroupCode" collection="apiGroupCodeList" open="(" separator=","
close=")">
#{apiGroupCode}
</foreach>
</if>
<if test="apiUnit !=null and apiUnit!=''">
and oab.api_unit = #{apiUnit}
and oab.api_unit = #{apiUnit}
</if>
<if test="apiPromotion !=null and apiPromotion!=''">
and oab.api_promotion = #{apiPromotion}
and oab.api_promotion = #{apiPromotion}
</if>
<if test="startTime !=null ">
<![CDATA[
......@@ -84,8 +107,26 @@
</select>
<!-- <select id="queryApiTreeData1" resultType="com.pms.ocp.model.vo.WholeLinkTreeVo">-->
<!-- select api_group_code ,api_group_name ,api_group_pcode ,api_group_promotion_type from operating_platform.ocp_api_group-->
<!-- </select>-->
<select id="selectBase" resultType="com.pms.ocp.model.dto.OcpGroupBaseDto">
select obj_id,api_code,api_name,api_group_code from ocp_api_base
<where>
<if test="apiGroupPcode!=null and apiGroupPcode!=''">
and api_group_code = #{apiGroupPcode}
</if>
<if test="apiGroupCompanyCode!=null and apiGroupCompanyCode!=''">
and owner_company_code =#{apiGroupCompanyCode}
</if>
<if test="test=apiPromotion!=null and apiPromotion!=''">
and api_promotion=#{apiPromotion}
</if>
</where>
</select>
<!-- <select id="queryApiTreeData1" resultType="com.pms.ocp.model.vo.WholeLinkTreeVo">-->
<!-- select api_group_code ,api_group_name ,api_group_pcode ,api_group_promotion_type from operating_platform.ocp_api_group-->
<!-- </select>-->
</mapper>
\ No newline at end of file
......@@ -30,5 +30,9 @@
SELECT * FROM ocp_api_group where api_group_code = #{apiGroupCode};
</select>
<!-- 根据code查询是否=含有下级服务-->
<select id="selectGroupPcode" resultType="com.pms.ocp.model.entity.OcpApiGroup">
SELECT * FROM ocp_api_group where api_group_pcode = #{apiGroupCode};
</select>
</mapper>
\ No newline at end of file
......@@ -9,7 +9,7 @@
<result property="tenantUrl" column="tenant_url"/>
<result property="clusterName" column="cluster_name"/>
<result property="spaceName" column="space_name"/>
<!-- <result property="deploymentName" column="deployment_name"/>-->
<!-- <result property="deploymentName" column="deployment_name"/>-->
<result property="tenantZone" column="tenant_zone"/>
<result property="tenantCtime" column="tenant_ctime"/>
<result property="tenantUnit" column="tenant_unit" jdbcType="VARCHAR"/>
......@@ -19,8 +19,6 @@
<select id="tenantBaseTreeOther" resultType="com.pms.ocp.model.dto.GroupDto">
select
tenant_group_code,tenant_group_name,tenant_group_pcode ,tenant_group_level from ocp_tenant_group
-- LEFT join ocp_tenant_base otb on otg.tenant_group_code=otb.tenant_group_code
where is_delete = 0
<if test="tenantGroupCode == null">
and tenant_group_pcode = ''
......@@ -81,5 +79,16 @@
</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>
<if test="tenantGroupCode !=null and tenantGroupCode!=''">
and tenant_group_code=#{tenantGroupCode}
</if>
<if test="tenantGroupCompanyCode !=null and tenantGroupCompanyCode !=''">
and owner_company_code=#{tenantGroupCompanyCode}
</if>
</where>
</select>
</mapper>
......@@ -25,7 +25,7 @@
<select id="selectGroups" resultType="com.pms.ocp.model.entity.OcpTenantGroup">
SELECT * FROM ocp_tenant_group WHERE tenant_group_company_code = #{tenantGroupCompanyCode};
SELECT * FROM ocp_tenant_group WHERE tenant_group_company_code = #{tenantGroupCompanyCode} and tenant_group_pcode = '';
</select>
<!-- 根据创建公司和分类名称获取集合-->
......
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