Commit 363b84b9 authored by zhaochengming's avatar zhaochengming

赵呈明 --服务树

parent 67f62c47
...@@ -34,8 +34,8 @@ public class OcpApiTreeController { ...@@ -34,8 +34,8 @@ public class OcpApiTreeController {
*/ */
@GetMapping("/getTree") @GetMapping("/getTree")
@ApiOperation("服务树分类") @ApiOperation("服务树分类")
public ResponseVO< List<OcpApiGroup>> getTree(String apiGroupPromotionType,String apiGroupCode){ public ResponseVO< List<OcpApiGroup>> getTree(OcpApiGroup ocpApiGroup){
List<OcpApiGroup> byGroup = service.getByGroup(apiGroupPromotionType, apiGroupCode); List<OcpApiGroup> byGroup = service.getByGroup(ocpApiGroup.getApiGroupPromotionType(), ocpApiGroup.getApiGroupCode());
return ResponseVO.ok(byGroup); return ResponseVO.ok(byGroup);
} }
...@@ -51,9 +51,9 @@ public class OcpApiTreeController { ...@@ -51,9 +51,9 @@ public class OcpApiTreeController {
} }
@PostMapping("/getone") @GetMapping("/getone")
@ApiOperation("服务树分类--分级数据") @ApiOperation("服务树分类--分级数据")
public ResponseVO<Page<OcpApiGroup>> getOne(@RequestBody PageGroupDto pageGroupDto){ public ResponseVO<Page<OcpApiGroup>> getOne(PageGroupDto pageGroupDto){
Page<OcpApiGroup> onePages = service.getOnePages(pageGroupDto); Page<OcpApiGroup> onePages = service.getOnePages(pageGroupDto);
return ResponseVO.ok(onePages); return ResponseVO.ok(onePages);
} }
......
...@@ -40,8 +40,8 @@ public class OcpTenantController { ...@@ -40,8 +40,8 @@ public class OcpTenantController {
} }
@GetMapping("/tenantselect") @GetMapping("/tenantselect")
@ApiModelProperty("应用树分类--查询") @ApiModelProperty("应用树分类--查询")
private Page<OcpTenantGroup> getselect(String tenantGroupCode,String tenantGroupCompanyCode,int currentPage,int pageSize){ private Page<OcpTenantGroup> getselect(String tenantGroupCode,String tenantGroupCompanyCode,int currentPage,int pageSize,String keyword){
Page<OcpTenantGroup> tree= tenantService.getselects(tenantGroupCode,tenantGroupCompanyCode,currentPage,pageSize); Page<OcpTenantGroup> tree= tenantService.getselects(tenantGroupCode,tenantGroupCompanyCode,currentPage,pageSize,keyword);
return tree; return tree;
} }
......
...@@ -26,8 +26,11 @@ public interface OcpApiTreeMapper extends BaseMapper<OcpApiGroup> { ...@@ -26,8 +26,11 @@ public interface OcpApiTreeMapper extends BaseMapper<OcpApiGroup> {
* @param apiGroupPromotionType * @param apiGroupPromotionType
* @return * @return
*/ */
List<OcpApiGroup> selectTwoApiGroups(String apiGroupPromotionType); List<OcpApiGroup> selectTwoApiGroups(Long apiGroupPromotionType);
//三级数 //三级数
List<OcpApiGroup> selectThreeApiGroupsList(String apiGroupPromotionType, String apiGroupCode); List<OcpApiGroup> selectThreeApiGroupsList(Long apiGroupPromotionType, String apiGroupCode);
List<OcpApiGroup> selectList(Long apiGroupPromotionType, String apiGroupCode,Long apiGroupLevel);
} }
...@@ -29,6 +29,10 @@ public interface TenantMapper extends BaseMapper<OcpTenantGroup> { ...@@ -29,6 +29,10 @@ public interface TenantMapper extends BaseMapper<OcpTenantGroup> {
List<OcpTenantGroup> selectGroups(String tenantGroupCompanyCode); List<OcpTenantGroup> selectGroups(String tenantGroupCompanyCode);
//模糊查询
List<OcpTenantGroup> queryLike(String keyword);
} }
...@@ -186,4 +186,5 @@ public class OcpApiGroup { ...@@ -186,4 +186,5 @@ public class OcpApiGroup {
} }
} }
...@@ -16,7 +16,7 @@ public interface OcpApiTreeService extends IService<OcpApiGroup> { ...@@ -16,7 +16,7 @@ public interface OcpApiTreeService extends IService<OcpApiGroup> {
/** /**
* 服务树分类 * 服务树分类
*/ */
List<OcpApiGroup> getByGroup(String apiGroupPromotionType,String apiGroupCode); List<OcpApiGroup> getByGroup(Long apiGroupPromotionType,String apiGroupCode);
/** /**
* 新增服务分类 * 新增服务分类
......
...@@ -48,17 +48,6 @@ public interface TenantService extends IService<OcpTenantGroup> { ...@@ -48,17 +48,6 @@ public interface TenantService extends IService<OcpTenantGroup> {
* @param tenantGroupCompanyCode * @param tenantGroupCompanyCode
* @return * @return
*/ */
Page<OcpTenantGroup> getselects(String tenantGroupCode,String tenantGroupCompanyCode,int currentPage,int pageSize); Page<OcpTenantGroup> getselects(String tenantGroupCode,String tenantGroupCompanyCode,int currentPage,int pageSize,String text);
/*// 应用分类--一级
OcpTenantGroupDto getTenantOneTree();
// 应用分类--二级
List<TwoTenanList> getTenantTwoTree(String code);*/
/* *//**
* // 应用分类--三级
* @param code
* @return
*//*
List<ThreeTenanList> getTenantThreeTree(String code);*/
} }
...@@ -41,7 +41,7 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr ...@@ -41,7 +41,7 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr
*/ */
@Override @Override
public List<OcpApiGroup> getByGroup(String apiGroupPromotionType,String apiGroupCode) { public List<OcpApiGroup> getByGroup(Long apiGroupPromotionType,String apiGroupCode) {
// if (StringUtils.isBlank(apiGroupPromotionType) && StringUtils.isBlank(apiGroupCode)) { // if (StringUtils.isBlank(apiGroupPromotionType) && StringUtils.isBlank(apiGroupCode)) {
// List<OcpApiGroup> ocpApiGroups = mapper.selectApiGroups(); // List<OcpApiGroup> ocpApiGroups = mapper.selectApiGroups();
...@@ -59,113 +59,6 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr ...@@ -59,113 +59,6 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr
} }
/* //服务树全表数据
List<OcpApiGroup> ocpApiGroups = mapper.selectList(null);
//服务树分类对象
ApiTreeGroupDto apiTreeGroupList = new ApiTreeGroupDto();
//1中台层
List<OneTreeUpList> oneTreeUpLists = new ArrayList<>();
for (OcpApiGroup ocpApiGroup : ocpApiGroups) {
//判断数据状态
if (!(ocpApiGroup.getIsDelete() == 0)) {
//一级服务对象
OneTreeUpList oneTreeUpList = new OneTreeUpList();
// 判断数据是否有上级服务分类
if (ocpApiGroup.getApiGroupLevel() == 1) {
BeanUtils.copyProperties(ocpApiGroup, oneTreeUpList);
oneTreeUpLists.add(oneTreeUpList);
}
}
}
List<TwoDownList> twoDownLists = twoTreeLists(oneTreeUpLists, ocpApiGroups);
List<ThreeTreeList> threeTreeLists = threeTreeLists(twoDownLists, ocpApiGroups);
List<FourTreeList> fourTreeLists = fourTreeLists(threeTreeLists, ocpApiGroups);
apiTreeGroupList.setOneList(oneTreeUpLists);
apiTreeGroupList.setTwoList(twoDownLists);
apiTreeGroupList.setThreeList(threeTreeLists);
apiTreeGroupList.setFourList(fourTreeLists);
return apiTreeGroupList;
}
*//**
* 2中心层
*
* @param oneTreeUpLists
* @return
*//*
public List<TwoDownList> twoTreeLists(List<OneTreeUpList> oneTreeUpLists, List<OcpApiGroup> ocpApiGroups) {
*//* List<OcpApiGroup> groupList = new ArrayList<>();*//*
List<TwoDownList> twoTreeLists = new ArrayList<>();
for (OcpApiGroup ocpApiGroup : ocpApiGroups) {
TwoDownList twoDownList = new TwoDownList();
if (!(ocpApiGroup.getIsDelete() == 0)) {
if (ocpApiGroup.getApiGroupLevel() == 2) {
BeanUtils.copyProperties(ocpApiGroup, twoDownList);
twoTreeLists.add(twoDownList);
} else {
continue;
}
}
}
return twoTreeLists;
}
*//**
* 3服务组层
*
* @param twoDownLists
* @return
*//*
public List<ThreeTreeList> threeTreeLists(List<TwoDownList> twoDownLists, List<OcpApiGroup> ocpApiGroups) {
List<ThreeTreeList> threeTreeLists = new ArrayList<>();
for (OcpApiGroup ocpApiGroup : ocpApiGroups) {
ThreeTreeList threeTreeList = new ThreeTreeList();
if (!(ocpApiGroup.getIsDelete() == 0)) {
if (ocpApiGroup.getApiGroupLevel() == 3) {
BeanUtils.copyProperties(ocpApiGroup, threeTreeList);
threeTreeLists.add(threeTreeList);
}
} else {
continue;
}
}
return threeTreeLists;
}
*//**
* 4服务层
*
* @param threeTreeLists
* @return
*//*
public List<FourTreeList> fourTreeLists(List<ThreeTreeList> threeTreeLists, List<OcpApiGroup> ocpApiGroups) {
List<FourTreeList> foureTreeList = new ArrayList<>();
for (OcpApiGroup ocpApiGroup : ocpApiGroups) {
if (!(ocpApiGroup.getIsDelete() == 0)) {
if (ocpApiGroup.getApiGroupLevel() == 4) {
FourTreeList fourTreeList = new FourTreeList();
BeanUtils.copyProperties(ocpApiGroup, fourTreeList);
foureTreeList.add(fourTreeList);
}
} else {
continue;
}
}
return foureTreeList;
}
*/
/** /**
* 新增服务分类 * 新增服务分类
* *
...@@ -244,22 +137,6 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr ...@@ -244,22 +137,6 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr
} }
/* *//**
* 一级服务
*
* @param
*//*
@Override
public List<OcpApiGroup> getOnePage(int pageSize, int pageNum, int apiGroupLevel) {
Page pageInfo = new Page(pageSize,pageNum);
LambdaQueryWrapper<OcpApiGroup> queryWrapper = new LambdaQueryWrapper();
LambdaQueryWrapper<OcpApiGroup> eq = queryWrapper.eq(OcpApiGroup::getApiGroupLevel, apiGroupLevel);
List<OcpApiGroup> ocpApiGroups = mapper.selectList(eq);
return ocpApiGroups;
}*/
/** /**
* 服务列表分级查询 * 服务列表分级查询
* *
...@@ -270,44 +147,15 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr ...@@ -270,44 +147,15 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr
public Page<OcpApiGroup> getOnePages(PageGroupDto pageGroupDto) { public Page<OcpApiGroup> getOnePages(PageGroupDto pageGroupDto) {
Page pageInfo = new Page(pageGroupDto.getPageSize(), pageGroupDto.getPageNum()); Page pageInfo = new Page(pageGroupDto.getPageSize(), pageGroupDto.getPageNum());
if (pageGroupDto.getApiGroupLevel() == 1 && "".equals(pageGroupDto.getApiGroupPcode())){ if (StringUtils.isBlank(pageGroupDto.getApiGroupCode())){
LambdaQueryWrapper<OcpApiGroup> queryWrapper = new LambdaQueryWrapper(); List<OcpApiGroup> ocpApiGroups = mapper.selectTwoApiGroups(pageGroupDto.getApiGroupPromotionType());
queryWrapper.eq(OcpApiGroup::getApiGroupLevel, pageGroupDto.getApiGroupLevel()); pageInfo.setRecords(ocpApiGroups);
mapper.selectPage(pageInfo,queryWrapper); }else if (!(StringUtils.isBlank(pageGroupDto.getApiGroupCode()))){
}else if (pageGroupDto.getApiGroupLevel() == 2){ List<OcpApiGroup> ocpApiGroups = mapper.selectList(pageGroupDto.getApiGroupPromotionType(),pageGroupDto.getApiGroupCode(),pageGroupDto.getApiGroupLevel());
List<OcpApiGroup> ocpApiGroups = mapper.selectList(null); LambdaQueryWrapper<OcpApiGroup> lwq = new LambdaQueryWrapper<>();
for (OcpApiGroup ocpApiGroup : ocpApiGroups) { pageInfo.setRecords(ocpApiGroups);
if (pageGroupDto.getApiGroupCode().equals(ocpApiGroup.getApiGroupCode())){ mapper.selectPage(pageInfo, lwq);
LambdaQueryWrapper<OcpApiGroup> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(OcpApiGroup::getApiGroupLevel, pageGroupDto.getApiGroupLevel());
mapper.selectPage(pageInfo,queryWrapper);
}
}
}else if (pageGroupDto.getApiGroupLevel() == 3){
List<OcpApiGroup> ocpApiGroups = mapper.selectList(null);
for (OcpApiGroup ocpApiGroup : ocpApiGroups) {
if (pageGroupDto.getApiGroupCode() == ocpApiGroup.getApiGroupCode()) {
LambdaQueryWrapper<OcpApiGroup> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(OcpApiGroup::getApiGroupLevel, pageGroupDto.getApiGroupLevel());
mapper.selectPage(pageInfo, queryWrapper);
}
}
}else {
List<OcpApiGroup> ocpApiGroups = mapper.selectList(null);
for (OcpApiGroup ocpApiGroup : ocpApiGroups) {
if (pageGroupDto.getApiGroupCode() == ocpApiGroup.getApiGroupCode()) {
LambdaQueryWrapper<OcpApiGroup> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(OcpApiGroup::getApiGroupLevel, pageGroupDto.getApiGroupLevel());
mapper.selectPage(pageInfo, queryWrapper);
}
}
} }
return pageInfo; return pageInfo;
} }
} }
...@@ -12,6 +12,7 @@ import com.pms.ocp.model.dto.*; ...@@ -12,6 +12,7 @@ import com.pms.ocp.model.dto.*;
import com.pms.ocp.model.entity.OcpTenantBase; import com.pms.ocp.model.entity.OcpTenantBase;
import com.pms.ocp.model.entity.OcpTenantGroup; import com.pms.ocp.model.entity.OcpTenantGroup;
import com.pms.ocp.service.TenantService; import com.pms.ocp.service.TenantService;
import com.zaxxer.hikari.util.IsolationLevel;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -152,21 +153,35 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, OcpTenantGroup> ...@@ -152,21 +153,35 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, OcpTenantGroup>
* @return * @return
*/ */
@Override @Override
public Page<OcpTenantGroup> getselects(String tenantGroupCode,String tenantGroupCompanyCode,int currentPage,int pageSize) { public Page<OcpTenantGroup> getselects(String tenantGroupCode,String tenantGroupCompanyCode,int currentPage,int pageSize,String keyword) {
Page<OcpTenantGroup> page = new Page<>(currentPage,pageSize); LambdaQueryWrapper<OcpTenantGroup> qw = new LambdaQueryWrapper<>();
if (StringUtils.isBlank(tenantGroupCode)){ List<OcpTenantGroup> ocpTenantGroupList1 = tenantMapper.selectList(null);
//顶级目录 Page<OcpTenantGroup> page = new Page<>(currentPage, pageSize);
List<OcpTenantGroup> ocpTenantGroupList = tenantMapper.selectTenantGroup(tenantGroupCompanyCode); if ("".equals(keyword)) {
page.setRecords(ocpTenantGroupList); if (StringUtils.isBlank(tenantGroupCode)) {
for (OcpTenantGroup ocpTenantGroup : ocpTenantGroupList1) {
if (ocpTenantGroup.getTenantGroupPcode().equals(tenantGroupCode) && ocpTenantGroup.getTenantGroupCompanyCode().equals(tenantGroupCompanyCode)){
List<OcpTenantGroup> ocpTenantGroupList = tenantMapper.selectTenantGroup(tenantGroupCompanyCode);
page.setRecords(ocpTenantGroupList);
tenantMapper.selectPage(page,qw);
}
}
} else {
for (OcpTenantGroup ocpTenantGroup : ocpTenantGroupList1) {
if (ocpTenantGroup.getTenantGroupPcode().equals(tenantGroupCode) && ocpTenantGroup.getTenantGroupCompanyCode().equals(tenantGroupCompanyCode)) {
List<OcpTenantGroup> ocpTenantGroupList = tenantMapper.selectTenantGroups(tenantGroupCode, tenantGroupCompanyCode);
page.setRecords(ocpTenantGroupList);
tenantMapper.selectPage(page,qw);
}
}
}
return page;
}else { }else {
List<OcpTenantGroup> ocpTenantGroupList = tenantMapper.queryLike(keyword);
List<OcpTenantGroup> ocpTenantGroupList = tenantMapper.selectTenantGroups(tenantGroupCode,tenantGroupCompanyCode);
page.setRecords(ocpTenantGroupList); page.setRecords(ocpTenantGroupList);
tenantMapper.selectPage(page,qw);
return page;
} }
return page;
}
}
} }
...@@ -6,7 +6,7 @@ spring: ...@@ -6,7 +6,7 @@ spring:
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
# jdbc-url: jdbc:postgresql://192.168.43.20:33072/pms3?currentSchema=public&stringtype=unspecified&TimeZone=Asia/Shanghai&useAffectedRows=true # jdbc-url: jdbc:postgresql://192.168.43.20:33072/pms3?currentSchema=public&stringtype=unspecified&TimeZone=Asia/Shanghai&useAffectedRows=true
# jdbc-url: jdbc:postgresql://172.20.10.9:33072/pms3?currentSchema=public&stringtype=unspecified&TimeZone=Asia/Shanghai&useAffectedRows=true # jdbc-url: jdbc:postgresql://172.20.10.9:33072/pms3?currentSchema=public&stringtype=unspecified&TimeZone=Asia/Shanghai&useAffectedRows=true
url: jdbc:postgresql://localhost:5432/operating_platform?stringtype=unspecified&TimeZone=Asia/Shanghai&useAffectedRows=true url: jdbc:postgresql://localhost:5432/postgres?currentSchema=operating_platform&stringtype=unspecified&TimeZone=Asia/Shanghai&useAffectedRows=true
knife4j: knife4j:
enable: true enable: true
......
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