Mybatis boolean和bit不对应 column “xxx“ is of type bit but expression is of type boolean

tech2024-04-14  11

Mybatis boolean和bit不对应 column “xxx” is of type bit but expression is of type boolean

“xxx”列的类型为bit,但expression的类型为boolean

我用的是postgreSql.

Mybatis可以这样操作 来避免boolean和bit不对应的问题

插入 更新 查询都可以按这个思路

原始sql temp实体为boolean类型 数据库为bit类型

UPDATE "A01" <set> <!-- ... --> <if test="temp != null "> temp= #{temp}, </if> </set> where id= #{id}

改为

UPDATE "A01" <set> <!-- ... --> <if test="temp != null "> <if test="temp "> temp= '1' </if> <if test="! temp"> temp= '0' </if> , </if> </set> where id= #{id}
最新回复(0)