<!--我们规定Mapper配置文件,根标签用mapper,并且需要提供一个此配置文件的唯一标识,namespace。
有了namespace,我们mapper标签中配置的内容就可以重复,而不用每个Mapper配置文件,都得起不一样的名字--><mappernamespace="bank"><!--通过select标签封装查询sql语句,同样每一条sql,都需要有唯一标识,我们就通过namespace.id的形式标识吧。
- 最终我们解析的时候就统一用statementId来封装
- 同样的我们也得标识,最终查询出来的结果集如何封装,通过resultType指定--><selectid="selectList"resultType="com.yzpnb.entity.Account">
select * from account
</select><!--而对于动态参数,我们也需要封装,通过paramterType指定。并且我们人为规定,用#{属性名}的形式来使用
select * from account where id = ? ==转变为==> select * from account where id = #{id}--><selectid="selectOne"resultType="com.yzpnb.entity.Account"paramterType="com.yzpnb.entity.Account">
select * from account where id = #{id}
</select></mapper>