门户搜索修改

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 org.springframework.web.client.RestTemplate;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -60,7 +61,7 @@ public class ApiGatewayService {
throw new IllegalArgumentException(String.format("未找到对应的资源id:%s", resourceId)); throw new IllegalArgumentException(String.format("未找到对应的资源id:%s", resourceId));
} }
String apiUrl = resourceEntity.getApiUrl(); String apiUrl = resourceEntity.getApiUrl();
String methods = resourceEntity.getApiMethodType().toUpperCase(); String methods = resourceEntity.getApiMethodType();
if (StringUtils.isBlank(apiUrl) || StringUtils.isBlank(methods)){ if (StringUtils.isBlank(apiUrl) || StringUtils.isBlank(methods)){
String msg = String.format("注册api参数为空跳过 apiUrl:%s, methods:%s, resourceId:%s", apiUrl, methods, resourceId); String msg = String.format("注册api参数为空跳过 apiUrl:%s, methods:%s, resourceId:%s", apiUrl, methods, resourceId);
@ -68,7 +69,7 @@ public class ApiGatewayService {
log.info(msg); log.info(msg);
return; return;
} }
methods = methods.toUpperCase(Locale.ROOT);
//建group //建group
String domain = getIP(apiUrl); String domain = getIP(apiUrl);
String uris = apiUrl.substring(apiUrl.indexOf(domain) + domain.length()); 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()); wrapper.like(StringUtils.isNotBlank(params.get("name").toString()), "name", params.get("name").toString());
break; break;
case "creator": 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; break;
} }
}); });
wrapper.orderByDesc("create_date"); wrapper.orderByDesc("create_date");
if (!params.containsKey("creator")) { // 创建者查询时 //if (!params.containsKey("creator") || StringUtils.isEmpty(params.get("creator").toString())) { // 创建者查询时
wrapper.eq("del_flag", params.get("del_flag") == null ? 0 : Integer.valueOf(params.get("del_flag").toString())); // wrapper.ne("del_flag", 1);
} //}
return wrapper; return wrapper;
} }
@ -302,7 +305,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
HashMap<String, Object> resourceMap = new HashMap<>(); HashMap<String, Object> resourceMap = new HashMap<>();
resourceMap.put("type", "全部能力目录"); resourceMap.put("type", "全部能力目录");
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>(); 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("total", resourceDao.selectCount(queryWrapper));
//resourceMap.put("dataList", resourceDao.selectList(queryWrapper)); //resourceMap.put("dataList", resourceDao.selectList(queryWrapper));
resultList.add(resourceMap); resultList.add(resourceMap);
@ -313,6 +316,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
HashMap<Object, Object> map = new HashMap<>(); HashMap<Object, Object> map = new HashMap<>();
map.put("type", item.getKey()); map.put("type", item.getKey());
map.put("total", resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type"))); map.put("total", resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type")));
item.getValue().stream().forEach(item1 -> {
item1.remove("type");
});
map.put("dataList", item.getValue()); map.put("dataList", item.getValue());
resultList.add(map); resultList.add(map);
}); });

View File

@ -330,7 +330,11 @@
sd.id AS "deptId" sd.id AS "deptId"
FROM FROM
sys_dept sd 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 ) temp1
WHERE WHERE
1 = 1 1 = 1
@ -352,7 +356,10 @@
IFNULL( tdr.deptCount, 0 ) AS "deptCount" IFNULL( tdr.deptCount, 0 ) AS "deptCount"
FROM FROM
sys_dept sd 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 ) temp1
WHERE WHERE
1 = 1 1 = 1