24 lines
905 B
XML
24 lines
905 B
XML
<?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.atguigu.spzx.manger.mapper.ProductDetailsMapper">
|
|
<!-- 用于select查询公用抽取的列 -->
|
|
<sql id="columns">
|
|
id,product_id,image_urls,create_time,update_time,is_deleted
|
|
</sql>
|
|
|
|
<!-- 保存数据 -->
|
|
<insert id="save" useGeneratedKeys="true" keyProperty="id">
|
|
insert into product_details (id, product_id, image_urls, create_time, update_time, is_deleted)
|
|
values (#{id}, #{productId}, #{imageUrls}, now(), now(), 0)
|
|
</insert>
|
|
|
|
|
|
<select id="selectByProductId" resultType="com.atguigu.spzx.model.entity.product.ProductDetails">
|
|
select
|
|
<include refid="columns"/>
|
|
from product_details
|
|
where
|
|
product_id = #{productId}
|
|
</select>
|
|
</mapper>
|