<?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.ruoyi.system.mapper.ZsProductMapper">

    <resultMap type="com.ruoyi.system.domain.ZsProduct" id="ZsProductResult">
        <result property="id" column="id"/>
        <result property="websiteId" column="website_id"/>
        <result property="websiteName" column="website_name"/>
        <result property="languageCode" column="language_code"/>
        <result property="categoryId" column="category_id"/>
        <result property="purposeIds" column="purpose_ids"/>
        <result property="name" column="name"/>
        <result property="descripetion1" column="descripetion1"/>
        <result property="descripetion2" column="descripetion2"/>
        <result property="cover" column="cover"/>
        <result property="intro" column="intro"/>
        <result property="galleryList" column="gallery_list"/>
        <result property="productInfo" column="product_info"/>
        <result property="attachmentListJson" column="attachment_list_json"/>
        <result property="seoTitle" column="seo_title"/>
        <result property="seoKeyword" column="seo_keyword"/>
        <result property="seoDescripetion" column="seo_descripetion"/>
        <result property="isDisabled" column="is_disabled"/>
        <result property="platformIds" column="platform_ids"/>
        <result property="isRecommend" column="is_recommend"/>
        <result property="tag" column="tag"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="createBy" column="create_by"/>
        <result property="updateBy" column="update_by"/>
    </resultMap>

    <select id="getProductAndCategoryInfo" resultType="java.util.Map">
        SELECT
            p.NAME AS product_name,
            c.NAME AS category_name,
            p.purpose_ids,
            p.tag,
            p.cover,
            p.descripetion1
        FROM
            zs_product p
                INNER JOIN zs_product_category c ON p.category_id = c.id
        WHERE
            p.website_id = #{website_id}
          AND p.language_code = #{language_code}
          AND c.website_id = #{website_id}
          AND c.language_code = #{language_code}
    </select>

</mapper>
