45 lines
1.5 KiB
XML
45 lines
1.5 KiB
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="cn.bunny.mapper.ProductDetailMapper">
|
||
|
<!-- 用于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>
|
||
|
|
||
|
<!-- 根据id查询商品信息 -->
|
||
|
<select id="findProductDetailsById" resultType="cn.bunny.common.spzx.model.entity.product.ProductDetails">
|
||
|
select
|
||
|
<include refid="columns"/>
|
||
|
from product_details
|
||
|
where
|
||
|
product_id = #{productId} and is_deleted=0
|
||
|
</select>
|
||
|
</mapper>
|