我使用mybatis操作pgsql数据库,查询语句如下:
<select id="selectMovieListByActorId" parameterType="java.lang.Integer" resultType="team.first.movie_api.domain.Movie">
select * from movie_db.movie where id in (
select movie_id from movie_with_actor where actor_id = ${id,jdbcType=INTEGER})
</select>
我的mapper文件方法是List<Movie> selectMovieListByActorId(Integer id);
### Error querying database. Cause: org.postgresql.util.PSQLException: 错误: 操作符不存在: character varying = integer
建议:没有匹配指定名称和参数类型的操作符. 您也许需要增加明确的类型转换.
位置:107
### The error may exist in file [E:\实用数据库开发\project\movie-api-boot\target\classes\mapper\ActorMapper.xml]
### The error may involve team.first.movie_api.mapper.ActorMapper.selectMovieListByActorId-Inline
### The error occurred while setting parameters
### SQL: select * from movie_db.movie where id in (select movie_id from movie_with_actor where actor_id = 1031862)
### Cause: org.postgresql.util.PSQLException: 错误: 操作符不存在: character varying = integer
建议:没有匹配指定名称和参数类型的操作符. 您也许需要增加明确的类型转换.
位置:107
将传参部分${} 换为 #{}还是报同样的错,这两个表中的这几个属性均为integer类型,没有varchar类型,为什么会报这个错呢?