39 lines
1.6 KiB
XML
39 lines
1.6 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="com.nlshop.mapper.ProductCustomMapper">
|
|
<resultMap id="BaseResultMap" type="com.nlshop.entity.ProductCustom">
|
|
<id column="id" property="id"/>
|
|
<result column="product_id" property="productId"/>
|
|
<result column="option_type" property="optionType"/>
|
|
<result column="option_value" property="optionValue"/>
|
|
<result column="price_adjust" property="priceAdjust"/>
|
|
</resultMap>
|
|
|
|
<insert id="insert" parameterType="com.nlshop.entity.ProductCustom" useGeneratedKeys="true" keyProperty="id">
|
|
INSERT INTO product_custom (product_id, option_type, option_value, price_adjust)
|
|
VALUES (#{productId}, #{optionType}, #{optionValue}, #{priceAdjust})
|
|
</insert>
|
|
|
|
<select id="selectByProductId" resultMap="BaseResultMap">
|
|
SELECT * FROM product_custom WHERE product_id = #{productId}
|
|
</select>
|
|
|
|
<select id="selectById" resultMap="BaseResultMap">
|
|
SELECT * FROM product_custom WHERE id = #{id}
|
|
</select>
|
|
|
|
<update id="update" parameterType="com.nlshop.entity.ProductCustom">
|
|
UPDATE product_custom
|
|
SET option_type = #{optionType}, option_value = #{optionValue}, price_adjust = #{priceAdjust}
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
<delete id="delete">
|
|
DELETE FROM product_custom WHERE id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteByProductId">
|
|
DELETE FROM product_custom WHERE product_id = #{productId}
|
|
</delete>
|
|
</mapper>
|