<?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="org.springblade.modules.custom.mapper.ManufacturerMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="manufacturerResultMap" type="org.springblade.modules.custom.entity.Manufacturer">
        <result column="id" property="id"/>
        <result column="is_delete" property="isDelete"/>
        <result column="create_user_id" property="createUserId"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user_id" property="updateUserId"/>
        <result column="update_time" property="updateTime"/>
        <result column="name" property="name"/>
        <result column="contact_number" property="contactNumber"/>
        <result column="address" property="address"/>
        <result column="introduction" property="introduction"/>
    </resultMap>


    <select id="selectManufacturerPage" resultType="org.springblade.modules.custom.vo.ManufacturerVO">
        SELECT
            m.*,
            GROUP_CONCAT( l.`name` ) labelStr
        FROM
            biz_manufacturer m
            JOIN biz_manufacturer_label ml ON m.id = ml.manufacturer_id
            JOIN biz_lable l ON l.id = ml.label_id
        WHERE
            m.is_delete = 0
            AND ml.is_delete = 0
        GROUP BY
            m.id
    </select>

</mapper>
