门户搜索修改

This commit is contained in:
dinggang 2022-05-12 18:10:13 +08:00
parent 77628f982b
commit 9e155eaf73
3 changed files with 24 additions and 10 deletions

View File

@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -60,7 +61,7 @@ public class ApiGatewayService {
throw new IllegalArgumentException(String.format("未找到对应的资源id:%s", resourceId));
}
String apiUrl = resourceEntity.getApiUrl();
String methods = resourceEntity.getApiMethodType().toUpperCase();
String methods = resourceEntity.getApiMethodType();
if (StringUtils.isBlank(apiUrl) || StringUtils.isBlank(methods)){
String msg = String.format("注册api参数为空跳过 apiUrl:%s, methods:%s, resourceId:%s", apiUrl, methods, resourceId);
@ -68,7 +69,7 @@ public class ApiGatewayService {
log.info(msg);
return;
}
methods = methods.toUpperCase(Locale.ROOT);
//建group
String domain = getIP(apiUrl);
String uris = apiUrl.substring(apiUrl.indexOf(domain) + domain.length());

View File

@ -69,15 +69,18 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
wrapper.like(StringUtils.isNotBlank(params.get("name").toString()), "name", params.get("name").toString());
break;
case "creator":
wrapper.eq(StringUtils.isNotBlank(params.get("creator").toString()), "creator", params.get("creator").toString());
wrapper.eq(StringUtils.isNotBlank(params.get("creator").toString()), "creator", params.get("creator").toString())
.ne("del_flag", 1);
break;
case "del_flag":
wrapper.eq("del_flag", params.get("del_flag"));
break;
}
});
wrapper.orderByDesc("create_date");
if (!params.containsKey("creator")) { // 创建者查询时
wrapper.eq("del_flag", params.get("del_flag") == null ? 0 : Integer.valueOf(params.get("del_flag").toString()));
}
//if (!params.containsKey("creator") || StringUtils.isEmpty(params.get("creator").toString())) { // 创建者查询时
// wrapper.ne("del_flag", 1);
//}
return wrapper;
}
@ -302,7 +305,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
HashMap<String, Object> resourceMap = new HashMap<>();
resourceMap.put("type", "全部能力目录");
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("del_flag", 0).eq("type", jsonObject.getString("type"));
queryWrapper.eq("del_flag", 0).eq(StringUtils.isNotBlank(jsonObject.getString("type")),"type", jsonObject.getString("type"));
resourceMap.put("total", resourceDao.selectCount(queryWrapper));
//resourceMap.put("dataList", resourceDao.selectList(queryWrapper));
resultList.add(resourceMap);
@ -313,6 +316,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
HashMap<Object, Object> map = new HashMap<>();
map.put("type", item.getKey());
map.put("total", resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type")));
item.getValue().stream().forEach(item1 -> {
item1.remove("type");
});
map.put("dataList", item.getValue());
resultList.add(map);
});

View File

@ -330,7 +330,11 @@
sd.id AS "deptId"
FROM
sys_dept sd
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 AND type = #{type} GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0
<if test="type != null and type != ''">
AND type = #{type}
</if>
GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id
) temp1
WHERE
1 = 1
@ -352,7 +356,10 @@
IFNULL( tdr.deptCount, 0 ) AS "deptCount"
FROM
sys_dept sd
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 AND type = #{resourceType} GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0
<if test="resourceType != null and resourceType != ''">
AND type = #{resourceType}
</if> GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id
) temp1
WHERE
1 = 1