Commit c0d91f59 by qiuchaofei

1,模糊匹配接口添加偏移量,用于分页。

parent a3ebcc2b
......@@ -113,12 +113,13 @@ public class MetaDataController {
*/
@ApiOperation(tags = "", value = "模糊匹配输入结果,不区分大小写")
@RequestMapping(path = "/autoMatchByInput", method = RequestMethod.GET)
public Map<String,String> getAutoMatchByInput(String name,String count) {
public Map<String,String> getAutoMatchByInput(String name,String count,String offset) {
if(count == null || count .equals("")){
count = "1000";
}
Integer returnCount = Integer.valueOf(count);
return metadataService.getAutoMatchByInput(name,returnCount);
int offsetInt = Integer.valueOf(offset);
int countInt = Integer.valueOf(count);
return metadataService.getAutoMatchByInput(name,countInt,offsetInt);
}
......
......@@ -94,5 +94,5 @@ public interface IMetadataService {
List<TempNode> findAllTempNode();
Map<String, String> getAutoMatchByInput(String name,int returnCount);
Map<String, String> getAutoMatchByInput(String name,int countInt ,int offsetInt);
}
......@@ -450,7 +450,7 @@ public class MetadataServiceImpl implements IMetadataService {
@Override
public Map<String, String> getAutoMatchByInput(String name,int returnCount ) {
public Map<String, String> getAutoMatchByInput(String name,int countInt,int offsetInt) {
logger.info("开始模糊查找:" + name);
Map<String, String> metadataId2Name = new HashMap<>();
......@@ -458,7 +458,7 @@ public class MetadataServiceImpl implements IMetadataService {
Driver neo4jConnection = neo4jConfig.getNeo4jConnection();
Session session = neo4jConnection.session();
//match (n:MetaData) where n.name=~'(?i).*APP.*' return n
String cypher ="match (n:MetaData) where n.name=~'(?i).*"+name+".*' return n";
String cypher ="match (n:MetaData) where n.name=~'(?i).*"+name+".*' return n skip "+offsetInt+" limit "+countInt;
//"match (n:MetaData ) where n.name =~\"" + name + ".*\" return n";
......@@ -468,7 +468,7 @@ public class MetadataServiceImpl implements IMetadataService {
int count = 0;
while(result.hasNext()){
if(count >=returnCount){
if(count >=countInt){
break;
}
count++;
......
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