多个参数用 Map, 或者注解
- 接口
public interface UserDao { | |
// map 查询数据 | |
User getUserById1(Map<String,Object> map); | |
} |
- UserDaoMapper.xml
<!-- 多个参数 --> | |
<select id="getUserById1" parameterType="map" resultType="com.dkx.mybatis.pojo.User"> | |
select * from mybatis.user where id = #{userId} and name = #{userName}; | |
</select> |