<?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.ProdAttrPriceVoMapper">
    <resultMap type="ProdAttrPriceVo" id="ProdAttrPriceVoResult">
        <result property="prodAttrPriceId"      column="prodAttrPriceId"    />
        <result property="prodId"               column="prodId"             />
        <result property="prodAttrId"           column="prodAttrId"         />
        <result property="buyerId"              column="buyerId"            />
        <result property="buyerRoleKey"         column="buyerRoleKey"       />
        <result property="sellerId"             column="sellerId"           />
        <result property="sellerRoleKey"        column="sellerRoleKey"      />
        <result property="price"                column="price"              />
        <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="buyerName"            column="buyerName"          />
        <result property="sellerName"           column="sellerName"         />
        <result property="buyerRoleName"        column="buyerRoleName"      />
        <result property="sellerRoleName"       column="sellerRoleName"     />
    </resultMap>

    <sql id="selectProdAttrPriceVo">
        select m_prod_attr_price.prodAttrPriceId
             , m_prod_attr_price.prodId
             , m_prod_attr_price.prodAttrId
             , m_prod_attr_price.buyerId
             , m_prod_attr_price.buyerRoleKey
             , m_prod_attr_price.sellerId
             , m_prod_attr_price.sellerRoleKey
             , m_prod_attr_price.price
             , m_prod_attr_price.delFlag
             , m_prod_attr_price.createUser
             , m_prod_attr_price.createTime
             , m_prod_attr_price.updateUser
             , m_prod_attr_price.updateTime
             , m_prod_attr_price.updateTime
             , m_prod_attr_price.updateTime
--              , buyer.user_name as buyerName
--              , seller.user_name as sellerName
--              , buyerrole.role_name as buyerRoleName
--              , sellerrole.role_name as sellerRoleName
        from m_prod_attr_price
--                  inner join sys_user buyer on buyer.user_id = m_prod_attr_price.buyerId and buyer.del_flag = '0'
--                  inner join sys_user seller on seller.user_id = m_prod_attr_price.sellerId and seller.del_flag = '0'
--                  inner join sys_role buyerrole on buyerrole.role_key = m_prod_attr_price.buyerRoleKey and buyerrole.del_flag = '0'
--                  inner join sys_role sellerrole on sellerrole.role_key = m_prod_attr_price.sellerRoleKey and sellerrole.del_flag = '0'
    </sql>

    <select id="selectProdAttrPriceVo" parameterType="ProdAttrPriceVo" resultMap="ProdAttrPriceVoResult">
        <include refid="selectProdAttrPriceVo"/>
        <where>
            <if test="prodAttrPriceId != null "> and m_prod_attr_price.prodAttrPriceId = #{prodAttrPriceId}</if>
            <if test="prodId != null "> and m_prod_attr_price.prodId = #{prodId}</if>
            <if test="prodAttrId != null "> and m_prod_attr_price.prodAttrId = #{prodAttrId}</if>
            <if test="buyerId != null "> and m_prod_attr_price.buyerId = #{buyerId}</if>
            <if test="buyerRoleKey != null "> and m_prod_attr_price.buyerRoleKey = #{buyerRoleKey}</if>
            <if test="sellerId != null "> and m_prod_attr_price.sellerId = #{sellerId}</if>
            <if test="sellerRoleKey != null "> and m_prod_attr_price.sellerRoleKey = #{sellerRoleKey}</if>
            <if test="price != null "> and m_prod_attr_price.price = #{price}</if>
            <if test="delFlag != null and delFlag != ''"> and m_prod_attr_price.delFlag = #{delFlag}</if>
<!--            <if test="buyerName != null and buyerName != ''"> and buyer.user_name like concat('%', #{buyerName}, '%')</if>-->
<!--            <if test="sellerName != null and sellerName != ''"> and seller.user_name like concat('%', #{sellerName}, '%')</if>-->
<!--            <if test="buyerRoleName != null and buyerRoleName != ''"> and buyerrole.role_name like concat('%', #{buyerRoleName}, '%')</if>-->
<!--            <if test="sellerRoleName != null and sellerRoleName != ''"> and sellerrole.role_name like concat('%', #{sellerRoleName}, '%')</if>-->
        </where>
    </select>
</mapper>