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

mapper.shop.StoreGoodsBrandMapper.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.StoreGoodsBrandMapper">
    
    <resultMap type="StoreGoodsBrand" id="StoreGoodsBrandResult">
        <result property="id"    column="id"    />
        <result property="brandLogo"    column="brand_logo"    />
        <result property="brandCover"    column="brand_cover"    />
        <result property="brandTitle"    column="brand_title"    />
        <result property="brandDesc"    column="brand_desc"    />
        <result property="brandDetail"    column="brand_detail"    />
        <result property="sort"    column="sort"    />
        <result property="status"    column="status"    />
        <result property="isDeleted"    column="is_deleted"    />
        <result property="createAt"    column="create_at"    />
    </resultMap>

    <sql id="selectStoreGoodsBrandVo">
        select id, brand_logo, brand_cover, brand_title, brand_desc, brand_detail, sort, status, is_deleted, create_at from store_goods_brand
    </sql>

    <select id="selectStoreGoodsBrandList" parameterType="StoreGoodsBrand" resultMap="StoreGoodsBrandResult">
        <include refid="selectStoreGoodsBrandVo"/>
        <where>  
            <if test="brandTitle != null  and brandTitle != ''"> and brand_title = #{brandTitle}</if>
        </where>
    </select>
    
    <select id="selectStoreGoodsBrandById" parameterType="Long" resultMap="StoreGoodsBrandResult">
        <include refid="selectStoreGoodsBrandVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertStoreGoodsBrand" parameterType="StoreGoodsBrand" useGeneratedKeys="true" keyProperty="id">
        insert into store_goods_brand
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="brandLogo != null  and brandLogo != ''">brand_logo,</if>
            <if test="brandCover != null  and brandCover != ''">brand_cover,</if>
            <if test="brandTitle != null  and brandTitle != ''">brand_title,</if>
            <if test="brandDesc != null  and brandDesc != ''">brand_desc,</if>
            <if test="brandDetail != null  and brandDetail != ''">brand_detail,</if>
            <if test="sort != null ">sort,</if>
            <if test="status != null ">status,</if>
            <if test="isDeleted != null ">is_deleted,</if>
            <if test="createAt != null ">create_at,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="brandLogo != null  and brandLogo != ''">#{brandLogo},</if>
            <if test="brandCover != null  and brandCover != ''">#{brandCover},</if>
            <if test="brandTitle != null  and brandTitle != ''">#{brandTitle},</if>
            <if test="brandDesc != null  and brandDesc != ''">#{brandDesc},</if>
            <if test="brandDetail != null  and brandDetail != ''">#{brandDetail},</if>
            <if test="sort != null ">#{sort},</if>
            <if test="status != null ">#{status},</if>
            <if test="isDeleted != null ">#{isDeleted},</if>
            <if test="createAt != null ">#{createAt},</if>
         </trim>
    </insert>

    <update id="updateStoreGoodsBrand" parameterType="StoreGoodsBrand">
        update store_goods_brand
        <trim prefix="SET" suffixOverrides=",">
            <if test="brandLogo != null  and brandLogo != ''">brand_logo = #{brandLogo},</if>
            <if test="brandCover != null  and brandCover != ''">brand_cover = #{brandCover},</if>
            <if test="brandTitle != null  and brandTitle != ''">brand_title = #{brandTitle},</if>
            <if test="brandDesc != null  and brandDesc != ''">brand_desc = #{brandDesc},</if>
            <if test="brandDetail != null  and brandDetail != ''">brand_detail = #{brandDetail},</if>
            <if test="sort != null ">sort = #{sort},</if>
            <if test="status != null ">status = #{status},</if>
            <if test="isDeleted != null ">is_deleted = #{isDeleted},</if>
            <if test="createAt != null ">create_at = #{createAt},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteStoreGoodsBrandById" parameterType="Long">
        delete from store_goods_brand where id = #{id}
    </delete>

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy