Commit 585c9e1d authored by zhaochengming's avatar zhaochengming

应用bug修改

parent 69b0d5ad
......@@ -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));
......
......@@ -39,4 +39,7 @@ public interface OcpApiTreeMapper extends BaseMapper<OcpApiGroup> {
//根据code查询整条数据
OcpApiGroup selectCode(String code);
//根据code查询是否=含有下级服务
List<OcpApiGroup> selectGroupPcode();
}
......@@ -91,7 +91,7 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper, OcpApiG
if ("sys_center".equals(ocpApiGroup.getApiGroupLevel())) {
ocpApiGroup.setApiGroupLevel("api_group");
}
if (StringUtils.isBlank(ocpApiGroup.getApiGroupLevel())){
if (StringUtils.isBlank(ocpApiGroup.getApiGroupLevel())) {
ocpApiGroup.setApiGroupLevel("Middleground");
}
mapper.insert(ocpApi);
......@@ -135,17 +135,13 @@ 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())) {
List<OcpApiGroup> list = mapper.selectGroupPcode();
if (list.size() >= 1) {
flag = false;
}
}
if (flag) {
mapper.deleteById(objId);
}
......@@ -164,15 +160,15 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper, OcpApiG
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);
} 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()));
qw.eq(OcpApiGroup::getApiGroupPromotionType, pageGroupDto.getApiGroupPromotionType()).and(c -> c.eq(OcpApiGroup::getApiGroupPcode, pageGroupDto.getApiGroupCode()));
pageInfo.setRecords(ocpApiGroups);
mapper.selectPage(pageInfo,qw);
mapper.selectPage(pageInfo, qw);
List<OcpApiGroup> records = pageInfo.getRecords();
for (OcpApiGroup record : records) {
OcpApiGroup ocpApiGroup = mapper.selectCode(record.getApiGroupPcode());
......@@ -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()))
.and(c->c.eq(OcpApiGroup::getApiGroupPcode, pageGroupDto.getApiGroupCode()));
.and(c -> c.eq(OcpApiGroup::getApiGroupPcode, pageGroupDto.getApiGroupCode()));
mapper.selectPage(pageInfo, ocpTenantGroupLambdaQueryWrapper);
}
return pageInfo;
}
}
......
......@@ -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
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