Mybatis映射文件中对数据进行操作的一些注意点

<mapper namespace="">

<!-- 命名空间,进行操作时需要命名空间外加sql的id-->

</mapper>

<select id="" resultType=""></select>

select语句中必须有resultType属性,即返回类型,可以对应的实体类或者int等类型

<insert id=""  parameterType="">

insert语句中要有参入数据的参数类型

主义#和$,#防止sql注入攻击,$一般用在表名等地方

<update id=""></update>

可以只有一个id属性

<delete id=""  parameterType="">

  delete from user where id=#{id}

</delete>

要跟传入的参数类型

待完善,持续更新

猜你喜欢

转载自www.cnblogs.com/l-x-x-y-d-j/p/10225156.html