com.mybaits.jpa.sql.split.impl.SqlMethodSplitOr Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mybatis-jpa Show documentation
Show all versions of mybatis-jpa Show documentation
Mybaits JPA: a convenient development tool for mybatis puls
package com.mybaits.jpa.sql.split.impl;
import com.mybaits.jpa.jpaEnum.KeyWord;
import com.mybaits.jpa.sql.split.ISqlMethodSplit;
import java.util.ArrayList;
import java.util.List;
/**
* 处理jpa 方法名关键字
* Created by Administrator on 2019/12/20 0020.
*/
public class SqlMethodSplitOr implements ISqlMethodSplit {
@Override
public List sqlMethodSplit(List attributes) {
List cruxList=new ArrayList<>();
for (String attribute : attributes) {
if(attribute.equals(KeyWord.OrderBy.getValue())){
cruxList.add(attribute);
continue;
}
if(attribute.indexOf(KeyWord.Or.getValue())==-1){
cruxList.add(attribute);
continue;
}
String[] cruxs=attribute.split(KeyWord.Or.getValue());
if(cruxs.length>0){
int index=0;
for (String s : cruxs) {
if(index!=0){
cruxList.add(KeyWord.Or.getValue());
}
cruxList.add(s);
index++;
}
}
}
return cruxList;
}
}