<?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.xingxi.web.controller.master.product.mapper.ProdAttrJointVoMapper">
    <resultMap type="ProdAttrJointVo" id="ProdAttrJointVoResult">
        <result property="prodAttrId"           column="prodAttrId" />
        <result property="prodId"               column="prodId"     />
        <result property="attrName"             column="attrName"   />
        <result property="attrType"             column="attrType"   />
        <result property="delFlag"              column="delFlag"    />
        <result property="createTime"           column="createTime" />
        <result property="createUser"           column="createUser" />
        <result property="updateUser"           column="updateUser" />
        <result property="updateTime"           column="updateTime" />
        <result property="attrName"             column="attrName"   />
        <result property="attrType"             column="attrType"   />
    </resultMap>

    <sql id="selectProdAttrJointVo">
        select m_prod_attr_joint.prodAttrJointId
             , m_prod_attr_joint.prodId
             , m_prod_attr_joint.prodAttrId
             , m_prod_attr_joint.jointProdId
             , m_prod_attr_joint.jointProdAttrId
             , m_prod_attr_joint.delFlag
             , m_prod_attr_joint.createUser
             , m_prod_attr_joint.createTime
             , m_prod_attr_joint.updateUser
             , m_prod_attr_joint.updateTime
             , m_prod_attr.attrName
             , m_prod_attr.attrType
        from m_prod_attr_joint
        inner join m_prod_attr on m_prod_attr.prodId = m_prod_attr_joint.prodId and m_prod_attr.prodAttrId = m_prod_attr_joint.jointProdAttrId and m_prod_attr.delFlag = '0'
    </sql>

    <select id="selectProdAttrJointVoList" parameterType="ProdAttrJointVo" resultMap="ProdAttrJointVoResult">
        <include refid="selectProdAttrJointVo"/>
        <where>
            <if test="prodId != null "> and m_prod_attr_joint.prodId = #{prodId}</if>
            <if test="prodAttrId != null "> and m_prod_attr_joint.prodAttrId = #{prodAttrId}</if>
            <if test="delFlag != null  and delFlag != ''"> and m_prod_attr_joint.delFlag = #{delFlag}</if>
        </where>
    </select>
</mapper>