Commit 585c9e1d authored by zhaochengming's avatar zhaochengming

应用bug修改

parent 69b0d5ad
...@@ -17,6 +17,7 @@ public class RandomStringUtils { ...@@ -17,6 +17,7 @@ public class RandomStringUtils {
String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
Random random=new Random(); Random random=new Random();
StringBuffer sb=new StringBuffer(); StringBuffer sb=new StringBuffer();
for(int i=0;i<length;i++){ for(int i=0;i<length;i++){
int number=random.nextInt(62); int number=random.nextInt(62);
sb.append(str.charAt(number)); sb.append(str.charAt(number));
......
...@@ -39,4 +39,7 @@ public interface OcpApiTreeMapper extends BaseMapper<OcpApiGroup> { ...@@ -39,4 +39,7 @@ public interface OcpApiTreeMapper extends BaseMapper<OcpApiGroup> {
//根据code查询整条数据 //根据code查询整条数据
OcpApiGroup selectCode(String code); OcpApiGroup selectCode(String code);
//根据code查询是否=含有下级服务
List<OcpApiGroup> selectGroupPcode();
} }
...@@ -91,7 +91,7 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper, OcpApiG ...@@ -91,7 +91,7 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper, OcpApiG
if ("sys_center".equals(ocpApiGroup.getApiGroupLevel())) { if ("sys_center".equals(ocpApiGroup.getApiGroupLevel())) {
ocpApiGroup.setApiGroupLevel("api_group"); ocpApiGroup.setApiGroupLevel("api_group");
} }
if (StringUtils.isBlank(ocpApiGroup.getApiGroupLevel())){ if (StringUtils.isBlank(ocpApiGroup.getApiGroupLevel())) {
ocpApiGroup.setApiGroupLevel("Middleground"); ocpApiGroup.setApiGroupLevel("Middleground");
} }
mapper.insert(ocpApi); mapper.insert(ocpApi);
...@@ -135,16 +135,12 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper, OcpApiG ...@@ -135,16 +135,12 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper, OcpApiG
public boolean deleteOcpTree(OcpApiGroup ocpApiGroup) { public boolean deleteOcpTree(OcpApiGroup ocpApiGroup) {
boolean flag = true; boolean flag = true;
LambdaQueryWrapper<OcpApiGroup> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OcpApiGroup> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OcpApiGroup::getApiGroupCode, ocpApiGroup.getApiGroupCode()); queryWrapper.eq(OcpApiGroup::getApiGroupPcode, ocpApiGroup.getApiGroupCode());
String objId = ocpApiGroup.getObjId(); String objId = ocpApiGroup.getObjId();
if (StringUtils.isBlank(ocpApiGroup.getApiGroupCode())) {
flag = false;
} else {
LambdaQueryWrapper<OcpApiGroup> eq = queryWrapper.eq(OcpApiGroup::getApiGroupPcode, ocpApiGroup.getApiGroupCode()); List<OcpApiGroup> list = mapper.selectGroupPcode();
if (StringUtils.isBlank(eq.toString())) { if (list.size() >= 1) {
flag = false; flag = false;
}
} }
if (flag) { if (flag) {
mapper.deleteById(objId); mapper.deleteById(objId);
...@@ -164,15 +160,15 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper, OcpApiG ...@@ -164,15 +160,15 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper, OcpApiG
Page<OcpApiGroup> pageInfo = new Page(pageGroupDto.getCurrentPage(), pageGroupDto.getPageSize()); Page<OcpApiGroup> pageInfo = new Page(pageGroupDto.getCurrentPage(), pageGroupDto.getPageSize());
LambdaQueryWrapper<OcpApiGroup> qw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OcpApiGroup> qw = new LambdaQueryWrapper<>();
if (StringUtils.isBlank(pageGroupDto.getKeyword())) { if (StringUtils.isBlank(pageGroupDto.getKeyword())) {
if (StringUtils.isBlank(pageGroupDto.getApiGroupCode())){ if (StringUtils.isBlank(pageGroupDto.getApiGroupCode())) {
qw.eq(OcpApiGroup::getApiGroupPromotionType, pageGroupDto.getApiGroupPromotionType()); 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()); List<OcpApiGroup> ocpApiGroups = mapper.selectLists(pageGroupDto.getApiGroupPromotionType(), pageGroupDto.getApiGroupCode());
qw.eq(OcpApiGroup::getApiGroupPromotionType,pageGroupDto.getApiGroupPromotionType()).and(c->c.eq(OcpApiGroup::getApiGroupPcode,pageGroupDto.getApiGroupCode())); qw.eq(OcpApiGroup::getApiGroupPromotionType, pageGroupDto.getApiGroupPromotionType()).and(c -> c.eq(OcpApiGroup::getApiGroupPcode, pageGroupDto.getApiGroupCode()));
pageInfo.setRecords(ocpApiGroups); pageInfo.setRecords(ocpApiGroups);
mapper.selectPage(pageInfo,qw); mapper.selectPage(pageInfo, qw);
List<OcpApiGroup> records = pageInfo.getRecords(); List<OcpApiGroup> records = pageInfo.getRecords();
for (OcpApiGroup record : records) { for (OcpApiGroup record : records) {
OcpApiGroup ocpApiGroup = mapper.selectCode(record.getApiGroupPcode()); OcpApiGroup ocpApiGroup = mapper.selectCode(record.getApiGroupPcode());
...@@ -181,14 +177,13 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper, OcpApiG ...@@ -181,14 +177,13 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper, OcpApiG
} }
} else if(StringUtils.isNotBlank(pageGroupDto.getKeyword())){ } else if (StringUtils.isNotBlank(pageGroupDto.getKeyword())) {
LambdaQueryWrapper<OcpApiGroup> ocpTenantGroupLambdaQueryWrapper = qw.and(c -> c.like(OcpApiGroup::getApiGroupName, 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); mapper.selectPage(pageInfo, ocpTenantGroupLambdaQueryWrapper);
} }
return pageInfo; return pageInfo;
} }
} }
......
...@@ -30,5 +30,9 @@ ...@@ -30,5 +30,9 @@
SELECT * FROM ocp_api_group where api_group_code = #{apiGroupCode}; SELECT * FROM ocp_api_group where api_group_code = #{apiGroupCode};
</select> </select>
<!-- 根据code查询是否=含有下级服务-->
<select id="selectGroupPcode" resultType="com.pms.ocp.model.entity.OcpApiGroup">
SELECT * FROM ocp_api_group where api_group_pcode = #{apiGroupCode};
</select>
</mapper> </mapper>
\ No newline at end of file
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