Skip to content

Commit 9be8e8e

Browse files
committed
Fix eq operator error while compiling
1 parent c72817b commit 9be8e8e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

core/src/main/java/com/github/braisdom/objsql/apt/QueryMethodCodeGenerator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void handle(AnnotationValues annotationValues, JCTree ast, APTBuilder apt
3737
statementBuilder.append(String.class, "columnName", Tables.class, "getColumnName",
3838
aptBuilder.classRef(aptBuilder.getClassName()), treeMaker.Literal(field.getName().toString()));
3939
JCTree.JCExpression stringFormatExpression = aptBuilder.staticMethodCall(String.class,
40-
"format", treeMaker.Literal("%s = ?"), treeMaker.Literal(field.name.toString()));
40+
"format", treeMaker.Literal("%s = ?"), aptBuilder.varRef("columnName"));
4141
statementBuilder.append("query", "where",
4242
List.of(stringFormatExpression, aptBuilder.varRef("value")));
4343

core/src/main/java/com/github/braisdom/objsql/javac/JCBinarys.java

+7
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class JCBinarys {
4444
private static final String OPERATOR_LE = "LE";
4545
private static final String OPERATOR_GT = "GT";
4646
private static final String OPERATOR_GE = "GE";
47+
private static final String OPERATOR_EQ = "EQ";
4748

4849
// ==================== for PLUS operation =============
4950
public static String plus(String lhs, Object rhs) {
@@ -1168,6 +1169,10 @@ public static boolean or(boolean lhs, boolean rhs) {
11681169
return lhs || rhs;
11691170
}
11701171

1172+
public static boolean eq(Object lhs, Object rhs) {
1173+
return lhs == rhs;
1174+
}
1175+
11711176
// ==================== for parens =============
11721177

11731178
public static boolean parens(boolean expValue) {
@@ -1278,6 +1283,8 @@ public static String getOperatorMethodName(String operatorName) {
12781283
return "and";
12791284
case OPERATOR_OR:
12801285
return "or";
1286+
case OPERATOR_EQ:
1287+
return "eq";
12811288
}
12821289
return null;
12831290
}

0 commit comments

Comments
 (0)