|
|
|
@ -0,0 +1,44 @@
|
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
<!-- 定义XML文档类型为MyBatis的mapper,指定了DTD的URL -->
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<!-- 定义了一个mapper元素,指定了namespace,这个namespace对应于Mapper接口的全路径 -->
|
|
|
|
|
<mapper namespace="com.yami.shop.dao.OrderItemMapper">
|
|
|
|
|
<!-- 定义了一个resultMap,用于将数据库结果集的列映射到Java对象的属性 -->
|
|
|
|
|
<resultMap id="BaseResultMap" type="com.yami.shop.bean.model.OrderItem">
|
|
|
|
|
<!--
|
|
|
|
|
这是一个警告注释,由MyBatis Generator自动生成。
|
|
|
|
|
@mbg.generated 表示这个resultMap是由MyBatis Generator工具自动生成的,警告开发者不要手动修改。
|
|
|
|
|
-->
|
|
|
|
|
<id column="order_item_id" jdbcType="BIGINT" property="orderItemId" />
|
|
|
|
|
<result column="shop_id" jdbcType="BIGINT" property="shopId" />
|
|
|
|
|
<result column="order_number" jdbcType="VARCHAR" property="orderNumber" />
|
|
|
|
|
<result column="prod_id" jdbcType="BIGINT" property="prodId" />
|
|
|
|
|
<result column="sku_id" jdbcType="BIGINT" property="skuId" />
|
|
|
|
|
<result column="prod_count" jdbcType="INTEGER" property="prodCount" />
|
|
|
|
|
<result column="prod_name" jdbcType="VARCHAR" property="prodName" />
|
|
|
|
|
<result column="pic" jdbcType="VARCHAR" property="pic" />
|
|
|
|
|
<result column="price" jdbcType="DECIMAL" property="price" />
|
|
|
|
|
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
|
|
|
|
<result column="product_total_amount" jdbcType="DECIMAL" property="productTotalAmount" />
|
|
|
|
|
<result column="rec_time" jdbcType="TIMESTAMP" property="recTime" />
|
|
|
|
|
<result column="comm_sts" jdbcType="INTEGER" property="commSts" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<!-- 定义了一个批量插入操作,用于将OrderItem列表插入到数据库中 -->
|
|
|
|
|
<insert id="insertBatch">
|
|
|
|
|
INSERT INTO `tz_order_item` (shop_id,order_number,prod_id,sku_id,sku_name,
|
|
|
|
|
prod_count,prod_name,pic,price,user_id,product_total_amount,rec_time,comm_sts,
|
|
|
|
|
distribution_card_no,basket_date) VALUES
|
|
|
|
|
<!-- 使用foreach循环遍历OrderItem列表,并生成批量插入的值 -->
|
|
|
|
|
<foreach collection="list" item="orderItem" separator=",">
|
|
|
|
|
(#{orderItem.shopId},#{orderItem.orderNumber},#{orderItem.prodId},#{orderItem.skuId},#{orderItem.skuName},
|
|
|
|
|
#{orderItem.prodCount},#{orderItem.prodName},#{orderItem.pic},#{orderItem.price},#{orderItem.userId},#{orderItem.productTotalAmount},#{orderItem.recTime},#{orderItem.commSts},
|
|
|
|
|
#{orderItem.distributionCardNo},#{orderItem.basketDate})
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<!-- 定义了一个查询操作,用于根据订单编号获取订单项 -->
|
|
|
|
|
<select id="listByOrderNumber" resultType="com.yami.shop.bean.model.OrderItem">
|
|
|
|
|
select * from tz_order_item where order_number = #{orderNumber}
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|