@@ -79,7 +79,7 @@ public abstract class AbstractSQLConfig implements SQLConfig {
7979
8080 private long id ; //Table的id
8181 private RequestMethod method ; //操作方法
82- private boolean prepared ; //预编译
82+ private boolean prepared = true ; //预编译
8383 /**
8484 * TODO 被关联的表通过就忽略关联的表?(这个不行 User:{"sex@":"/Comment/toId"})
8585 */
@@ -132,11 +132,14 @@ public AbstractSQLConfig setMethod(RequestMethod method) {
132132 this .method = method ;
133133 return this ;
134134 }
135+ @ Override
135136 public boolean isPrepared () {
136137 return prepared ;
137138 }
138- public void setPrepared (boolean prepared ) {
139+ @ Override
140+ public AbstractSQLConfig setPrepared (boolean prepared ) {
139141 this .prepared = prepared ;
142+ return this ;
140143 }
141144
142145
@@ -248,7 +251,13 @@ public AbstractSQLConfig setHaving(String having) {
248251 @ JSONField (serialize = false )
249252 public String getHavingString () {
250253 having = StringUtil .getTrimedString (having );
251- return having .isEmpty () ? "" : " HAVING " + having ;
254+ if (having .isEmpty ()) {
255+ return "" ;
256+ }
257+ if (isPrepared ()) {
258+ throw new UnsupportedOperationException ("预编译模式下不允许传 @having:\" condition\" !" );
259+ }
260+ return " HAVING " + having ;
252261 }
253262
254263 @ Override
@@ -646,7 +655,7 @@ private Object getValue(@NotNull Object value) {
646655 return "'" + value + "'" ;
647656 }
648657 @ Override
649- public List <Object > getPreparedValues () {
658+ public List <Object > getPreparedValueList () {
650659 return preparedValues ;
651660 }
652661
@@ -797,6 +806,11 @@ public String getRangeString(String key, Object range) throws Exception {
797806 if (condition .isEmpty ()) {
798807 return "" ;
799808 }
809+
810+ if (isPrepared ()) {
811+ throw new UnsupportedOperationException ("预编译模式下不允许传 key{}:\" condition\" !" );
812+ }
813+
800814 return getCondition (logic .isNot (), condition );
801815 }
802816
@@ -999,8 +1013,7 @@ public static String getRemoveString(String key, Object value) throws IllegalArg
9991013 @ JSONField (serialize = false )
10001014 @ Override
10011015 public String getSQL (boolean prepared ) throws Exception {
1002- setPrepared (prepared );
1003- return getSQL (this );
1016+ return getSQL (this .setPrepared (prepared ));
10041017 }
10051018 /**
10061019 * @param config
0 commit comments