|
@ -82,21 +82,24 @@ public class ResourceIntegratedService extends BaseJpaService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(readOnly = true)
|
|
|
public List<RsResource> findFileMasterList(String categoryId, String ids, String filters, String categoryCode) {
|
|
|
public List<RsResource> findFileMasterList(String categoryId, String ids, String filters, String categoryCode,String rs_interface) {
|
|
|
if(rs_interface==null){
|
|
|
rs_interface = "getMysqlData";
|
|
|
}
|
|
|
String sql;
|
|
|
if (filters != null) {
|
|
|
if (ids != null) {
|
|
|
sql = "SELECT rr.id, rr.code, rr.name, rr.category_id, rr.rs_interface, rr.grant_type FROM rs_resource rr ,rs_resource_category rrc WHERE" +
|
|
|
" rr.category_id=rrc.ID AND rrc. CODE = '" + categoryCode + "' " +
|
|
|
"AND rr.category_id = '" + categoryId + "' " +
|
|
|
"AND rr.rs_interface = 'getMysqlData' " +
|
|
|
"AND rr.rs_interface = '"+rs_interface+"' " +
|
|
|
"AND (rr.id IN (" + ids + ")) " + "OR rr.grant_type = '0') " +
|
|
|
"AND rr.name like " + "'%" + filters + "%'";
|
|
|
} else {
|
|
|
sql = "SELECT rr.id, rr.code, rr.name, rr.category_id, rr.rs_interface, rr.grant_type FROM rs_resource rr ,rs_resource_category rrc WHERE" +
|
|
|
" rr.category_id=rrc.ID AND rrc. CODE = '" + categoryCode + "' " +
|
|
|
"AND rr.category_id = '" + categoryId + "'" +
|
|
|
"AND rr.rs_interface = 'getMysqlData' " +
|
|
|
"AND rr.rs_interface = '"+rs_interface+"' " +
|
|
|
"AND rr.name like " + "'%" + filters + "%'";
|
|
|
}
|
|
|
} else {
|
|
@ -104,13 +107,13 @@ public class ResourceIntegratedService extends BaseJpaService {
|
|
|
sql = "SELECT rr.id, rr.code, rr.name, rr.category_id, rr.rs_interface, rr.grant_type FROM rs_resource rr ,rs_resource_category rrc WHERE" +
|
|
|
" rr.category_id=rrc.ID AND rrc. CODE = '" + categoryCode + "' " +
|
|
|
"AND rr.category_id = '" + categoryId + "'" +
|
|
|
"AND rr.rs_interface = 'getMysqlData' " +
|
|
|
"AND rr.rs_interface = '"+rs_interface+"' " +
|
|
|
"AND rr.id IN (" + ids + ")) " + "OR rr.grant_type = '0') ";
|
|
|
} else {
|
|
|
sql = "SELECT rr.id, rr.code, rr.name, rr.category_id, rr.rs_interface, rr.grant_type FROM rs_resource rr ,rs_resource_category rrc WHERE" +
|
|
|
" rr.category_id=rrc.ID AND rrc. CODE = '" + categoryCode + "' " +
|
|
|
"AND rr.category_id = '" + categoryId + "'" +
|
|
|
"AND rr.rs_interface = 'getMysqlData'";
|
|
|
"AND rr.rs_interface = '"+rs_interface+"' ";
|
|
|
}
|
|
|
}
|
|
|
RowMapper rowMapper = BeanPropertyRowMapper.newInstance(RsResource.class);
|
|
@ -383,9 +386,13 @@ public class ResourceIntegratedService extends BaseJpaService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(readOnly = true)
|
|
|
public List<Map<String, Object>> metadata(String categoryId, String filters) throws Exception {
|
|
|
public List<Map<String, Object>> metadata(String categoryId, String filters,String dataSource) throws Exception {
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
List<RsResource> rrList = findFileMasterList(categoryId, null, filters, "standard");
|
|
|
String rs_interface = "getMysqlData";
|
|
|
if("2".equals(dataSource)){
|
|
|
rs_interface = "getMysqlStatistics";
|
|
|
}
|
|
|
List<RsResource> rrList = findFileMasterList(categoryId, null, filters, "standard",rs_interface);
|
|
|
|
|
|
if (rrList != null) {
|
|
|
for (RsResource rsResources : rrList) {
|
|
@ -427,7 +434,7 @@ public class ResourceIntegratedService extends BaseJpaService {
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
List<RsResource> rrList;
|
|
|
if (userResource.equals("*")) {
|
|
|
rrList = findFileMasterList(categoryId, null, filters, categoryCode);
|
|
|
rrList = findFileMasterList(categoryId, null, filters, categoryCode,null);
|
|
|
} else {
|
|
|
//授权资源
|
|
|
List<String> userResourceList = objectMapper.readValue(userResource, List.class);
|
|
@ -439,9 +446,9 @@ public class ResourceIntegratedService extends BaseJpaService {
|
|
|
}
|
|
|
String ids = builder.toString();
|
|
|
if (StringUtils.isEmpty(ids)) {
|
|
|
rrList = findFileMasterList(categoryId, "''", filters, categoryCode);
|
|
|
rrList = findFileMasterList(categoryId, "''", filters, categoryCode,null);
|
|
|
} else {
|
|
|
rrList = findFileMasterList(categoryId, ids.substring(0, ids.length() - 1), filters, categoryCode);
|
|
|
rrList = findFileMasterList(categoryId, ids.substring(0, ids.length() - 1), filters, categoryCode,null);
|
|
|
}
|
|
|
}
|
|
|
if (rrList != null) {
|