ProductIndex全字段来源与逻辑
####yh_shops库product表
ProductIndex字段 | product表字段
-----|-----
product_id (产品Id ) | product_id
product_skn (产品skn) | erp_product_id
shop_id (店铺Id) | shop_id
product_name (产品名称) | product_name
cn_alphabet (中文拼音) | cn_alphabet
sales_phrase (销售语) | sales_phrase
brand_id (品牌Id) | brand_id
max_sort_id (大分类Id) | max_sort_id
middle_sort_id (中分类Id) | middle_sort_id
small_sort_id (小分类Id)| small_sort_id
series_id (系列Id) | series_id
gender (性别)| gender
gender_s (性别)| if(gender==1) gender_s='男' if(gender==2) gender_s='女' else gender_s='男,女'
style (风格)| style
isnew (是否新品)| if(to_days(now()) - to_days(from_unixtime(p
.shelve_time
))) <= 7) isnew='Y' else isnew='N'
islimited (是否限制)| if(is_limited=='Y') islimited='Y' else islimited='N'
is_hot (是否热卖)| is_hot
ishot (是否热卖)| if(is_hot=='Y') ishot=1 else ishot=2
is_special (是否特殊)| is_special
isspecial (是否特殊)| if(is_special=='Y') isspecial=1 else isspecial=2
is_sales (是否卖)| is_sales
issales (是否卖)| if(is_sales=='Y') issales=1 else issales=2
is_advance | is_advance
isadvance | if(is_advance=='Y') isadvance=1 else isadvance=2
is_auditing (是否审核)| is_auditing
isauditing (是否审核)|if(is_auditing=='Y') isauditing=1 else isauditing=2
isrecommend (是否推荐)| if(is_recommend=='Y') isrecommend=1 else isrecommend=2
is_promotion (是否促销)| is_promotion
attribute (赠品)| attribute
seasons (季节)| seasons
seasons_s (季节)| if(seasons=='spring'||seasons=='autumn'||seasons=='spring,autumn') seasons_s=1 if(seasons=='summer') seasons_s=2 if(seasons=='winter') seasons_s=3if(seasons=='spring,summer,autumn,winter'||seasons=='seasons') seasons_s=4 else seasons_s=4
first_shelve_time (首次上架时间)| first_shelve_time
shelve_time (上架时间)| shelve_time
shelve_day (首次上架日)| if(shelve_time==0) shelve_day=0 else cast(from_unixtime(p
.shelve_time
) AS date)
edit_time (编辑时间)| edit_time
is_down |is_down
isdown | if(is_down=='Y') isdown=1 else isdown=2
status (状态)| status
is_outlets (奥莱)| if(is_outlets=='Y') is_outlets=1 else is_outlets=2
folder_id (楼层)| folder_id
sell_channels (频道)| sell_channels
age_level (年龄段) | age_level
app_type (app类型)| app_type
###yh_shops库brand表
ProductIndex字段| brand表字段
-----|-----
brand_name_cn (品牌名cn) | brand_name_cn
brand_name_en (品牌名en)| brand_name_en
brand_keyword (品牌关键字)| brand_keyword
hot_keyword (热门关键字)| hot_keyword
brand_name (品牌名称)| brand_name
brand_domain (品牌域)| brand_domain
brand_alif (品牌首字母)| brand_alif
yh_shops库product_sort表
ProductIndex字段 | product_sort |
---|---|
max_sort (大分类) | yh_shops库product_sort表sort_name product_sort .max_sort_id =product .id where p .max_sort_id = product_sort .id
|
max_sort_name (大分类名) | if(yh_shops库product_sort表status==0) max_sort_name=''else max_sort_name= concat(p .max_sort_id ,':',product_sort .sort_name ,':',product_sort .order_by ) where p .max_sort_id = product_sort .id
|
middle_sort (中分类) | yh_shops库product_sort表sort_name product_sort .middle_sort_id = product .id where p .max_sort_id = product_sort .id
|
middle_sort_name (中分类名) | if(yh_shops库product_sort表status==0) middle_sort_name=''else middle_sort_name= concat(p .middle_sort_id ,':',product_sort .sort_name ,':',product_sort .order_by )where p .middle_sort_id = product_sort .id
|
small_sort (小分类) | yh_shops库product_sort表sort_name product_sort .small_sort_id =product .id where p .small_sort_id = product_sort .id
|
small_sort_name (小分类名) | if(yh_shops库product_sort表status==0) small_sort_name=''else small_sort_name= concat (p .small_sort_id ,':',product_sort .sort_name ,':',product_sort .order_by )where p .small_sort_id = product_sort .id
|
is_instalment (yoho分期) | yh_shops库product表is_instalment |
country_id (产地) | yh_shops库product表country_id |
###yh_shops库product_price表
ProductIndex字段 | yh_shops库product_price表 条件:product. id= product_price. product_id` |
---|---|
special_price (特殊价格) | special_price |
market_price (市场价) | market_price |
vip_discount_type (会员价类型) | vip_discount_type |
vip_price | vip_price |
vip1_price | vip1_price |
vip2_price | vip2_price |
vip3_price | vip3_price |
sales_price (销售价) | sales_price |
student_price (学生价) | student_price |
is_student_price (是否有学生价) | if(product_price .student_price IS NOT NULL)is_student_price='Y' elesis_student_price='N' |
promotion_discount_int (折扣) |
product_price .sales_price 除以 product_price .market_price 取到小数点第一位然后乘以10 |
promotion_discount (折扣) |
product_price .sales_price 除以 product_price .market_price 取到小数点第三位 |
specialoffer (特殊供应) |
product_price .sales_price 除以 product_price .market_price 取到小数点第一位 如果<0.5 specialoffer='Y' else specialoffer='N' |
is_discount (是否打折) |
product_price .sales_price 除以 product_price .market_price
|
yh_shops库product_keywords表
ProductIndex字段 | yh_shops库product_keywords product. id= product_keywords. product_id` |
---|---|
product_keyword (品牌关键字) | product_keyword |
视图 product_colors 来源:yh_shops库goods表
###视图语句:
SELECT
`a`.`product_id` AS `product_id`,
group_concat(`a`.`color_id` SEPARATOR ',') AS `color_ids`,
group_concat(
`a`.`color_name` SEPARATOR ','
) AS `color_names`
FROM
`goods` `a`
GROUP BY
`a`.`product_id`
ProductIndex字段 |yh_shops库product_colors表 条件: product.
id=
product_colors.
product_id`
-----|-----|
color_ids(颜色ids)|color_ids 把每个product对应的多个goods中的color_id拼起来
color_names(颜色名称)|color_names 把每个product对应的多个goods中的color_name拼起来
视图product_standards 来源 yh_shops库product_standard_relation,standard,parameter_make表
###视图语句:
SELECT
`a`.`product_id` AS `product_id`,
group_concat(
concat(
`a`.`standard_id`,
`a`.`parameter_make_id`
) SEPARATOR ','
) AS `standard_ids`,
group_concat(
concat(
`a`.`standard_id`,
'-',
`b`.`standard_name`,
':',
`a`.`parameter_make_id`,
'-',
`c`.`parameter_value`
) SEPARATOR ','
) AS `standard_names`,
group_concat(
`c`.`parameter_value` SEPARATOR ','
) AS `standard_only_names`
FROM
(
(
`product_standard_relation` `a`
LEFT JOIN `standard` `b` ON (
(`a`.`standard_id` = `b`.`id`)
)
)
JOIN `parameter_make` `c` ON (
(
`a`.`parameter_make_id` = `c`.`id`
)
)
)
GROUP BY
`a`.`product_id`
ProductIndex字段 |yh_shops库product_standards表 条件:product.
id=
product_standards.
product_id`
-----|-----|
standard_ids (规格ids) | standard_ids 来自product_standard_relation表的standard_id和parameter_make_id字段
standard_names (规格id和名称) |standard_names 来自product_standard_relation表的standard_id字段,standard表的standard_name字段,product_standard_relation表的parameter_make_id字段,parameter_make表的parameter_value字段
standard_only_names (规格名) |standard_only_names 来自parameter_make表的parameter_value字段
视图product_sizes 来源:yh_shops库 storage表,size表,storage表
###视图语句:
SELECT
`t`.`product_id` AS `product_id`,
group_concat(
DISTINCT `t`.`goods_dimension_id` SEPARATOR ','
) AS `size_ids`,
group_concat(
DISTINCT `s`.`size_name` SEPARATOR ','
) AS `size_names`,
sum(`t`.`sales_num`) AS `sales_num`,
sum(`t`.`storage_num`) AS `storage_num`
FROM
(
(`storage` `t` JOIN `goods` `g`)
JOIN `size` `s`
)
WHERE
(
(`t`.`goods_id` = `g`.`id`)
AND (`g`.`status` = 1)
AND (
`t`.`goods_dimension_id` = `s`.`id`
)
)
GROUP BY
`t`.`product_id`
ProductIndex字段 |yh_shops库product_sizes表 条件:product.
id=
product_sizes.
product_id`
-----|-----|
sales_num (销售量) | sales_num 来自一个product对应的多个goods的sales_num之和
storage_num (库存量) |storage_num 来自一个product对应的多个goods的storage_num之和
is_soon_sold_out (即将售罄)| if(storage_num<=2) is_soon_sold_out='Y' eles is_soon_sold_out='N'
is_sold_out | if(storage_num==0) is_sold_out='Y' eles is_sold_out='N'
sold_out (已经售罄)| if(storage_num==0) sold_out='0' eles sold_out='1'
size_ids (尺码id)| size_ids 来自一个product对应的多个goods通过storage的goods_dimension_id拼起来
size_names (尺码名称) |size_names 来自一个product对应的多个goods通过storage的goods_dimension_id查size表中的sizeName拼起来
视图product_styles 来源 yh_shops库 product_style_relation表
###视图语句:
(
SELECT
`a`.`product_id` AS `product_id`,
group_concat(`a`.`style_id` SEPARATOR ',') AS `style_ids`
FROM
`product_style_relation` `a`
GROUP BY
`a`.`product_id`
)
ProductIndex字段 |yh_shops库product_styles表 product.
id=
product_styles.
product_id`
-----|-----|
style_ids(风格ids)|style_ids 将一个productId对应的product_style_relation表记录中的style_id拼起来
视图product_goods 来源: 视图product_good 来源 yh_shops库 goods表product_color表goods_cover_image视图(来自goods_images表)
###视图product_goods
(
SELECT
`t`.`product_id` AS `product_id`,
concat(
'[',
group_concat(
`t`.`goods_list` SEPARATOR ','
),
']'
) AS `goods_list`
FROM
`product_good` `t`
GROUP BY
`t`.`product_id`
)
###视图product_good
(
SELECT
`a`.`product_id` AS `product_id`,
concat(
'{"goods_id":"',
`a`.`id`,
'","color_name":"',
`a`.`color_name`,
'","cover_1":"',
ifnull(`c`.`cover_1`, ''),
'","cover_2":"',
ifnull(`c`.`cover_2`, ''),
'","color_id":"',
`a`.`color_id`,
'","status":"',
`a`.`status`,
'","color_code":"',
ifnull(`b`.`color_code`, ''),
'","color_value":"',
'","images_url":"',
ifnull(`a`.`color_image`, ''),
'","product_skc":"',
`a`.`product_skc`,
'","is_default":"',
`a`.`is_default`,
'"}'
) AS `goods_list`,
`a`.`is_default` AS `is_default`
FROM
(
(
`goods` `a`
LEFT JOIN `product_color` `b` ON ((`a`.`color_id` = `b`.`id`))
)
LEFT JOIN `goods_cover_image` `c` ON ((`a`.`id` = `c`.`goods_id`))
)
)
视图goods_cover_image
(
SELECT
`a`.`id` AS `id`,
`a`.`goods_id` AS `goods_id`,
(
CASE `a`.`gender_cover`
WHEN 1 THEN
`a`.`image_url`
END
) AS `cover_1`,
(
CASE `a`.`gender_cover`
WHEN 2 THEN
`a`.`image_url`
END
) AS `cover_2`
FROM
`goods_images` `a`
WHERE
(`a`.`gender_cover` <> 0)
)
ProductIndex字段 |yh_shops库product_goods表 条件: product.
id=
product_goods.
product_id`
-----|-----|
goods_list |goods_list
goods_list详情 | 详情
goods_id (货品id) | goods表id字段
color_name (颜色名)| goods表color_name字段
cover_1 (封面1)| 视图goods_cover_image的cover_1 来源: goods_images表中如果gender_cover=1,cover_1为goods_images表的image_url(gender_cover为0cover_1cover_2都为空)
cover_2 (封面2)| 视图goods_cover_image的cover_2 来源:goods_images表中如果gender_cover=2,cover_2为goods_images表的image_url(gender_cover为0cover_1cover_2都为空)
color_id (颜色名称)| goods表color_id字段
status (状态) | goods表status字段
color_code (颜色码)| product_color表color_code字段
color_value | ""
images_url (图片地址)| goods表的color_image
product_skc (skc)| goods表的product_skc
is_default (是否是默认) | goods表的is_default
###视图product_default_image 来源:yh_shops库goods_images表
SELECT
`t`.`product_id` AS `product_id`,
`t`.`image_url` AS `default_images`
FROM
`goods_images` `t`
WHERE
(`t`.`is_default` = 'Y')
GROUP BY
`t`.`product_id`
ProductIndex字段 |yh_shops库product_default_image表 条件: product.
id=
product_default_image.
product_id`
-----|-----|
default_images(默认图片) |default_images goods_images中is_default=Y的记录的image_url字段值
product_activities视图 来源:product_activity视图 yh_shops库activity_product表
product_activities视图
SELECT
`t`.`product_skn` AS `product_skn`,
concat(
'[',
group_concat(`t`.`activity` SEPARATOR ','),
']'
) AS `activities`
FROM
`product_activity` `t`
GROUP BY
`t`.`product_skn`
product_activity视图
(
SELECT
`ap`.`product_skn` AS `product_skn`,
concat(
'{"activity_id":',
`ap`.`id`,
',"template_id":',
`ap`.`template_id`,
',"order_by":',
`ap`.`order_by`,
',"is_recommend":',
`ap`.`is_recommend`,
',"status":',
`ap`.`status`,
'}'
) AS `activity`
FROM
`activity_product` `ap`
)
ProductIndex字段 |yh_shops库product_activities表 条件: product.
product_skn=
product_activities.
product_skn`
-----|-----|
activities |activities
activities字段详情 | 详情
activity_id (活动id) | id
template_id (模板id)| template_id
order_by (顺序)| order_by
is_recommend (推荐)| is_recommend
status (状态)| status
视图product_search_sort_weight 来源:product_search_sort视图和yh_shops库product_search表
视图product_search_sort_weight
SELECT
`pss`.`product_skn` AS `product_skn`,
`pss`.`sort_weight_id` AS `sort_weight_id`,
`ps`.`int_value` AS `sort_weight`
FROM
(
`product_search_sort` `pss`
JOIN `product_search` `ps`
)
WHERE
(
`pss`.`sort_weight_id` = `ps`.`id`
)
product_search_sort
SELECT
`product_search`.`product_skn` AS `product_skn`,
max(`product_search`.`id`) AS `sort_weight_id`
FROM
`product_search`
WHERE
(
(
`product_search`.`model_id` = 1
)
AND (
`product_search`.`project_id` = 4
)
)
GROUP BY
`product_search`.`product_skn`
ProductIndex字段 |yh_shops-->product_search_sort_weight 条件: product.
product_skn=
product_search_sort_weight.
product_skn`
-----|-----|
sort_weight (排序权重)|if(sort_weight==NULL)sort_weight=0 else sort_weight 来源product_search的int_value字段
视图product_search_brand_weight 来源:product_search_brand视图和yh_shops库product_search表
视图product_search_brand_weight
SELECT
`psb`.`product_skn` AS `product_skn`,
`psb`.`brand_weight_id` AS `brand_weight_id`,
`ps`.`int_value` AS `brand_weight`
FROM
(
`product_search_brand` `psb`
JOIN `product_search` `ps`
)
WHERE
(
`psb`.`brand_weight_id` = `ps`.`id`
)
视图 视图product_search_brand
SELECT
`product_search`.`product_skn` AS `product_skn`,
max(`product_search`.`id`) AS `brand_weight_id`
FROM
`product_search`
WHERE
(
(
`product_search`.`model_id` = 1
)
AND (
`product_search`.`project_id` = 1
)
)
GROUP BY
`product_search`.`product_skn`
ProductIndex字段 |yh_shops库product_search_brand_weight表 条件: product.
product_skn=
product_search_brand_weight.
product_skn`
-----|-----|
brand_weight(品牌权重)| if(brand_weight==NULL)brand_weight=0 else brand_weight 来源:product_search 库int_value字段
yh_shops-->product_activities_link
ProductIndex字段 | yh_shops库product_activities_link表 条件: product. product_skn= product_activities_link. product_skn` |
---|---|
yohood_id | activities_id |
视图base_pin_ratio 来源:yh_shops库free_size_product表 和 视图base_pin_ratio_new_date
视图base_pin_ratio:
SELECT
`a`.`product_skn` AS `product_skn`,
`a`.`base_pin_ratio` AS `base_pin_ratio`
FROM
(
`free_size_product` `a`
JOIN `base_pin_ratio_new_date` `b`
)
WHERE
(
`a`.`date_id` = `b`.`date_id`
)
视图base_pin_ratio_new_date
`
SELECT
t.
date_idAS
date_id
FROM
free_size_productt
ORDER BY
t.
date_id` DESC
LIMIT 1
`
ProductIndex字段 |yh_shops库base_pin_ratio表 条件:
product.product_skn
= base_pin_ratio
.product_skn
-----|-----|
base_pin_ratiobase_pin_ratio 来源 free_size_product表base_pin_ratio字段
broken_code视图 来源 yh_shops库nonfree_size_product表 和视图broken_code_date
视图broken_code视图:
`
SELECT
a.
product_sknAS
product_skn,
a.
breaking_rateAS
breaking_rate
FROM
(
nonfree_size_producta
JOIN
broken_code_dateb
)
WHERE
(
a.
date_id=
b.
date_id`
)
视图broken_code_date
(
SELECT
t
.date_id
AS date_id
FROM
nonfree_size_product
t
ORDER BY
t
.date_id
DESC
LIMIT 1
)
``
ProductIndex字段 | yh_shops库broken_code表 product. product_skn= breaking_rate. breaking_rate` |
---|---|
breaking_rate(断码率) | breaking_rate 来源 nonfree_size_product表breaking_rate字段 |
视图discount_product_skns 来源:yh_shops库discount_product表
ProductIndex字段 | yh_shops-->discount_product_skn product. product_skn= discount_product_skn. product_skn` |
---|---|
discount_score | score |
pool_id(商品池) | pool_id 一个product_skn对应discount_product中的记录的pool_id字段拼起来 |