mitao
2025-03-14 392b42c4891cf2e6beda57ab32c51598f290f4b7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?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.ruoyi.seatademo.mapper.OrderMapper">
 
  <resultMap type="Order" id="OrderResult">
    <id     property="id"              column="id"                />
    <result property="userId"          column="user_id"           />
    <result property="productId"       column="product_id"        />
    <result property="amount"          column="amount"            />
    <result property="totalPrice"      column="total_price"       />
    <result property="status"          column="status"            />
    <result property="addTime"         column="add_time"          />
    <result property="lastUpdateTime"  column="last_update_time"  />
  </resultMap>
 
  <insert id="insert" parameterType="Order" useGeneratedKeys="true" keyProperty="id">
    insert into p_order (
    <if test="userId != null and userId != '' ">user_id,</if>
    <if test="productId != null and productId != '' ">product_id,</if>
    <if test="amount != null and amount != '' ">amount,</if>
    <if test="totalPrice != null and totalPrice != '' ">total_price,</if>
    <if test="status != null and status != ''">status,</if>
    add_time
    )values(
    <if test="userId != null and userId != ''">#{userId},</if>
    <if test="productId != null and productId != ''">#{productId},</if>
    <if test="amount != null and amount != ''">#{amount},</if>
    <if test="totalPrice != null and totalPrice != ''">#{totalPrice},</if>
    <if test="status != null and status != ''">#{status},</if>
    sysdate()
    )
  </insert>
 
  <update id="updateById" parameterType="Order">
    update p_order
    <set>
      <if test="userId != null and userId != ''">user_id = #{userId},</if>
      <if test="productId != null and productId != ''">product_id = #{productId},</if>
      <if test="amount != null and amount != ''">amount = #{amount},</if>
      <if test="totalPrice != null and totalPrice != ''">total_price = #{totalPrice},</if>
      <if test="status != null and status != ''">status = #{status},</if>
      last_update_time = sysdate()
    </set>
    where id = #{id}
  </update>
 
</mapper>