##大盘表
dapan_sql='''
select id,sku_no,price,cid1,cid2,cid3,brand_name,brand_id from
    offline_recommend.recommend_same_product 
'''

##根据cid3获取cid2，cid1等数据
cid1_3_sql="""
select distinct c_id1,c_id2,c_id3 from kdsp.t_sku_info
"""

##商品表
skuinfo_sql='''
select id,sku_no,sku_name,price,cid1,cid2,cid3,brand_name,brand_id,source_type from
    offline_recommend.recommend_product_info
'''
##相似表
similar_redis='product_similarity:{skuno}'

##商品关联度
correlation_redis='product_correlation:${skuNo}'

##上一批次
nearly_batch_sql="""
select a.*,b.sku_no,b.recall_reason from 
(select id,recall_batch_uuid,event_type from nearline_recommend_test.recommend_product_batch where user_uuid='{}' order by id desc limit 1)a
join nearline_recommend_test.recommend_product_record b on a.recall_batch_uuid=b.recall_batch_uuid
"""

cur_batch_sql="""
select id,recall_batch_uuid,event_type from nearline_recommend.recommend_product_batch 
"""



#b.jg_id,b.category_id,b.category_level,b.final_score,a.rank,a.click_num
hot_jd150_sql="""
select distinct {}  from offline_recommend.jg_heat_rank 
join offline_recommend.jg_intention_score  on jg_heat_rank.jg_id=jg_intention_score.jg_id
order by jg_heat_rank.rank desc
"""

##推荐位用户意图得分表
jd_hot_sql="""
select jg_id,category_id,category_level,brand_name,final_score from offline_recommend.jg_intention_score 
"""

##金刚位大盘表-金刚位热度表
jg_dapan_sql="""
select * from offline_recommend.jg_heat_rank  order by rank desc limit 30
"""

##推荐位用户意图得分表
jg_purpost_sql="""

"""


jg_purpost_all_sql="""
select * from   where cid3={} or cid2={} or cid1={} or brand_name='{}'
"""

#图关联表
graph_redis="""
product_graph:{sku_no}
"""
graph_relation_sql="""
select * from xyqb_recommender_system.mix_products_graph 
"""
##ALS相关表
als_redis="""
product_correlation:{sku_no}
"""
als_sql="""
select * from xyqb_recommender_system.mix_products_correlation 
"""

dapan_hot_sql="""
select * from 
xyqb_recommender_system.kdsp_same_ranked_list
"""
##获取上一批次记录后，再去mysql批次表里拿数据
back_batch_redis="""
recommend_recall:{uuid}:{sku_no}
"""

##支付图关联表,有序列表
pay_product_redis="""pay_product_graph:{sku_no}"""
##下单图关联表,有序列表
order_product_redis="""
order_product_graph:{sku_no}
"""
##加购图关联表,字符串
product_redis="""
product_graph:{sku_no}
"""
##ALS关联度表，有序列表
als_correlation_redis="""
product_correlation:{sku_no}
"""

###more-热度表（大盘热度表）
cate_brand_heat_rank_sql="""
select * from 
offline_recommend.cate_brand_heat_rank 
"""

###more-用户意图得分表
cate_brand_intention_score_sql="""
select * from 
offline_recommend.cate_brand_intention_score 
"""


###query热词的相似表
recommend_hot_query_similar_info_sql="""
select * from online_recommend.recommend_hot_query_similar_info
"""

###商品和关键词的匹配度
recommend_sku_query_match_info_sql="""
select * from online_recommend.recommend_sku_query_match_info
"""

####################################商品冷启动###############################################################
####用户历史意图表-商品冷启动
cold_start_user_history_cid3_intentions_sql="""
select * from offline_recommend.cold_start_user_history_cid3_intentions 
 where uuid='{}' or gid='{}' 
 order by event_time desc limit 3 
"""

###用户实时cid3意图表
recommend_user_intent_sql="""
select distinct aa.event_type,aa.intent_cid3 from nearline_recommend.recommend_user_intent  aa join 
(select user_uuid,event_type,MAX(create_time) as create_time from nearline_recommend.recommend_user_intent
where user_uuid='{}' or device_id='{}' 
 GROUP BY user_uuid,event_type limit 3)bb on aa.event_type=bb.event_type 
 and aa.create_time=bb.create_time and aa.user_uuid=bb.user_uuid
"""

###用户意图大盘补足
cold_start_cid3_heat_intentions_timestamp_redis="""cold_start_cid3_heat_intentions"""
cold_start_cid3_heat_intentions_redis="""cold_start_cid3_heat_intentions:{}"""
#########################################################################################################

###etrec召回表，etrec表示训练模型名
kdsp_personalize_recall_etrec_sql="""
select item_ids from offline_recommend.kdsp_personalize_recall_etrec 
"""

###swing召回表，swing表示训练模型名
kdsp_personalize_recall_swing_sql="""
select item_ids from offline_recommend.kdsp_personalize_recall_swing 
"""