<?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.AttrGroupMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.product.domain.entity.AttrGroup">
            <id column="attr_group_id" property="attrGroupId"/>
            <id column="attr_group_name" property="attrGroupName"/>
            <id column="sort" property="sort"/>
            <id column="descript" property="descript"/>
            <id column="icon" property="icon"/>
            <id column="catelog_id" property="catelogId"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        attr_group_id,attr_group_name,sort,descript,icon,catelog_id
    </sql>

    <!-- 分页查询属性分组内容 -->
    <select id="selectListByPage" resultType="com.mall.product.domain.vo.AttrGroupVo">
        select
        <include refid="Base_Column_List"/>
        from pms_attr_group
        <where>
                <if test="dto.attrGroupId != null and dto.attrGroupId != ''">
                    and attr_group_id like CONCAT('%',#{dto.attrGroupId},'%')
                </if>
                <if test="dto.attrGroupName != null and dto.attrGroupName != ''">
                    and attr_group_name like CONCAT('%',#{dto.attrGroupName},'%')
                </if>
                <if test="dto.sort != null and dto.sort != ''">
                    and sort like CONCAT('%',#{dto.sort},'%')
                </if>
                <if test="dto.descript != null and dto.descript != ''">
                    and descript like CONCAT('%',#{dto.descript},'%')
                </if>
                <if test="dto.icon != null and dto.icon != ''">
                    and icon like CONCAT('%',#{dto.icon},'%')
                </if>
                <if test="dto.catelogId != null and dto.catelogId != ''">
                    and catelog_id like CONCAT('%',#{dto.catelogId},'%')
                </if>
        </where>
    </select>

</mapper>
