2023-12-16 19:19:22 +08:00
|
|
|
<?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="cn.bunny.mapper.ProductDetailMapper">
|
2023-12-16 20:54:10 +08:00
|
|
|
|
|
|
|
<resultMap id="productDetailsMap" type="cn.bunny.common.spzx.model.entity.product.ProductDetails" autoMapping="true"/>
|
|
|
|
|
2023-12-16 19:19:22 +08:00
|
|
|
<!-- 用于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>
|
|
|
|
|
|
|
|
<!-- 修改product_details表 -->
|
|
|
|
<update id="updateById">
|
|
|
|
update product_details set
|
|
|
|
<if test="productId != null and productId != ''">
|
|
|
|
product_id = #{productId},
|
|
|
|
</if>
|
|
|
|
<if test="imageUrls != null and imageUrls != ''">
|
|
|
|
image_urls = #{imageUrls},
|
|
|
|
</if>
|
|
|
|
update_time = now()
|
|
|
|
where
|
|
|
|
id = #{id}
|
|
|
|
</update>
|
|
|
|
|
2023-12-16 20:54:10 +08:00
|
|
|
<!-- 删除product_details数据 -->
|
|
|
|
<update id="deleteById">
|
|
|
|
update product_details
|
|
|
|
set is_deleted=1
|
|
|
|
where id = #{id}
|
|
|
|
</update>
|
|
|
|
|
2023-12-16 19:19:22 +08:00
|
|
|
<!-- 根据id查询商品信息 -->
|
2023-12-16 20:54:10 +08:00
|
|
|
<select id="findProductDetailsById" resultMap="productDetailsMap">
|
|
|
|
select <include refid="columns" />
|
2023-12-16 19:19:22 +08:00
|
|
|
from product_details
|
|
|
|
where
|
2023-12-16 20:54:10 +08:00
|
|
|
product_id = #{productId}
|
2023-12-16 19:19:22 +08:00
|
|
|
</select>
|
|
|
|
</mapper>
|