MyBatis's mapper.xml files are also added to the file header.

Source: Internet
Author: User

<?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" >
<!--Write SQL statements--
<mapper namespace= "Com.itheima.mybatis.mapper.UserMapper" >
<!--query one user by ID--
<select id= "Finduserbyid" parametertype= "Integer" resulttype= "User" >
SELECT * from user where id = #{v}
</select>

<!--//Fuzzy query user list based on user name
#{} select * FROM user where id =? Placeholder? = = ' Five '
${} select * from user where username like '% five ' string concatenation

-
<select id= "Finduserbyusername" parametertype= "String" resulttype= "Com.itheima.mybatis.pojo.User" >
SELECT * from user where username like "%" #{haha} "%"
</select>

<!--adding users--
<insert id= "Insertuser" parametertype= "Com.itheima.mybatis.pojo.User" >
<selectkey keyproperty= "id" resulttype= "Integer" order= "after" >
Select LAST_INSERT_ID ()
</selectKey>
Insert into User (Username,birthday,address,sex)
VALUES (#{username},#{birthday},#{address},#{sex})
</insert>

<!--update-
<update id= "Updateuserbyid" parametertype= "Com.itheima.mybatis.pojo.User" >
Update user
Set username = #{username},sex = #{sex},birthday = #{birthday},address = #{address}
WHERE id = #{id}
</update>

<!--removed-
<delete id= "Deleteuserbyid" parametertype= "Integer" >
Delete from user
WHERE id = #{vvvvv}
</delete>


</mapper>

MyBatis's mapper.xml files are also added to the file header.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.