<?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类(原来的dao) -->
<mapper namespace="cn.cnyasin.dao.UserMapper">
<!--
id:一个id对应一个方法
resultType:返回一个结果
resultMap:返回多个结果
-->
<select id="getOne" resultType="cn.cnyasin.pojo.User">
select * from user where id = #{id}
</select>
<insert id="addOne" parameterType="cn.cnyasin.pojo.User">
insert into user (`username`,`email`,`password`,`created_at`) values (#{username}, #{email}, #{password}, #{created_at})
</insert>
<update id="updateOne" parameterType="cn.cnyasin.pojo.User">
update user set balance = #{balance} where id = #{id};
</update>
<delete id="deleteOne">
delete from user where id = #{id}
</delete>
<resultMap id="userListMap" type="cn.cnyasin.pojo.User"/>
</mapper>