<?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.cyl.manager.pms.mapper.BrandMapper">
    
    <resultMap type="Brand" id="BrandResult">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="sort" column="sort"/>
        <result property="showStatus" column="show_status"/>
        <result property="logo" column="logo"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>

    <sql id="selectBrandVo">
        select id, name, sort, show_status, logo, create_by, create_time, update_by, update_time   from pms_brand
    </sql>

    <select id="selectByEntity" parameterType="Brand" resultMap="BrandResult">
        <include refid="selectBrandVo"/>
        <where>  
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="sort != null "> and sort = #{sort}</if>
            <if test="showStatus != null "> and show_status = #{showStatus}</if>
            <if test="logo != null  and logo != ''"> and logo = #{logo}</if>
        </where>
    </select>
</mapper>
