User getUserInfo(Integer userId,String sex);
mapper.xml:
select userId
from users
where userId=#{0} and sex=#{1};
--------------------------------------------------------------------------------------
第三种情形,传入多个参数 userId,sex 使用注解@Param :
service层:
@Override
public User getUserInfo(Integer userId,String sex) {
User user = userMapper.getUserInfo(userId,sex);
//省略 业务代码…
return user;
}
mapper层:
User getUserInfo(@Param(“userId”)Integer userId,@Param(“sex”)String sex);
mapper.xml:
select userId
from users
where userId=#{userId} and sex=#{sex};
\
《一线大厂Java面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义》
【docs.qq.com/doc/DSmxTbFJ1cmN1R2dB】 完