<?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.mall.product.mapper.BrandMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.product.domain.entity.Brand">
            <id column="brand_id" property="brandId"/>
            <id column="name" property="name"/>
            <id column="logo" property="logo"/>
            <id column="descript" property="descript"/>
            <id column="show_status" property="showStatus"/>
            <id column="first_letter" property="firstLetter"/>
            <id column="sort" property="sort"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        brand_id,name,logo,descript,show_status,first_letter,sort
    </sql>

    <!-- 分页查询品牌内容 -->
    <select id="selectListByPage" resultType="com.mall.product.domain.vo.BrandVo">
        select
        <include refid="Base_Column_List"/>
        from pms_brand
        <where>
                <if test="dto.brandId != null and dto.brandId != ''">
                    and brand_id like CONCAT('%',#{dto.brandId},'%')
                </if>
                <if test="dto.name != null and dto.name != ''">
                    and name like CONCAT('%',#{dto.name},'%')
                </if>
                <if test="dto.logo != null and dto.logo != ''">
                    and logo like CONCAT('%',#{dto.logo},'%')
                </if>
                <if test="dto.descript != null and dto.descript != ''">
                    and descript like CONCAT('%',#{dto.descript},'%')
                </if>
                <if test="dto.showStatus != null and dto.showStatus != ''">
                    and show_status like CONCAT('%',#{dto.showStatus},'%')
                </if>
                <if test="dto.firstLetter != null and dto.firstLetter != ''">
                    and first_letter like CONCAT('%',#{dto.firstLetter},'%')
                </if>
                <if test="dto.sort != null and dto.sort != ''">
                    and sort like CONCAT('%',#{dto.sort},'%')
                </if>
        </where>
    </select>

</mapper>
