mybatis 梳理9--别名

(1)思考:

<select id="getUsersByParams" resultType="java.util.HashMap">
select id,username,password from user where username = #{name}
</select>

resultType写成java.util.HashMap,也行写成map也行

 

说明mybatis内置很多别名:

 

 

 

(2)给自己类设定别名

 

 

 

小结:

map工作中及其常用,特别在多表查询中,字段又多又复杂。

大家一定学会合理使用map传参,不要一味的修改实体类,导致某些实体类过于臃肿。

 

posted @ 2021-01-21 12:23  Master_Sun  阅读(45)  评论(0编辑  收藏  举报