<?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"> <mapper namespace="com.sincre.springboot.mapper.UserMapper"> <select id="login" resultType="com.sincre.springboot.model.User"> select * from "User" where username = #{userName} and password = #{password} </select> <insert id="register" parameterType="com.sincre.springboot.model.User" useGeneratedKeys="true"> <!--<selectKey keyProperty="id" resultType="int" order="BEFORE">--> -- SELECT LAST_INSERT_ID() AS ID <!--</selectKey>--> insert into "User"(username, password) VALUES (#{username},#{password}) </insert> <select id="isExit" parameterType="com.sincre.springboot.model.User" resultType="com.sincre.springboot.model.User"> select * from "User" where username = #{username} </select> </mapper>