<?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.wzy.springcloud.dao.PaymentDao">
<!--useGeneratedKeys="true"插入数据成功后,返回 keyProperty="id" id-->
<insert id="create" parameterType="Payment" useGeneratedKeys="true" keyProperty="id">
insert into payment(serial) values(#{serial});
</insert>
<resultMap id="BaseResultMap" type="com.wzy.springcloud.Entities.Payment">
<!--column="serial"中的serial,会使用property="serial"中serial替换掉,防止serial有下划线-->
<id column="id" property="id" jdbcType="BIGINT"/>
<id column="serial" property="serial" jdbcType="VARCHAR"/>
</resultMap>
<!--resultMap="BaseResultMap" 结果映射,映射到上面resultMap。-->
<select id="getPaymentById" parameterType="Long" resultMap="BaseResultMap">
select * from payment where id=#{id};
</select>
</mapper>