(一)XML映射语句:
接口方法:
User selectById(String uid);
xml映射sql语句:
<select id="selectById" resultType="user">
select *
from user
where uid = #{uid};
</select>
测试结果:
(二)注解开发:
接口方法:
@Select("select * from user where uid = #{uid}")
User selectById(String uid);
调用接口方法进行测试:
MyBatis基本知识分享到此,可进入个人主页观看连续的知识阶段分享!后续将持续更新!