<?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="org.hongxi.whatsmars.shardingsphere.repository.OrderRepository">
    <update id="createIfNotExistsTable">
        CREATE TABLE IF NOT EXISTS t_order (order_id BIGINT AUTO_INCREMENT, user_id INT NOT NULL, status VARCHAR(50), PRIMARY KEY (order_id));
    </update>

    <update id="truncateTable">
        TRUNCATE TABLE t_order;
    </update>
    
    <update id="dropTable">
        DROP TABLE IF EXISTS t_order;
    </update>
    
    <insert id="insert" useGeneratedKeys="true" keyProperty="orderId">
        INSERT INTO t_order (
          user_id, status
        )
        VALUES (
        #{userId,jdbcType=INTEGER},
        #{status,jdbcType=VARCHAR}
        )
    </insert>
    
    <delete id="delete">
        DELETE FROM t_order WHERE order_id = #{orderId,jdbcType=INTEGER}
    </delete>
</mapper>
