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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.product.domain.entity.AttrAttrgroupRelation">
        <id column="id" property="id"/>
        <id column="attr_id" property="attrId"/>
        <id column="attr_group_id" property="attrGroupId"/>
        <id column="attr_sort" property="attrSort"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,attr_id,attr_group_id,attr_sort
    </sql>

    <!-- 分页查询属性&属性分组关联内容 -->
    <select id="selectListByPage" resultType="com.mall.product.domain.vo.AttrAttrgroupRelationVo">
        select
        <include refid="Base_Column_List"/>
        from pms_attr_attrgroup_relation
        <where>
            <if test="dto.id != null and dto.id != ''">
                and id like CONCAT('%',#{dto.id},'%')
            </if>
            <if test="dto.attrId != null and dto.attrId != ''">
                and attr_id like CONCAT('%',#{dto.attrId},'%')
            </if>
            <if test="dto.attrGroupId != null and dto.attrGroupId != ''">
                and attr_group_id like CONCAT('%',#{dto.attrGroupId},'%')
            </if>
            <if test="dto.attrSort != null and dto.attrSort != ''">
                and attr_sort like CONCAT('%',#{dto.attrSort},'%')
            </if>
        </where>
    </select>

</mapper>
