86 lines
3.5 KiB
XML
86 lines
3.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="com.zhwl.eatery.mapper.ZdyEateryProductAttributeRelationMapper">
|
|
|
|
<resultMap type="ZdyEateryProductAttributeRelation" id="ZdyEateryProductAttributeRelationResult">
|
|
<result property="productId" column="product_id"/>
|
|
<result property="productAttributeId" column="product_attribute_id"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectZdyEateryProductAttributeRelationVo">
|
|
select product_id, product_attribute_id
|
|
from zdy_eatery_product_attribute_relation
|
|
</sql>
|
|
|
|
<select id="selectZdyEateryProductAttributeRelationList" parameterType="ZdyEateryProductAttributeRelation"
|
|
resultMap="ZdyEateryProductAttributeRelationResult">
|
|
<include refid="selectZdyEateryProductAttributeRelationVo"/>
|
|
<where>
|
|
<if test="productId != null ">
|
|
and product_id = #{productId}
|
|
</if>
|
|
<if test="productAttributeId != null ">
|
|
and product_attribute_id = #{productAttributeId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectZdyEateryProductAttributeRelationByProductId" parameterType="long"
|
|
resultMap="ZdyEateryProductAttributeRelationResult">
|
|
<include refid="selectZdyEateryProductAttributeRelationVo"/>
|
|
where product_id = #{productId}
|
|
</select>
|
|
|
|
<select id="selectByProductAttributeId" parameterType="long"
|
|
resultMap="ZdyEateryProductAttributeRelationResult">
|
|
<include refid="selectZdyEateryProductAttributeRelationVo"/>
|
|
where product_attribute_id = #{productAttributeId}
|
|
</select>
|
|
|
|
<insert id="insertZdyEateryProductAttributeRelation" parameterType="ZdyEateryProductAttributeRelation">
|
|
insert into zdy_eatery_product_attribute_relation
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="productId != null">product_id,
|
|
</if>
|
|
<if test="productAttributeId != null">product_attribute_id,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="productId != null">#{productId},
|
|
</if>
|
|
<if test="productAttributeId != null">#{productAttributeId},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateZdyEateryProductAttributeRelation" parameterType="ZdyEateryProductAttributeRelation">
|
|
update zdy_eatery_product_attribute_relation
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="productAttributeId != null">product_attribute_id =
|
|
#{productAttributeId},
|
|
</if>
|
|
</trim>
|
|
where product_id = #{productId}
|
|
</update>
|
|
|
|
<delete id="deleteZdyEateryProductAttributeRelationByProductId" parameterType="long">
|
|
delete
|
|
from zdy_eatery_product_attribute_relation
|
|
where product_id = #{productId}
|
|
</delete>
|
|
|
|
<delete id="deleteZdyEateryProductAttributeRelationByProductIds" parameterType="String">
|
|
delete from zdy_eatery_product_attribute_relation where product_id in
|
|
<foreach item="productId" collection="array" open="(" separator="," close=")">
|
|
#{productId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteZdyEateryProductAttributeRelationByProductAttributeId" parameterType="long">
|
|
delete
|
|
from zdy_eatery_product_attribute_relation
|
|
where product_attribute_id = #{productAttributeId}
|
|
</delete>
|
|
</mapper> |