-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support chinese pinyin search of mybatis flex for java generate template
- Loading branch information
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
.../tang-mybatis-flex/src/main/java/com/tang/extension/mybatisflex/query/QueryFunctions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.tang.extension.mybatisflex.query; | ||
|
||
import com.mybatisflex.core.query.FunctionQueryColumn; | ||
import com.mybatisflex.core.query.QueryColumn; | ||
import com.mybatisflex.core.util.LambdaGetter; | ||
import com.mybatisflex.core.util.LambdaUtil; | ||
import com.tang.extension.mybatisflex.constants.FuncName; | ||
|
||
/** | ||
* 自定义查询函数 | ||
* | ||
* @author Tang | ||
*/ | ||
public class QueryFunctions { | ||
|
||
private QueryFunctions() { | ||
} | ||
|
||
public static QueryColumn toPinyin(String columnX) { | ||
return new FunctionQueryColumn(FuncName.TO_PINYIN, columnX); | ||
} | ||
|
||
public static QueryColumn toPinyin(QueryColumn columnX) { | ||
return new FunctionQueryColumn(FuncName.TO_PINYIN, columnX); | ||
} | ||
|
||
public static <T> QueryColumn toPinyin(LambdaGetter<T> columnX) { | ||
return new FunctionQueryColumn(FuncName.TO_PINYIN, LambdaUtil.getQueryColumn(columnX)); | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
...on/tang-mybatis-flex/src/main/kotlin/com/tang/extension/mybatisflex/constants/FuncName.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.tang.extension.mybatisflex.constants | ||
|
||
/** | ||
* 自定义函数名 | ||
* | ||
* @author Tang | ||
*/ | ||
object FuncName { | ||
|
||
const val TO_PINYIN = "TO_PINYIN" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters