52 lines
3.3 KiB
XML
52 lines
3.3 KiB
XML
<?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.macro.mall.dao.PmsProductDao">
|
|
<resultMap id="updateInfoMap" type="com.macro.mall.dto.PmsProductResult" extends="com.macro.mall.mapper.PmsProductMapper.BaseResultMap">
|
|
<collection property="productLadderList" columnPrefix="ladder_" resultMap="com.macro.mall.mapper.PmsProductLadderMapper.BaseResultMap">
|
|
</collection>
|
|
<collection property="productFullReductionList" columnPrefix="full_" resultMap="com.macro.mall.mapper.PmsProductFullReductionMapper.BaseResultMap">
|
|
</collection>
|
|
<collection property="memberPriceList" columnPrefix="member_" resultMap="com.macro.mall.mapper.PmsMemberPriceMapper.BaseResultMap">
|
|
</collection>
|
|
<collection property="skuStockList" columnPrefix="sku_" resultMap="com.macro.mall.mapper.PmsSkuStockMapper.BaseResultMap">
|
|
</collection>
|
|
<collection property="productAttributeValueList" columnPrefix="attribute_" resultMap="com.macro.mall.mapper.PmsProductAttributeValueMapper.BaseResultMap">
|
|
</collection>
|
|
<collection property="subjectList" column="{productId=id}" select="selectSubjectByProductId">
|
|
</collection>
|
|
<collection property="prefrenceAreaList" column="{productId=id}" select="selectPrefrenceAreaByProductId">
|
|
</collection>
|
|
</resultMap>
|
|
|
|
<select id="getUpdateInfo" resultMap="updateInfoMap">
|
|
SELECT *,
|
|
f.name feightTemplateName,
|
|
ac.name productAttributeCategoryName,
|
|
l.id ladder_id,l.discount ladder_discount,l.count ladder_count,l.price ladder_price,
|
|
pf.id full_id,pf.full_price full_full_price,pf.reduce_price full_reduce_price,
|
|
m.id member_id,m.member_level_id member_member_level_id,m.member_price member_member_price,
|
|
s.id sku_id,s.price sku_price,s.low_stock sku_low_stock,s.pic sku_pic,s.sale sku_sale,s.sku_code sku_sku_code,s.sp1 sku_sp1,s.sp2 sku_sp2,s.sp3 sku_sp3,s.stock sku_stock,
|
|
a.id attribute_id,a.product_attribute_id attribute_product_attribute_id,a.value attribute_value
|
|
FROM pms_product p
|
|
LEFT JOIN pms_feight_template f ON p.feight_template_id = f.id
|
|
LEFT JOIN pms_product_attribute_category ac ON p.product_attribute_category_id= ac.id
|
|
LEFT JOIN pms_product_ladder l ON p.id = l.product_id
|
|
LEFT JOIN pms_product_full_reduction pf ON pf.product_id=p.id
|
|
LEFT JOIN pms_member_price m ON m.product_id = p.id
|
|
LEFT JOIN pms_sku_stock s ON s.product_id = p.id
|
|
LEFT JOIN pms_product_attribute_value a ON a.product_id=p.id
|
|
WHERE p.id=#{id};
|
|
</select>
|
|
<select id="selectSubjectByProductId" resultMap="com.macro.mall.mapper.CmsSubjectMapper.BaseResultMap">
|
|
SELECT s.*
|
|
FROM cms_subject_product_relation spr
|
|
LEFT JOIN cms_subject s ON spr.subject_id = s.id
|
|
WHERE spr.product_id = #{productId}
|
|
</select>
|
|
<select id="selectPrefrenceAreaByProductId" resultMap="com.macro.mall.mapper.CmsPrefrenceAreaMapper.BaseResultMap">
|
|
SELECT p.*
|
|
FROM cms_prefrence_area_product_relation ppr
|
|
LEFT JOIN cms_prefrence_area p ON ppr.prefrence_area_id=p.id
|
|
WHERE ppr.product_id=#{productId}
|
|
</select>
|
|
</mapper> |