初始化v1
This commit is contained in:
37
target/classes/mapper/ProductToppingMapper.xml
Normal file
37
target/classes/mapper/ProductToppingMapper.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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.ProductToppingMapper">
|
||||
<resultMap id="BaseResultMap" type="com.nlshop.entity.ProductTopping">
|
||||
<id column="id" property="id"/>
|
||||
<result column="product_id" property="productId"/>
|
||||
<result column="topping_name" property="toppingName"/>
|
||||
<result column="price" property="price"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert" parameterType="com.nlshop.entity.ProductTopping" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO product_topping (product_id, topping_name, price)
|
||||
VALUES (#{productId}, #{toppingName}, #{price})
|
||||
</insert>
|
||||
|
||||
<select id="selectByProductId" resultMap="BaseResultMap">
|
||||
SELECT * FROM product_topping WHERE product_id = #{productId}
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
SELECT * FROM product_topping WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<update id="update" parameterType="com.nlshop.entity.ProductTopping">
|
||||
UPDATE product_topping
|
||||
SET topping_name = #{toppingName}, price = #{price}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE FROM product_topping WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByProductId">
|
||||
DELETE FROM product_topping WHERE product_id = #{productId}
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user