All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mapper.shop.StoreSpecItemMapper.xml Maven / Gradle / Ivy

The newest version!
<?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.jblv.shop.mapper.StoreSpecItemMapper">
    
    <resultMap type="StoreSpecItem" id="StoreSpecItemResult">
        <result property="id"    column="id"    />
        <result property="specId"    column="spec_id"    />
        <result property="item"    column="item"    />
    </resultMap>

    <sql id="selectStoreSpecItemVo">
        select id, spec_id, item from store_spec_item
    </sql>

    <select id="selectStoreSpecItemList" parameterType="StoreSpecItem" resultMap="StoreSpecItemResult">
        <include refid="selectStoreSpecItemVo"/>
        <where>  
            <if test="specId != null "> and spec_id = #{specId}</if>
            <if test="item != null  and item != ''"> and item = #{item}</if>
        </where>
    </select>
    
    <select id="selectStoreSpecItemById" parameterType="Long" resultMap="StoreSpecItemResult">
        <include refid="selectStoreSpecItemVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertStoreSpecItem" parameterType="StoreSpecItem" useGeneratedKeys="true" keyProperty="id">
        insert into store_spec_item
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="specId != null ">spec_id,</if>
            <if test="item != null  and item != ''">item,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="specId != null ">#{specId},</if>
            <if test="item != null  and item != ''">#{item},</if>
         </trim>
    </insert>

    <insert id="batchSpecItem">
        insert into store_spec_item(spec_id, item) values
        <foreach item="item" index="index" collection="list" separator=",">
            (#{item.specId},#{item.item})
        </foreach>
    </insert>

    <update id="updateStoreSpecItem" parameterType="StoreSpecItem">
        update store_spec_item
        <trim prefix="SET" suffixOverrides=",">
            <if test="specId != null ">spec_id = #{specId},</if>
            <if test="item != null  and item != ''">item = #{item},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteStoreSpecItemById" parameterType="Long">
        delete from store_spec_item where id = #{id}
    </delete>

    <delete id="deleteStoreSpecItemByIds" parameterType="String">
        delete from store_spec_item where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy