sql代码
/* achievement.list.by.student.id */
SELECT
a.achievementScore,
b.student_name,
c.curriculum_name
FROM t_achievement a LEFT JOIN t_student b ON a.student_id = b.student_id
LEFT JOIN t_curriculum c ON a.curriculum_id = c.curriculum_id
WHERE a.student_id = @studentId
java代码
Sql sql = dao.sqls().create("achievement.list.by.student.id");
sql.setVar("studentId", 1);
sql.setCallback(Sqls.callback.records());
dao.execute(sql);
日志
2017-4-22 15:37:40.216 DEBUG [RMI TCP Connection(3)-127.0.0.1] SELECT
a.achievementScore,
b.student_name,
c.curriculum_name
FROM t_achievement a LEFT JOIN t_student b ON a.student_id = b.student_id
LEFT JOIN t_curriculum c ON a.curriculum_id = c.curriculum_id
WHERE a.student_id = ?
| 1 |
|------|
| NULL |
For example:> "SELECT
a.achievementScore,
b.student_name,
c.curriculum_name
FROM t_achievement a LEFT JOIN t_student b ON a.student_id = b.student_id
LEFT JOIN t_curriculum c ON a.curriculum_id = c.curriculum_id
WHERE a.student_id = 'NULL'"
我想传1,但是是null?为什么?