猿问
下载APP

ssm框架,mybatis的select语句传递多个参数报错?

持久层:

<select id="get" resultType="People">

    select * from #{identity} where id= #{id}

    </select>

People get(@Param("identity") String identity,@Param("id") String id);

service层:

People get(String identity,String id);

@Override

public People get(String identity,String id) {

return peopleMapper.get(identity,id);

}

controller层:

p2=peopleService.get(p.getIdentity(),p.getId());

报错信息:

https://img1.mukewang.com/5c52aadf0001369915120590.jpg

qq_MEGALOVANIA_0
浏览 387回答 1
1回答

cxxyjsj

identity要使用${identity},不然无法识别成表名,导致sql语法错误
打开App,查看更多内容
随时随地看视频慕课网APP
我要回答