24 lines
975 B
XML
24 lines
975 B
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"https://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.car.mapper.PaymentMapper">
|
|
<resultMap id="PaymentMap" type="com.car.entity.Payment">
|
|
<id column="id" property="id"/>
|
|
<result column="order_id" property="orderId"/>
|
|
<result column="user_id" property="userId"/>
|
|
<result column="amount" property="amount"/>
|
|
<result column="type" property="type"/>
|
|
<result column="created_at" property="createdAt"/>
|
|
</resultMap>
|
|
|
|
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
|
|
insert into payments(order_id, user_id, amount, type, created_at)
|
|
values (#{orderId}, #{userId}, #{amount}, #{type}, now())
|
|
</insert>
|
|
|
|
<select id="findByUserId" resultMap="PaymentMap">
|
|
select * from payments where user_id = #{userId} order by id desc
|
|
</select>
|
|
</mapper>
|