欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

mapper.xml配置

程序员文章站 2022-04-22 10:41:55
...

mapper.xml配置

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
        
        <!-- namespace:命名空间,填写映射当前的Mapper接口-->
<mapper namespace="com.kuang.dao.UserMapper">

	    <!--查询-->
	    <select id="getUserList" resultType="com.kuang.pojo.User">
	         select * from mybatis.user
	     </select>
	    <!--查询-->
	    <select id="getUserById" parameterType="int" resultType="com.kuang.pojo.User">
	        select * from mybatis.user where id = #{id}
	    </select>
	    <!--增加-->
	    <insert id="addUser" parameterType="com.kuang.pojo.User" >
	        insert into mybatis.user (id, name, pwd) values (#{id},#{name},#{pwd});
	    </insert>
	    <!--修改-->
	    <update id="upDateUser" parameterType="com.kuang.pojo.User">
	        update mybatis.user set name = #{name} where id= #{id};
	    </update>
	    <!--删除-->
	    <delete id="deleteUser" parameterType="int">
	        delete from mybatis.user where id=#{id}
	    </delete>
</mapper>


相关标签: mybatis