|
@@ -5,12 +5,13 @@ from model.CommonUtils import *
|
|
|
du = DateUtils()
|
|
|
log = logger()
|
|
|
|
|
|
-def book_rank(start,end,book,page,page_size,order_by,order):
|
|
|
+def book_rank(start,end,book,stage,page,page_size,order_by,order):
|
|
|
db=MysqlUtils()
|
|
|
op1=f" and book='{book}'" if book else ''
|
|
|
op2 = f" and dt>='{start}' " if start else ''
|
|
|
op3 = f" and dt<='{end}' " if end else ''
|
|
|
op4 = f" order by {order_by} {order}" if order_by and order else ''
|
|
|
+ op5=f" and stage='{stage}'" if stage else ''
|
|
|
|
|
|
sql=f"""select
|
|
|
concat(DATE_FORMAT(min(dt),'%Y/%m/%d') ,'~',DATE_FORMAT(max(dt),'%Y/%m/%d')) date,
|
|
@@ -26,7 +27,7 @@ sum(first_order_amount) first_amount,
|
|
|
sum(reg_order_amount) reg_amount,
|
|
|
round(sum(first_order_amount)/sum(cost),4) first_roi,
|
|
|
round(sum(reg_order_amount)/sum(cost),4) roi
|
|
|
-from dw_channel where 1=1 {op1} {op2} {op3} GROUP BY channel,book,pitcher
|
|
|
+from dw_channel where 1=1 {op1} {op2} {op3} {op5} GROUP BY channel,book,pitcher
|
|
|
{op4}"""
|
|
|
print(sql)
|
|
|
return getLimitData(db.dm,sql,page,page_size)
|