该错误是MySQL数据库,拼接SQL语句执行时,条件字符串传值时未加引号导致。
比如:以下方法调用时需要传入两个参数:查询列、条件列
fun getString(column: String, conditions: String):String = this.connection.prepareStatement("select $column from ${this.name} where $conditions limit 1").executeQuery().getString()
调用:条件传值时,需要拼接上双引号
val mainTable = connection.table("sys_user")val mainId = mainTable.getString("id","area="+'"'+entity.area+'"'+" and type="+'"'+entity.code+'"')