Browse Source

1.增加oracle可以通过sequence生成id
2.增加忽略大小写以及特殊字符的查询条件

wangzhun 3 years ago
parent
commit
0670bd1140

+ 6 - 1
common-orm-mybatisplus/src/main/java/com/tofly/mybatisplus/config/MybatisKeyGenerator.java

@@ -27,7 +27,12 @@ public class MybatisKeyGenerator implements IKeyGenerator {
         String sql;
         switch (dbtype){
             case "oracle":
-                sql= "select nvl(max(id),0)+1 from "+incrementerName;
+                if(incrementerName.indexOf("_SEQ")!=-1){
+                    sql = "select "+ incrementerName+".nextval from dual";
+                }else{
+                    sql="select nvl(max(id),0)+1 from  "+incrementerName;
+                }
+
                 break;
             case "mysql":
                 sql="select IFNULL(max(id),0)+1 from  "+incrementerName;

+ 2 - 0
common-orm-mybatisplus/src/main/java/com/tofly/mybatisplus/config/ToflySqlCondition.java

@@ -6,4 +6,6 @@ package com.tofly.mybatisplus.config;
  */
 public class ToflySqlCondition {
     public static final  String LIKE="%s LIKE CONCAT(CONCAT('%%',#{%s}),'%%')";
+    public static final  String LIKEINGLORECASEANDSYMBOL="REGEXP_replace(upper(%s),'[^A-Z0-9]','') LIKE CONCAT(CONCAT('%%',REGEXP_replace(upper(#{%s}),'[^A-Z0-9]','')),'%%')";
+   // public static final  String LIKEINGLORECASEANDSYMBOL=" REGEXP_replace(UPPER(%s),'[^A-Z0-9]','') LIKE CONCAT(CONCAT('%%',REGEXP_replace(UPPER(#{%s}),'[^A-Z0-9]','')),'%%')";
 }