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

mapper.shop.StoreSpecMapper.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.StoreSpecMapper">
    
    <resultMap type="StoreSpec" id="StoreSpecResult">
        <result property="id"    column="id"    />
        <result property="typeId"    column="type_id"    />
        <result property="name"    column="name"    />
        <result property="sort"    column="sort"    />
        <result property="searchIndex"    column="search_index"    />
    </resultMap>

    <sql id="selectStoreSpecVo">
        select id, type_id, name, sort, search_index from store_spec
    </sql>

    <select id="selectStoreSpecList" parameterType="StoreSpec" resultMap="StoreSpecResult">
        <include refid="selectStoreSpecVo"/>
        <where>
            <if test="typeId != null  and typeId != ''"> and type_id = #{typeId}</if>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
        </where>
    </select>
    
    <select id="selectStoreSpecById" parameterType="Long" resultMap="StoreSpecResult">
        <include refid="selectStoreSpecVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertStoreSpec" parameterType="StoreSpec" useGeneratedKeys="true" keyProperty="id">
        insert into store_spec
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="typeId != null ">type_id,</if>
            <if test="name != null  and name != ''">name,</if>
            <if test="sort != null ">sort,</if>
            <if test="searchIndex != null ">search_index,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="typeId != null ">#{typeId},</if>
            <if test="name != null  and name != ''">#{name},</if>
            <if test="sort != null ">#{sort},</if>
            <if test="searchIndex != null ">#{searchIndex},</if>
         </trim>
    </insert>

    <update id="updateStoreSpec" parameterType="StoreSpec">
        update store_spec
        <trim prefix="SET" suffixOverrides=",">
            <if test="typeId != null ">type_id = #{typeId},</if>
            <if test="name != null  and name != ''">name = #{name},</if>
            <if test="sort != null ">sort = #{sort},</if>
            <if test="searchIndex != null ">search_index = #{searchIndex},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteStoreSpecById" parameterType="Long">
        delete from store_spec where id = #{id}
    </delete>

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy