@@ -24,7 +24,7 @@ public class SQL {
2424 * @return
2525 */
2626 public static String isNull (boolean isNull ) {
27- return " is " + (isNull ? "" : " not " ) + " null " ;
27+ return "is " + (isNull ? "" : " not" ) + " null" ;
2828 }
2929 /**
3030 * trim = false
@@ -45,14 +45,14 @@ public static String isEmpty(String s, boolean isEmpty, boolean trim) {
4545 if (trim ) {
4646 s = trim (s );
4747 }
48- return lengthCompare (s , (isEmpty ? ">" : "<=" ) + "0 " );
48+ return lengthCompare (s , (isEmpty ? ">" : "<=" ) + "0" );
4949 }
5050 /**
5151 * @param s 因为POWER(x,y)等函数含有不只一个key,所以需要客户端添加进去,服务端检测到条件中有'('和')'时就不转换,直接当SQL语句查询
5252 * @return
5353 */
5454 public static String lengthCompare (String s , String compare ) {
55- return length (s ) + compare + " " ;
55+ return length (s ) + compare ;
5656 }
5757
5858
@@ -61,36 +61,36 @@ public static String lengthCompare(String s, String compare) {
6161 * @return
6262 */
6363 public static String length (String s ) {
64- return " length(" + s + ") " ;
64+ return "length(" + s + ")" ;
6565 }
6666 /**
6767 * @param s 因为POWER(x,y)等函数含有不只一个key,所以需要客户端添加进去,服务端检测到条件中有'('和')'时就不转换,直接当SQL语句查询
6868 * @return
6969 */
7070 public static String charLength (String s ) {
71- return " char_length(" + s + ") " ;
71+ return "char_length(" + s + ")" ;
7272 }
7373
7474 /**
7575 * @param s
7676 * @return
7777 */
7878 public static String trim (String s ) {
79- return " trim(" + s + ") " ;
79+ return "trim(" + s + ")" ;
8080 }
8181 /**
8282 * @param s
8383 * @return
8484 */
8585 public static String trimLeft (String s ) {
86- return " ltrim(" + s + ") " ;
86+ return "ltrim(" + s + ")" ;
8787 }
8888 /**
8989 * @param s
9090 * @return
9191 */
9292 public static String trimRight (String s ) {
93- return " rtrim(" + s + ") " ;
93+ return "rtrim(" + s + ")" ;
9494 }
9595
9696 /**
@@ -99,15 +99,15 @@ public static String trimRight(String s) {
9999 * @return
100100 */
101101 public static String left (String s , int n ) {
102- return " left(" + s + "," + n + ") " ;
102+ return "left(" + s + "," + n + ")" ;
103103 }
104104 /**
105105 * @param s
106106 * @param n
107107 * @return
108108 */
109109 public static String right (String s , int n ) {
110- return " right(" + s + "," + n + ") " ;
110+ return "right(" + s + "," + n + ")" ;
111111 }
112112
113113 /**
@@ -117,7 +117,7 @@ public static String right(String s, int n) {
117117 * @return
118118 */
119119 public static String subString (String s , int start , int end ) {
120- return " substring(" + s + "," + start + "," + (end -start ) + ") " ;
120+ return "substring(" + s + "," + start + "," + (end -start ) + ")" ;
121121 }
122122
123123 /**
@@ -126,7 +126,7 @@ public static String subString(String s, int start, int end) {
126126 * @return
127127 */
128128 public static String indexOf (String s , String c ) {
129- return " instr(" + s + "," + c + ") " ;
129+ return "instr(" + s + "," + c + ")" ;
130130 }
131131
132132 /**
@@ -136,7 +136,7 @@ public static String indexOf(String s, String c) {
136136 * @return
137137 */
138138 public static String replace (String s , String c1 , String c2 ) {
139- return " replace(" + s + "," + c1 + "," + c2 + ") " ;
139+ return "replace(" + s + "," + c1 + "," + c2 + ")" ;
140140 }
141141
142142 /**
@@ -145,22 +145,22 @@ public static String replace(String s, String c1, String c2) {
145145 * @return
146146 */
147147 public static String equals (String s1 , String s2 ) {
148- return " strcmp(" + s1 + "," + s2 + ") " ;
148+ return "strcmp(" + s1 + "," + s2 + ")" ;
149149 }
150150
151151 /**
152152 * @param s
153153 * @return
154154 */
155155 public static String toUpperCase (String s ) {
156- return " upper(" + s + ") " ;
156+ return "upper(" + s + ")" ;
157157 }
158158 /**
159159 * @param s
160160 * @return
161161 */
162162 public static String toLowerCase (String s ) {
163- return " lower(" + s + ") " ;
163+ return "lower(" + s + ")" ;
164164 }
165165
166166
0 commit comments