|数据库名称|SQL语句|总执行次数|总执行时间(秒)|最大执行时长|平均执行时间|锁定总时长|最大锁定时长|解析总行数|解析最大行数|返回总行数|返回最大行数|
| - | - | - | - | - | - | - | - | - | - | - | - |
|v4_sales|SELECT count(es.id) FROM v4_sales.erp_sales es JOIN v4_sales.warranty_can_added wca ON wca.sales_id=es.id AND if(wca.source=?,es.sales_date>=?,wca.create_time>=?) AND wca.tenant_id=? AND wca.tenant_app_id=? LEFT JOIN v4_sales.warranty w ON w.sales_id=es.id AND w.tenant_id=? AND w.tenant_app_id=? WHERE es.sales_status=? AND is_sales=? AND es.employee_erp_id=? AND dept_erp_id=? AND w.id IS ? AND es.tenant_id=? AND es.tenant_app_id=?|1208|2245|8||0|0|4690971|56279|1208|1|
|youzan|SELECT id,merchant_id,merchant_shop_id,sync_type,api_name,api_request,api_response,status,error_msg,retry_num,create_time,update_time FROM weimob_platform_sync_log WHERE (status=? AND sync_type IN (?) AND retry_num<?)|427|1470|17||0|0|49213031|115253|0|0|
|v4_employee|SELECT ? AS task_type,t.system_task_type,count(*) AS undo_count FROM task_task t JOIN task_system_task_template st ON t.task_template_id=st.id AND st.status=? AND st.tenant_id=? AND st.tenant_app_id=? WHERE t.`status`=? AND t.finish_time IS ? AND t.end_time>? AND shop_id=? AND employee_id=? AND t.task_template_id IN (?) AND t.tenant_id=? AND t.tenant_app_id=? GROUP BY t.system_task_type|256|423|6||0|0|646247|7733|560|5|
|youzan|SELECT id,merchant_shop_id,api_name,api_request,api_response,status,error_msg,retry_num,sync_type,create_time,update_time FROM youzan_platform_sync_log WHERE (status=? AND retry_num<? AND create_time>?)|176|343|10||0|0|30943792|175817|0|0|
|corpwx|SELECT t.tenant_id AS tenantId,t.wx_user_id AS wxUserId,t.union_id AS wxUnionId,t.user_id AS externalUserId,ifnull(et.raw_external_user_id,t.old_user_id) AS rawExternalUserId,t.corp_user_id AS employeeCorpUserId FROM corpwx.external_user t LEFT JOIN corpwx.external_userid_transform et ON t.tenant_id=et.tenant_id AND t.user_id=et.external_user_id WHERE t.tenant_id=? AND t.status=? AND t.user_id IN|169|283|6||0|0|267738|2356|120528|1077|
|v4_sales|SELECT id,comment_id,subject_id,subject_type,subject,score,labels,content,tenant_id,tenant_app_id,create_time,update_time FROM comment_detail WHERE (comment_id=?) AND tenant_id=? AND tenant_app_id=?|142|302|7||0|0|44731350|315870|710|5|
|tenant|SELECT sales_date FROM tenant.erp_sales WHERE tenant_id=? AND tenant_wechatapp_id=? AND member_erp_id=? AND sales_erp_id<? AND is_sales=? AND sales_status=? ORDER BY sales_erp_id ASC LIMIT ?|123|306|6||0|0|2139237|40210|123|1|
|user_service|SELECT count(?) FROM user_service.tenant_member t? JOIN user_service.tenant_member_info t? ON t?.tenant_id=t?.tenant_id AND t?.id=t?.id AND t?.tenant_app_id=? AND t?.shop_id=? JOIN user_service.user_employee ue ON t?.tenant_id=ue.tenant_id AND t?.tenant_app_id=ue.tenant_wechatapp_id AND t?.user_id=ue.user_id AND ue.employee_id=? AND ue.shop_id=? WHERE t?.tenant_id=? AND t?.tenant_app_id=?|121|222|7||0|0|1027083|295707|121|1|
|v4_employee|SELECT ? AS task_type,t?.id AS invite_task_id,t?.name,ifnull(t?.undo_count,?) AS undo_count,t?.invite_time AS invite_task_start_time,ifnull(t?.interrupt_time,t?.end_time) AS invite_task_end_time FROM task_invite_task_template t? LEFT JOIN (SELECT t.task_template_id AS id,sum(if(t.finish_time IS ?,?,?)) AS undo_count FROM task_task t WHERE t.task_type=? AND t.`status`=? AND t.end_time>? AND t.shop_id=? AND t.employee_id=? AND t.tenant_id=? AND t.tenant_app_id=? GROUP BY t.task_template_id)t? ON t?.id=t?.id WHERE t?.status IN (?) AND t?.tenant_id=? AND t?.tenant_app_id=? ORDER BY t?.id DESC|108|224|9||0|0|1272712|19284|1029|59|
|user_service|SELECT tu.user_id,tm.shop_id,mb.erp_member_id memberErpId,tu.mobile_no,tu.user_name,ue.employee_id,tm.grade_id FROM user_service.tenant_member tu INNER JOIN user_service.tenant_member_info tm ON tu.tenant_id=tm.tenant_id AND tu.id=tm.id INNER JOIN user_service.tenant_member_bind mb ON tu.tenant_id=mb.tenant_id AND tu.id=mb.id LEFT JOIN user_service.user_employee ue ON tu.tenant_app_id=ue.tenant_wechatapp_id AND tu.user_id=ue.user_id WHERE tu.tenant_id=? AND tu.tenant_app_id=? AND tu.status=? AND mb.erp_member_id IN (?)|97|246|8||0|0|42514897|1430073|5964|437|
|tenant|SELECT es.id,es.sales_no,es.sales_date,es.member_erp_id,es.sales_erp_id,es.is_sales FROM erp_sales es WHERE es.tenant_id=? AND es.tenant_wechatapp_id=? AND es.sales_status=? AND es.sales_no LIKE concat(?,?) ORDER BY es.sales_date DESC LIMIT ?|64|177|13||0|0|20253744|468062|14|1|
|user_service|SELECT * FROM user_service.user_employee WHERE employee_erp_id=? AND tenant_id=? AND tenant_wechatapp_id=? AND date_format(update_time,?)=date_format(now(),?)|62|901|52||0|0|10132642|328622|65335|7518|
|v4_sales|SELECT ifnull(sum(integral),?)points FROM v4_sales.erp_sales es JOIN v4_sales.erp_sales_detail esd ON esd.sales_erp_id=es.sales_erp_id AND esd.tenant_id=? AND esd.tenant_app_id=? WHERE es.member_erp_id IN (?) AND es.sales_status=? AND es.is_sales=? AND esd.sales_type=? AND es.tenant_id=? AND es.tenant_app_id=?|61|198|9||0|0|1130319|37246|61|1|
|gift_mail|SELECT p.id,p.product_name,p.tag_price,i.volume,p.product_status AS status,p.default_image_url,i.quantity,i.market_price,if(prp.id IS ?,?,?) AS hasRecommend FROM gift_mail.platform_product p JOIN gift_mail.platform_inventory i ON i.product_id=p.id LEFT JOIN gift_mail.platform_recommend_product prp ON prp.tenant_app_id=? AND prp.is_recommend=? AND prp.platform_product_id=p.id WHERE prp.id IS ? AND p.product_status=? ORDER BY i.volume DESC ,p.tag_price ASC ,p.id DESC LIMIT ?|59|71|2||0|0|524854|8899|354|6|
|tenant|SELECT count(?) FROM erp_sales es WHERE es.tenant_id=? AND es.tenant_wechatapp_id=? AND es.sales_date>=? AND es.employee_erp_id=? AND es.sales_status=?|48|87|7||0|0|157631|9755|48|1|
|v4_user|SELECT id,member_id,external_user_id,serial_number,checkin_shop_id,checkin_employee_id,checkin_employee_name,checkin_time,maintain_shop_id,maintain_employee_id,maintain_employee_name,first_maintain_time,last_maintain_time,next_maintain_time,maintain_num,intention_num,latest_intention,status,finish_time,finish_shop_id,deal_employee_id,deal_employee_name,deal_sale_amount,fail_employee_id,fail_employee_name,fail_reason,remark,sex,cutomer_grade,maintain_level,tenant_id,tenant_app_id,create_time,update_time FROM potential_customer WHERE ((member_id=? OR external_user_id=?) AND status IN (?)) AND tenant_id=? AND tenant_app_id=?|40|144|12||0|0|319024|8371|6|1|
|v4_sales|SELECT * FROM v4_sales.value_added_record WHERE value_added_id=? AND date_format(create_time,?)=? AND tenant_id=? AND tenant_app_id=?|38|45|5||0|0|90247289|2379243|0|0|
|gift_mail|SELECT count(*) FROM gift_mail.trade t LEFT JOIN gift_mail.trade_take tt ON tt.trade_id=t.id WHERE t.tenant_id=? AND t.tenant_wechatapp_id=? AND t.trade_type=? AND t.order_status=? AND t.take_type=? AND tt.shop_id=?|34|51|2||0|0|157504|8402|34|1|
|authorization_service|SELECT ar.tenant_id,ar.tenant_app_id,a.employee_id,ar.shop_id,ar.role_code,ar.role_name,a.status AS account_status,ar.status AS role_status FROM authorization_service.account_role? ar JOIN authorization_service.account a ON ar.account_id=a.id WHERE ar.tenant_id=? AND ar.tenant_app_id=? AND ar.shop_id=?|33|42|2||0|0|2177291|66019|835|63|
|v4_sales|SELECT round(avg(cd.score),?) FROM comment c JOIN comment_detail cd ON cd.comment_id=c.id AND cd.tenant_id=? AND cd.tenant_app_id=? WHERE c.erp_dept_id=? AND c.erp_employee_id=? AND c.create_time BETWEEN ? AND ? AND c.tenant_id=? AND c.tenant_app_id=?|33|56|3||0|0|10394860|316035|33|1|
|corpwx|SELECT t.tenant_id AS tenantId,t.wx_user_id AS wxUserId,t.union_id AS wxUnionId,t.user_id AS externalUserId,ifnull(et.raw_external_user_id,t.old_user_id) AS rawExternalUserId,t.corp_user_id AS employeeCorpUserId FROM corpwx.external_user t LEFT JOIN corpwx.external_userid_transform et ON t.tenant_id=et.tenant_id AND t.user_id=et.external_user_id WHERE t.tenant_id=? AND t.status=? AND t.user_id IN (?) AND t.un_assign_flag=?|32|50|2||0|0|24284|985|11456|463|
|gift_mail|SELECT count(*) FROM gift_mail.trade t LEFT JOIN gift_mail.trade_take tt ON tt.trade_id=t.id WHERE t.tenant_id=? AND t.tenant_wechatapp_id=? AND t.trade_type IN (?) AND t.order_status=? AND t.take_type=? AND tt.shop_id=?|32|48|2||0|0|141978|8084|32|1|
|corpwx|UPDATE external_user SET un_assign_flag=? WHERE (tenant_id=? AND status=? AND un_assign_flag=?)|31|111|8||0|0|826456|73914|0|0|
|v4_sales|SELECT count(DISTINCT sales_date) FROM v4_sales.erp_sales WHERE member_erp_id IN (?) AND is_sales=? AND sales_status=? AND tenant_id=? AND tenant_app_id=?|28|68|5||0|0|321952|15158|28|1|
|v4_user|SELECT id,checkin_employee_name,maintain_employee_name FROM potential_customer WHERE ((external_user_id=? OR member_id=?) AND status IN (?)) AND tenant_id=? AND tenant_app_id=? ORDER BY id ASC|26|90|9||0|0|217398|8369|9|1|
|v4_user|SELECT id,member_id,external_user_id,serial_number,checkin_shop_id,checkin_employee_id,checkin_employee_name,checkin_time,maintain_shop_id,maintain_employee_id,maintain_employee_name,first_maintain_time,last_maintain_time,next_maintain_time,maintain_num,intention_num,latest_intention,status,finish_time,finish_shop_id,deal_employee_id,deal_employee_name,deal_sale_amount,fail_employee_id,fail_employee_name,fail_reason,remark,sex,cutomer_grade,maintain_level,tenant_id,tenant_app_id,create_time,update_time FROM potential_customer WHERE ((member_id=?) AND status IN (?) AND maintain_shop_id=?) AND tenant_id=? AND tenant_app_id=?|25|41|4||0|0|57028|2339|5|1|
|user_service|SELECT tm.user_id AS id,tm.user_name AS userName,tm.head_img_url AS headImgUrl,tm.user_name AS nickName,tm.mobile_no AS mobile,tm.sex FROM user_service.tenant_member tm WHERE tm.tenant_id=? AND tm.tenant_app_id=? AND (tm.user_name LIKE CONCAT(?,?,?) OR tm.mobile_no=?) ORDER BY tm.id DESC LIMIT ?|24|42|5||0|0|9724485|477240|25|2|
|v4_sales|SELECT * FROM erp_sales WHERE member_erp_id=? AND is_sales=? AND sales_status=? AND id<? AND tenant_id=? AND tenant_app_id=? ORDER BY sales_date ASC,sales_erp_id ASC LIMIT ?|24|63|6||0|0|860897|54281|24|1|
|user_service|SELECT count(?) FROM user_service.tenant_member tm JOIN user_service.tenant_member_info tmi ON tm.tenant_id=tmi.tenant_id AND tm.id=tmi.id LEFT JOIN user_service.user_employee t? ON tm.user_id=t?.user_id AND tm.tenant_id=t?.tenant_id AND tm.tenant_app_id=t?.tenant_wechatapp_id WHERE t?.id IS ? AND tmi.shop_id=? AND tmi.tenant_id=? AND tmi.tenant_app_id=?|22|148|18||0|0|3648201|365360|22|1|
|v4_sales|SELECT COUNT(*) AS total FROM v4_sales.erp_sales es JOIN v4_sales.warranty_can_added wca ON wca.sales_id=es.id AND wca.tenant_id=? AND wca.tenant_app_id=? LEFT JOIN v4_sales.warranty w ON w.sales_id=es.id AND w.tenant_id=? AND w.tenant_app_id=? WHERE is_sales=? AND sales_status=? AND es.employee_erp_id=? AND es.dept_erp_id=? AND if(wca.source=?,es.sales_date>=?,date_format(wca.create_time,?)>=?) AND w.id IS NOT ? AND es.tenant_id=? AND es.tenant_app_id=?|20|32|3||0|0|119265|11461|20|1|
|gift_mail|SELECT count(?) FROM (SELECT p.id,p.product_name,p.tag_price,i.volume,p.product_status AS status,p.default_image_url,i.quantity,i.market_price,if(prp.id IS ?,?,?) AS hasRecommend FROM gift_mail.platform_product p JOIN gift_mail.platform_inventory i ON i.product_id=p.id LEFT JOIN gift_mail.platform_recommend_product prp ON prp.tenant_app_id=? AND prp.is_recommend=? AND prp.platform_product_id=p.id WHERE prp.id IS ? AND p.product_status=? ORDER BY i.volume DESC ,p.tag_price ASC ,p.id DESC)tmp_count|20|25|1||0|0|156080|7804|20|1|
|v4_employee|SELECT count(?) AS total_count,count(finish_time) AS finish_count FROM task_task t JOIN task_system_task_template t? ON t.task_template_id=t?.id AND t?.status=? AND t?.tenant_id=? AND t?.tenant_app_id=? WHERE t.task_type=? AND t.status=? AND t.start_time>=? AND t.start_time<? AND t.shop_id=? AND t.tenant_id=? AND t.tenant_app_id=?|19|38|4||0|0|181270|31651|19|1|
|user_service|SELECT count(?) FROM user_service.user_employee ue JOIN user_service.tenant_member tm ON tm.tenant_id=ue.tenant_id AND tm.tenant_app_id=ue.tenant_wechatapp_id AND tm.user_id=ue.user_id WHERE ue.employee_id=? AND ue.tenant_id=? AND ue.tenant_wechatapp_id=? AND ue.shop_id=?|18|54|15||0|0|5366340|298130|18|1|
|user_service|SELECT count(*) FROM user_service.user_employee ue WHERE ue.tenant_id=? AND ue.employee_id=? AND ue.tenant_wechatapp_id=? AND ue.shop_id=?|16|26|4||0|0|74665|12394|16|1|
|gift_mail|SELECT count(?) FROM (SELECT p.id,p.default_image_url,p.product_name,p.product_type,p.tag_price,ifnull(pp.integral_price,ifnull((SELECT min(inventory.price) FROM gift_mail.inventory WHERE inventory.product_id=p.id),?)) AS price,p.volume,p.category_id,p.product_status,? AS quantity,pp.partner_id AS partner_id,p.topping FROM gift_mail.product p LEFT JOIN gift_mail.partner_product pp ON p.id=pp.product_id LEFT JOIN gift_mail.product_status ps ON ps.product_id=p.id WHERE p.tenant_id=? AND product_status=? AND (p.is_disable IS ? OR p.is_disable=?) AND (ps.tenant_wechatapp_id=? OR p.product_type=?)) AS p WHERE (p.topping=?)|16|18|1||0|0|289150|18315|16|1|
|user_service|SELECT count(?) FROM user_service.tenant_member tm JOIN user_service.user_employee ue ON ue.tenant_id=? AND ue.tenant_wechatapp_id=? AND tm.user_id=ue.user_id AND ue.employee_id=? AND ue.shop_id=? WHERE tm.tenant_id=? AND tm.tenant_app_id=?|16|172|25||0|0|1122753|100179|16|1|
|order|SELECT count(*) FROM `order`.order_info WHERE tenant_id=? AND tenant_wechatapp_id=? AND take_type=? AND status=? AND (wait_take_shop_id=? OR take_shop_id=?)|15|25|3||0|0|56566|3816|15|1|
|v4_sales|SELECT t?.sales_erp_id AS salesErpId,t?.sales_no AS salesNo,DATE_FORMAT(t?.sales_date,?) AS salesDate,t?.member_erp_id AS memberId,t?.employee_erp_id AS employeeErpId,t?.employee_name AS employeeName,t?.assist_employee_erp_id AS assistEmployeeErpId,t?.assist_employee_name AS assistEmployeeName,t?.dept_erp_id AS deptErpId,t?.amount,t?.post_time AS postTime FROM erp_sales t? WHERE t?.employee_erp_id=? AND t?.post_time>=? AND t?.post_time<=? AND t?.sales_status=? AND NOT EXISTS (SELECT ? FROM erp_sales_relate esr WHERE t?.tenant_id=esr.tenant_id AND t?.tenant_app_id=esr.tenant_app_id AND t?.sales_erp_id=esr.sales_erp_id AND esr.sales_status IN (?) AND esr.tenant_id=? AND esr.tenant_app_id=?) AND EXISTS (SELECT ? FROM erp_sales_detail esd WHERE t?.tenant_id=esd.tenant_id AND t?.tenant_app_id=esd.tenant_app_id AND t?.sales_erp_id=esd.sales_erp_id AND esd.sales_type IN (?) AND esd.tenant_id=? AND esd.tenant_app_id=?) AND t?.tenant_id=? AND t?.tenant_app_id=?|15|25|4||0|0|52148|5980|23|4|
|order|SELECT max(create_time) FROM `order`.order_operator_log WHERE tenant_wechatapp_id=? AND order_id=?|14|107|22||0|0|15243459|1089030|14|1|
|user_service|SELECT t?.id,t?.user_id AS userId,t?.user_name AS userName,t?.sex,t?.mobile_no AS mobileNo,t?.head_img_url AS headImg FROM user_service.tenant_member t? JOIN user_service.tenant_member_info t? ON t?.tenant_id=t?.tenant_id AND t?.id=t?.id AND t?.tenant_app_id=? AND t?.shop_id=? JOIN user_service.user_employee ue ON t?.tenant_id=ue.tenant_id AND t?.tenant_app_id=ue.tenant_wechatapp_id AND t?.user_id=ue.user_id AND ue.employee_id=? AND ue.shop_id=? WHERE t?.tenant_id=? AND t?.tenant_app_id=? ORDER BY ue.update_time DESC,t?.id DESC LIMIT ?|14|25|2||0|0|197712|55782|140|10|
|employee|SELECT count(*) FROM label_task_employee t? JOIN label_task_setting t? ON t?.label_task_id=t?.id AND t?.disabled=? WHERE t?.tenant_app_id=? AND t?.shop_id=? AND t?.visit_status>? AND t?.finish_time>=DATE_SUB(CURRENT_DATE,INTERVAL ? day) AND t?.finish_time<CURRENT_DATE|13|22|3||0|0|301025|54695|13|1|
|tenant|SELECT count(?) FROM (SELECT shop.*,dept.dept_name,count(es.id) AS employeesCount FROM tenant_wechatapp_shop shop LEFT JOIN erp_department dept ON shop.dept_erp_id=dept.dept_erp_id AND shop.tenant_id=dept.tenant_id LEFT JOIN employee_shop es ON shop.id=es.shop_id AND es.status IN (?) WHERE shop.tenant_wechatapp_id=? AND shop.status IN (?) GROUP BY shop.id)table_count|13|16|1||0|0|1213490|93373|13|1|
|user_service|SELECT ue.id AS userEmployeeId,ue.tenant_id AS tenantId,ue.tenant_wechatapp_id AS tenantAppId,ue.shop_id AS shopId,tu.user_id AS userId,tu.user_name AS nickName,tu.user_name AS userName,tu.mobile_no AS mobileNo,tu.head_img_url AS headImgUrl FROM user_service.user_employee ue JOIN user_service.tenant_member tu ON tu.tenant_id=ue.tenant_id AND ue.tenant_wechatapp_id=tu.tenant_app_id AND ue.user_id=tu.user_id WHERE ue.tenant_id=? AND ue.tenant_wechatapp_id=? AND ue.employee_id=? AND ue.shop_id=?|12|71|19||0|0|1285353|313771|91210|17444|
|user_service|SELECT count(?) FROM user_service.tenant_member tm WHERE tm.tenant_id=? AND tm.tenant_app_id=? AND (tm.user_name LIKE CONCAT(?,?,?) OR tm.mobile_no=?)|12|25|4||0|0|2181954|481672|12|1|
|v4_user|SELECT id,member_id,external_user_id,serial_number,checkin_shop_id,checkin_employee_id,checkin_employee_name,checkin_time,maintain_shop_id,maintain_employee_id,maintain_employee_name,first_maintain_time,last_maintain_time,next_maintain_time,maintain_num,intention_num,latest_intention,status,finish_time,finish_shop_id,deal_employee_id,deal_employee_name,deal_sale_amount,fail_employee_id,fail_employee_name,fail_reason,remark,sex,cutomer_grade,maintain_level,tenant_id,tenant_app_id,create_time,update_time FROM potential_customer WHERE ((member_id=? OR external_user_id=?) AND status IN (?) AND maintain_shop_id=?) AND tenant_id=? AND tenant_app_id=?|11|19|3||0|0|25662|2338|2|1|
|user_service|SELECT count(?) FROM user_service.tenant_member t? JOIN user_service.tenant_member_info t? ON t?.tenant_id=t?.tenant_id AND t?.id=t?.id AND t?.tenant_app_id=? AND t?.shop_id=? WHERE t?.tenant_id=? AND t?.tenant_app_id=?|10|20|2||0|0|553199|240633|10|1|
|coupon_service|SELECT market_id AS id,count(market_id) AS quantity FROM (SELECT market_id FROM coupon_service.coupon_market_order WHERE market_id IN (?) AND order_state=? GROUP BY user_id,market_id)number GROUP BY market_id|10|79|27||0|0|5730958|573853|150|16|
|user_service|SELECT count(*) FROM user_service.tenant_member_info t WHERE t.tenant_id=? AND t.tenant_app_id=? AND t.shop_id=?|10|25|5||0|0|1788198|178829|10|1|
|user_service|SELECT count(?) FROM user_service.user_source us LEFT JOIN user_service.tenant_member m ON m.user_id=us.user_id LEFT JOIN user_service.user_employee ue ON ue.user_id=m.user_id WHERE m.tenant_id=? AND m.tenant_app_id=? AND us.tenant_id=? AND us.tenant_wechatapp_id=? AND ue.tenant_id=? AND ue.tenant_wechatapp_id=? AND us.shop_id=? AND us.from_id=? AND us.create_time>=? AND us.create_time<? AND us.source_type=? AND us.from_id IS NOT ? AND us.shop_id IS NOT ?|10|21|3||0|0|17398|1756|10|1|
|employee|UPDATE backlog_? SET status=?,finish_time=now() WHERE tenant_app_id=? AND employee_id=? AND status IN (?) AND shop_id=?|9|20|3||0|0|57721|9861|0|0|
|v4_employee|SELECT COUNT(*) AS total FROM task_task t JOIN employee e ON e.employee_id=t.employee_id AND e.shop_id=t.shop_id AND e.tenant_id=? AND e.tenant_app_id=? LEFT JOIN (SELECT task_id,GROUP_CONCAT(file_url SEPARATOR ?) AS task_attaches FROM task_task_attach WHERE tenant_id=? AND tenant_app_id=? GROUP BY task_id)tta ON t.id=tta.task_id WHERE t.status=? AND system_task_type=? AND t.shop_id=? AND finish_time>=? AND finish_time<? AND t.employee_id=? AND t.tenant_id=? AND t.tenant_app_id=?|9|30|9||0|0|1982470|307369|9|1|
|user_service|SELECT us.from_id AS id,count(?)total FROM user_source us WHERE us.tenant_id=? AND us.tenant_wechatapp_id=? AND us.shop_id=? AND us.create_time>=? AND us.create_time<? AND us.source_type=? AND us.from_id IS NOT ? AND us.shop_id IS NOT ? GROUP BY us.from_id ORDER BY count(?) DESC|9|12|1||0|0|41338|5162|270|30|
|order|SELECT id FROM order_operator_log WHERE tenant_wechatapp_id=? AND order_id=? AND (src_child_status=? AND dst_child_status=?) ORDER BY create_time DESC LIMIT ?|8|51|13||0|0|8706453|1088782|0|0|
|order|SELECT count(?) FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id LEFT JOIN order_address ad ON od.id=ad.order_id WHERE od.tenant_id=? AND od.tenant_wechatapp_id=? AND od.activity_id=?|8|17|4||0|0|176850|22110|8|1|
|user_service|SELECT tmb.erp_member_id AS member_erp_id,tm.tenant_id,tm.tenant_app_id,tm.mobile_no,tm.user_name,tmi.grade_id AS grade_erp_id FROM user_service.tenant_member tm JOIN user_service.tenant_member_bind tmb ON tm.tenant_id=tmb.tenant_id AND tm.id=tmb.id JOIN user_service.tenant_member_info tmi ON tm.tenant_id=tmi.tenant_id AND tm.id=tmi.id WHERE tmb.tenant_id=? AND tmb.tenant_app_id=? AND tmb.erp_member_id IN (?)|8|9|1||0|0|318|57|106|19|
|order|SELECT count(?) FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id LEFT JOIN order_address ad ON od.id=ad.order_id WHERE od.tenant_id=? AND od.tenant_wechatapp_id=? AND (od.mobile_no=? OR ad.mobile_no=?)|8|26|5||0|0|1443606|180684|8|1|
|user_service|SELECT tu.user_name AS memberName,tu.mobile_no AS mobile,emg.grade_name AS gradeLevel,tu.user_id AS memberUserId,tu.tenant_id AS tenantId,tu.tenant_app_id AS tenantAppId,ue.employee_id AS employeeId,ue.employee_erp_id AS employeeErpId,tmb.erp_member_id AS memberErpId,tmi.shop_id FROM user_service.tenant_member tu JOIN user_service.tenant_member_info tmi ON tu.tenant_id=tmi.tenant_id AND tu.id=tmi.id LEFT JOIN user_service.tenant_member_bind tmb ON tu.tenant_id=tmb.tenant_id AND tu.id=tmb.id LEFT JOIN user_service.erp_member_grade emg ON tu.tenant_id=emg.tenant_id AND tmi.grade_id=emg.grade_erp_id LEFT JOIN user_service.user_employee ue ON tu.tenant_id=ue.tenant_id AND tu.tenant_app_id=ue.tenant_wechatapp_id AND tu.user_id=ue.user_id WHERE tu.tenant_id=? AND tu.tenant_app_id=? AND tu.user_id IN|8|20|2||0|0|20000|2500|4000|500|
|v4_user|SELECT maintain_employee_id,id FROM potential_customer WHERE (maintain_shop_id=? AND status IN (?)) AND tenant_id=? AND tenant_app_id=?|8|11|2||0|0|15597|4091|2662|882|
|order|SELECT od.id,od.order_no orderNo,od.status,od.take_type takeType,od.create_time createTime,od.remark,od.total_fee totalFee,od.freight_fee freightFee,od.discount_fee discountFee,od.take_id takeId,od.payment_fee paymentFee,dt.product_id productId,dt.price,dt.quantity,dt.sku_id skuId,dt.art_no artNo,dt.image_url imageUrl,dt.product_name productName,dt.take_remark takeRemark,dt.take_day takeDay,od.product_fee productFee,ad.user_name receiveName,ad.mobile_no mobileNo,ad.shop_name shopName,ad.address,ad.express_no expressNo,ad.express_company expressCompany,od.user_name userName,od.update_time updateTime,od.child_status childStatus,od.finish_type finishType,od.receive_time receiveTime,od.user_id userId,od.mobile_no buyMobileNo,od.edit_fee_flag editFeeFlag,dt.spec spec,od.source,od.take_shop_id,od.take_shop_name,od.take_employee_user_id,od.take_employee_user_name,od.activity_type,od.activity_id,od.offline_payment_fee,od.online_wait_fee,od.offline_wait_fee,od.pay_way,od.take_employee_id,od.pay_id FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id LEFT JOIN order_address ad ON od.id=ad.order_id WHERE od.tenant_id=? AND od.tenant_wechatapp_id=? AND (od.mobile_no=? OR ad.mobile_no=?) ORDER BY od.create_time DESC LIMIT ?|8|24|5||0|0|1443273|180507|16|2|
|v4_coupon|UPDATE v4_coupon.coupon SET coupon_status=? WHERE tenant_id=? AND tenant_app_id=? AND coupon_status=? AND end_time<now()|8|18|6||0|0|5632791|1397523|0|0|
|v4_sales|SELECT count(s.sales_erp_id) FROM (SELECT es.tenant_id,es.tenant_app_id,es.sales_erp_id,esd.product_barcode,max(esd.category_erp_id)category_erp_id,max(es.sales_date)sales_date FROM v4_sales.erp_sales es JOIN v4_sales.erp_sales_detail esd ON esd.sales_erp_id=es.sales_erp_id AND esd.tenant_id=? AND esd.tenant_app_id=? WHERE dept_erp_id=? AND employee_erp_id=? AND es.sales_status=? AND es.is_sales=? AND es.tenant_id=? AND es.tenant_app_id=? GROUP BY es.tenant_id,es.tenant_app_id,es.sales_erp_id,esd.product_barcode)s LEFT JOIN v4_sales.value_added_ignore i ON i.erp_sales_id=s.sales_erp_id AND i.product_barcode=s.product_barcode AND i.tenant_id=? AND i.tenant_app_id=? LEFT JOIN v4_sales.value_added va ON va.erp_sales_id=s.sales_erp_id AND va.product_barcode=s.product_barcode AND va.tenant_id=? AND va.tenant_app_id=? JOIN v4_sales.value_added_category vac ON vac.erp_category_id=s.category_erp_id AND vac.status=? AND vac.tenant_id=? AND vac.tenant_app_id=? JOIN v4_sales.value_added_template vat ON vat.id=vac.template_id AND vat.status=? AND vat.tenant_id=? AND vat.tenant_app_id=? WHERE if(ifnull(vat.effective_date,?)!=?,s.sales_date>vat.effective_date,?=?) AND va.id IS ? AND i.id IS ?|8|10|1||0|0|102289|17990|8|1|
|order|SELECT count(?)total,ifnull(sum(if(od.status>?,od.payment_fee,?)),?)paymentFee,ifnull(sum(if(od.status>?,od.offline_payment_fee,?)),?)offlinePaymentFee,ifnull(sum(if(od.status>?,od.payment_fee+od.offline_payment_fee,?)),?)payTotalFee FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id LEFT JOIN order_address ad ON od.id=ad.order_id WHERE od.tenant_id=? AND od.tenant_wechatapp_id=? AND od.activity_id=?|8|17|4||0|0|176850|22110|8|1|
|v4_sales|SELECT COUNT(*) AS total FROM v4_sales.erp_sales es JOIN v4_sales.warranty_can_added wca ON wca.sales_id=es.id AND wca.tenant_id=? AND wca.tenant_app_id=? LEFT JOIN v4_sales.warranty w ON w.sales_id=es.id AND w.tenant_id=? AND w.tenant_app_id=? WHERE is_sales=? AND sales_status=? AND es.employee_erp_id=? AND es.dept_erp_id=? AND if(wca.source=?,es.sales_date>=?,date_format(wca.create_time,?)>=?) AND w.id IS ? AND es.tenant_id=? AND es.tenant_app_id=?|7|16|5||0|0|46304|15784|7|1|
|user_service|SELECT tmi.tenant_id,tmi.id,tmi.tenant_app_id,tmi.user_id,tmi.shop_id,tmi.birthday,tmi.birthday_is_lunar,tmi.address,tmi.memorial_name,tmi.memorial_day,tmi.memorial_day_is_lunar,tmi.interest,tmi.grade_id,tmi.create_time,tmi.update_time FROM user_service.tenant_member_info tmi JOIN user_service.tenant_member tm ON tm.tenant_id=? AND tm.tenant_app_id=? AND tm.user_id=tmi.user_id WHERE tmi.tenant_id=? AND tmi.tenant_app_id=? AND tm.status=? AND tmi.user_id IN|7|7|1||0|0|44845|10024|22309|5012|
|employee|SELECT count(*) FROM employee.backlog_? WHERE tenant_id=? AND tenant_app_id=? AND shop_id=? AND status=? AND expire_time BETWEEN ? AND ?|7|24|6||0|0|63272|11964|7|1|
|tenant|SELECT id,tenant_id,tenant_app_id,user_id,status,group_label,maintain_level,remark,create_time,create_shop_id,create_employee_id,update_time,update_shop_id,update_employee_id,sales_amount,next_maintain_date,maintain_employee_id,sneak_guest_no,last_maintain_date,finish_date,fail_type,oid,user_type FROM sneak_guest WHERE (tenant_app_id=? AND status=? AND create_shop_id=?) ORDER BY id DESC|7|9|1||0|0|46598|8448|23299|4224|
|v4_sales|SELECT COUNT(*) AS total FROM v4_sales.erp_sales es LEFT JOIN v4_sales.warranty w ON w.sales_id=es.id AND w.tenant_id=? AND w.tenant_app_id=? WHERE is_sales=? AND sales_status=? AND (es.sales_no LIKE concat(?,?) OR es.member_erp_id=?) AND w.id IS ? AND es.tenant_id=? AND es.tenant_app_id=?|7|18|5||0|0|1284984|370483|7|1|
|employee|SELECT count(?) FROM employee.backlog_? bg WHERE bg.tenant_app_id=? AND bg.scene NOT IN (?) AND bg.expire_time BETWEEN ? AND ? AND bg.shop_id=? AND bg.leave_flag=?|7|58|13||0|0|123425|29714|7|1|
|v4_sales|SELECT es.id salesId,es.sales_no,es.sales_date,es.member_erp_id memberId,w.warranty_no FROM v4_sales.erp_sales es LEFT JOIN v4_sales.warranty w ON w.sales_id=es.id AND w.tenant_id=? AND w.tenant_app_id=? WHERE is_sales=? AND sales_status=? AND (es.sales_no LIKE concat(?,?) OR es.member_erp_id=?) AND w.id IS ? AND es.tenant_id=? AND es.tenant_app_id=? ORDER BY es.sales_date DESC,es.id DESC LIMIT ?|7|12|3||0|0|1904130|638207|9|3|
|coupon_service|SELECT count(?) FROM coupon_service.coupon cu JOIN coupon_service.coupon_extend ce ON ce.tenant_id=? AND ce.tenant_app_id=? AND ce.id=cu.id JOIN (SELECT coupon_id FROM coupon_service.coupon_write_off_log wol WHERE wol.tenant_id=? AND wol.tenant_app_id=? AND wol.state=? AND wol.create_time>=? AND wol.create_time<=? GROUP BY coupon_id)w ON w.coupon_id=cu.id JOIN coupon_service.coupon_market_order_detail cmod ON cmod.tenant_id=? AND cmod.tenant_app_id=? AND cmod.coupon_id=cu.id JOIN coupon_service.coupon_market_order cmo ON cmo.tenant_id=? AND cmo.tenant_app_id=? AND cmod.order_id=cmo.id AND cmo.pay_type=? WHERE cu.tenant_id=? AND cu.tenant_app_id=? AND cu.create_time>=? AND cu.create_time<=? AND cu.source=?|6|173|34||0|0|39762210|6627035|6|1|
|v4_user|SELECT t?.id AS memberId,t?.id AS potentialCustomerId,t?.checkin_time AS checkinTime FROM potential_customer t? JOIN member t? ON t?.id=t?.member_id AND t?.tenant_id=? AND t?.tenant_app_id=? WHERE t?.maintain_shop_id=? AND t?.maintain_employee_id=? AND t?.`status` IN (?) AND t?.tenant_id=? AND t?.tenant_app_id=? UNION SELECT t?.id AS memberId,t?.id AS potentialCustomerId,t?.checkin_time AS checkinTime FROM potential_customer t? JOIN member t? ON t?.external_user_id=t?.external_user_id AND t?.tenant_id=? AND t?.tenant_app_id=? WHERE t?.maintain_shop_id=? AND t?.maintain_employee_id=? AND t?.`status` IN (?) AND t?.member_id=? AND t?.tenant_id=? AND t?.tenant_app_id=?|6|8|1||0|0|9222|3536|488|132|
|v4_employee|SELECT t.id AS task_id,t.employee_id,e.employee_name,t.member_id,t.member_name,t.finish_time,t.plan_arrival_shop_time,t.remark,tta.task_attaches FROM task_task t JOIN employee e ON e.employee_id=t.employee_id AND e.shop_id=t.shop_id AND e.tenant_id=? AND e.tenant_app_id=? LEFT JOIN (SELECT task_id,GROUP_CONCAT(file_url SEPARATOR ?) AS task_attaches FROM task_task_attach WHERE tenant_id=? AND tenant_app_id=? GROUP BY task_id)tta ON t.id=tta.task_id WHERE t.status=? AND system_task_type=? AND t.shop_id=? AND finish_time>=? AND finish_time<? AND t.employee_id=? AND t.tenant_id=? AND t.tenant_app_id=? ORDER BY t.finish_time DESC,t.id DESC LIMIT ?|6|10|2||0|0|1844102|307369|13|3|
|v4_employee|SELECT count(*) AS total_count,count(finish_time) AS finish_count,ifnull(sum(if(finish_time>=? AND finish_time<?,?,?)),?) AS todayFinishCount,count(send_coupons) AS coupon_send_count,count(recv_coupons) AS coupon_recv_count,count(accept_time) AS accept_count,count(arrival_shop_time) AS arrival_shop_count,count(trade_time) AS trade_count FROM task_task WHERE task_type=? AND status=? AND shop_id=? AND employee_id=? AND system_task_type=? AND start_time<=? AND end_time>? AND tenant_id=? AND tenant_app_id=?|6|7|1||0|0|7870|1881|6|1|
|tenant|SELECT count(*)amount FROM sneak_guest WHERE tenant_app_id=? AND status=? AND create_shop_id=? AND create_time<=?|6|7|1||0|0|22187|4224|6|1|
|gift_mail|SELECT count(?) FROM (SELECT t.*,tt.can_take_date,tt.shop_id,tt.shop_name,tt.take_shop_name,tt.take_employee_name,ta.recipients,ta.user_tel,CONCAT(ta.area,ta.address)address,if(t.trade_type=? OR t.trade_type=?,pl.id,it.barcode) AS barcode,if(t.trade_type=? OR t.trade_type=?,pl.default_image_url,p.default_image_url) AS defaultImageUrl FROM trade t LEFT OUTER JOIN trade_take tt ON t.tenant_wechatapp_id=tt.tenant_wechatapp_id AND t.id=tt.trade_id LEFT OUTER JOIN trade_addr ta ON t.tenant_wechatapp_id=ta.tenant_wechatapp_id AND t.id=ta.trade_id LEFT OUTER JOIN product p ON p.id=t.product_id LEFT OUTER JOIN platform_product pl ON pl.id=t.product_id LEFT OUTER JOIN inventory it ON it.product_id=t.product_id AND it.specification=t.specification LEFT OUTER JOIN trade_express te ON te.tenant_wechatapp_id=t.tenant_wechatapp_id AND te.trade_id=t.id WHERE (t.tenant_wechatapp_id=? AND t.trade_type=?) ORDER BY create_time DESC)tmp_count|6|13|4||0|0|300902|94283|6|1|
|tenant|SELECT shop.*,dept.dept_name,count(es.id) AS employeesCount FROM tenant_wechatapp_shop shop LEFT JOIN erp_department dept ON shop.dept_erp_id=dept.dept_erp_id AND shop.tenant_id=dept.tenant_id LEFT JOIN employee_shop es ON shop.id=es.shop_id AND es.status IN(?) WHERE shop.tenant_wechatapp_id=? AND shop.status IN (?) GROUP BY shop.id ORDER BY shop.create_time DESC LIMIT ?,?|6|8|1||0|0|559928|93326|94|20|
|payment|SELECT id,tenant_id,tenant_app_id,goods_order_source,goods_order_no,pay_order_id,transaction_id,goods_amount,refund_amount,fee_type,refund_reason,refund_account,request_ip,user_id,user_identify,user_sub_identify,order_start_time,refund_id,settlement_refund_amount,refund_recv_accout,refund_request_source,refund_finish_time,refund_status,refund_status_desc,error_msg,wxappid,sub_wxappid,mch_id,sub_mch_id,callback_tag,callback_result,create_time,update_time FROM refund_order WHERE callback_result IN(?) AND refund_status IN(?) ORDER BY id ASC LIMIT ?|5|6|1||0|0|71113|14224|0|0|
|value_added|SELECT ? AS limitDayType,t.tenant_wechatapp_id AS tenantAppId,t.user_id AS userId,min(ue.employee_erp_id)employee_erp_id,ue.dept_erp_id,GROUP_CONCAT(t.product_barcode ORDER BY product_barcode ASC) AS productCode,GROUP_CONCAT(t.product_name ORDER BY product_barcode ASC) AS productName FROM value_added_user t INNER JOIN value_added_user_extend ue ON t.id=ue.id WHERE t.tenant_wechatapp_id=? AND t.state=? AND t.start_add_time>=date_add(DATE_FORMAT(?,?),interval ?*(t.add_days?)day) AND t.start_add_time<date_add(DATE_FORMAT(?,?),interval(?*(t.add_days?)+?)day) GROUP BY t.tenant_wechatapp_id,t.user_id,ue.dept_erp_id|5|18|11||0|0|1367687|472897|349|213|
|coupon_service|SELECT cu.id,cu.coupon_name,cu.coupon_type,cu.coupon_no,cu.source AS couponChannel,cu.coupon_state,ce.user_name,ce.creator_user_name AS creatorName,if(coupon_type IN (?),cu.face_value,round(cu.face_value/?,?)) AS faceValue,cu.begin_time,cu.end_time,ce.remark,ce.mobile_no,ce.creator_mobile_no,cu.create_time,cu.user_id,round(cu.balance/?,?)balance,ce.source_user_id,ce.source_user_type,ce.member_source_shop FROM coupon_service.coupon cu JOIN coupon_service.coupon_extend ce ON ce.tenant_id=? AND ce.tenant_app_id=? AND ce.id=cu.id JOIN (SELECT coupon_id FROM coupon_service.coupon_write_off_log wol WHERE wol.tenant_id=? AND wol.tenant_app_id=? AND wol.state=? AND wol.create_time>=? AND wol.create_time<=? GROUP BY coupon_id)w ON w.coupon_id=cu.id JOIN coupon_service.coupon_market_order_detail cmod ON cmod.tenant_id=? AND cmod.tenant_app_id=? AND cmod.coupon_id=cu.id JOIN coupon_service.coupon_market_order cmo ON cmo.tenant_id=? AND cmo.tenant_app_id=? AND cmod.order_id=cmo.id AND cmo.pay_type=? WHERE cu.tenant_id=? AND cu.tenant_app_id=? AND cu.create_time>=? AND cu.create_time<=? AND cu.source=? LIMIT ?|5|8|2||0|0|1596550|319310|100|20|
|v4_user|SELECT id FROM member_points_detail WHERE (member_points_id=? AND oper_biz_id=? AND oper_biz_type=? AND status=?) AND tenant_id=? AND tenant_app_id=? LIMIT ?|5|7|2||0|0|21457|5026|0|0|
|employee|UPDATE backlog_? SET leave_flag=? WHERE tenant_app_id=? AND employee_id=?|5|6|1||0|0|24641|10233|0|0|
|gift_mail|SELECT tt.shop_id FROM gift_mail.trade t JOIN gift_mail.trade_take tt ON tt.tenant_wechatapp_id=t.tenant_wechatapp_id AND tt.trade_id=t.id WHERE t.tenant_id=? AND t.tenant_wechatapp_id=? AND tt.shop_id IS NOT ?|5|12|4||0|0|73984|26938|36988|13469|
|v4_employee|SELECT count(*) AS total_count,count(finish_time) AS finish_count FROM task_task t JOIN task_invite_task_template t? ON t.task_template_id=t?.id AND t?.tenant_id=? AND t?.tenant_app_id=? WHERE t?.invite_time<? AND t.end_time>? AND t?.status IN (?) AND t.task_type=? AND t.status=? AND t.shop_id=? AND t.tenant_id=? AND t.tenant_app_id=?|5|14|3||0|0|331708|112742|5|1|
|order|SELECT count(?)total,ifnull(sum(if(od.status>?,od.payment_fee,?)),?)paymentFee,ifnull(sum(if(od.status>?,od.offline_payment_fee,?)),?)offlinePaymentFee,ifnull(sum(if(od.status>?,od.payment_fee+od.offline_payment_fee,?)),?)payTotalFee FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id LEFT JOIN order_address ad ON od.id=ad.order_id WHERE od.tenant_id=? AND od.tenant_wechatapp_id=?|5|12|6||0|0|423918|180348|5|1|
|order|SELECT count(?) FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id LEFT JOIN order_address ad ON od.id=ad.order_id WHERE od.tenant_id=? AND od.tenant_wechatapp_id=?|5|12|6||0|0|423918|180348|5|1|
|v4_user|SELECT COUNT(*) AS total FROM potential_customer t? WHERE t?.maintain_shop_id=? AND t?.maintain_employee_id=? AND t?.status IN (?) AND t?.tenant_id=? AND t?.tenant_app_id=?|5|6|1||0|0|3832|1672|5|1|
|v4_employee|SELECT COUNT(*) AS total FROM mark_label_task WHERE (employee_id=? AND start_time>=? AND end_time<? AND status=?) AND tenant_id=? AND tenant_app_id=?|4|5|1||0|0|3534|1511|4|1|
|order|SELECT count(?)total,ifnull(sum(if(od.status>?,od.payment_fee,?)),?)paymentFee,ifnull(sum(if(od.status>?,od.offline_payment_fee,?)),?)offlinePaymentFee,ifnull(sum(if(od.status>?,od.payment_fee+od.offline_payment_fee,?)),?)payTotalFee FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id LEFT JOIN order_address ad ON od.id=ad.order_id WHERE od.tenant_id=? AND od.tenant_wechatapp_id=? AND (od.mobile_no=? OR ad.mobile_no=?)|4|14|5||0|0|721731|180684|4|1|
|v4_user|SELECT checkin_time,id FROM potential_customer WHERE (maintain_shop_id=? AND status IN (?)) AND tenant_id=? AND tenant_app_id=?|4|6|1||0|0|8206|4091|1339|882|
|erp_sync|SELECT * FROM erp_sync.retry_data WHERE (need_erp_member_id=? OR (need_erp_member_id=? AND erp_member_id IS NOT ?)) AND retry_times>? ORDER BY id|4|5|1||0|0|16797|4654|1200|300|
|user_service|SELECT count(?) FROM (SELECT count(?) FROM user_source us WHERE us.tenant_id=? AND us.tenant_wechatapp_id=? AND us.from_id=? AND us.shop_id=? AND us.create_time>=? AND us.create_time<? AND us.source_type=? AND us.from_id IS NOT ? AND us.shop_id IS NOT ?)table_count|4|7|1||0|0|6836|1709|4|1|
|user_service|SELECT * FROM user_employee WHERE tenant_wechatapp_id=? AND employee_id=?|4|4|1||0|0|121370|113883|14121|6634|
|coupon_service|SELECT * FROM coupon_service.coupon_can_give WHERE coupon_id=? LIMIT ?|4|5|1||0|0|1299135|332870|4|1|
|v4_sales|SELECT * FROM v4_sales.comment WHERE order_id=? AND tenant_id=? AND tenant_app_id=? LIMIT ?|4|5|1||0|0|251950|63146|1|1|
|v4_giftmall|SELECT * FROM v4_giftmall.trade WHERE trade_type=? AND order_status=? AND update_time<=DATE_SUB(NOW(),INTERVAL ? MINUTE)|3|3|1||0|0|33051|11019|0|0|
|tenant|SELECT count(*) FROM sneak_guest WHERE (tenant_app_id=? AND status=? AND create_shop_id=? AND maintain_employee_id=?)|3|4|2||0|0|906|438|3|1|
|user_service|SELECT t?.id,t?.user_id AS userId,t?.user_name AS userName,t?.sex,t?.mobile_no AS mobileNo,t?.head_img_url AS headImg FROM user_service.tenant_member t? JOIN user_service.tenant_member_info t? ON t?.tenant_id=t?.tenant_id AND t?.id=t?.id AND t?.tenant_app_id=? AND t?.shop_id=? JOIN user_service.user_employee ue ON t?.tenant_id=ue.tenant_id AND t?.tenant_app_id=ue.tenant_wechatapp_id AND t?.user_id=ue.user_id AND ue.employee_id=? AND ue.shop_id=? WHERE t?.tenant_id=? AND t?.tenant_app_id=? ORDER BY ue.update_time DESC,t?.id DESC LIMIT ?,?|3|3|1||0|0|26694|15742|30|10|
|employee|SELECT id,scene,employee_id,member_user_name userName,finish_time,status FROM employee.backlog_? WHERE tenant_id=? AND tenant_app_id=? AND shop_id=? AND expire_time BETWEEN ? AND ? AND status!=? AND scene NOT IN(?) ORDER BY id DESC LIMIT ?,?|3|27|13||0|0|3218933|1352207|11|5|
|user_service|UPDATE user_service.tenant_member_info t? JOIN user_service.user_employee t? ON t?.tenant_id=t?.tenant_id AND t?.tenant_app_id=t?.tenant_wechatapp_id AND t?.user_id=t?.user_id SET t?.shop_id=?,t?.shop_id=? WHERE t?.tenant_id=? AND t?.tenant_app_id=? AND t?.employee_id=? AND t?.shop_id=?|3|5|2||0|0|5766|3854|0|0|
|employee|SELECT id,scene,employee_id,member_user_name userName,finish_time,status FROM employee.backlog_? WHERE tenant_id=? AND tenant_app_id=? AND shop_id=? AND expire_time BETWEEN ? AND ? AND status!=? AND scene NOT IN(?) ORDER BY id DESC LIMIT ?|3|18|10||0|0|2160262|1399413|11|7|
|user_service|SELECT tenant_id,id,tenant_app_id,user_id,wx_user_id,erp_member_id,customer_user_id,wx_union_id,create_time,update_time,external_user_id FROM tenant_member_bind WHERE (tenant_id=? AND tenant_app_id=? AND user_id IN|3|3|1||0|0|15479|7518|15479|7518|
|user_service|UPDATE user_service.user_employee SET employee_id=?,employee_erp_id=?,create_time=now(),update_time=now() WHERE tenant_id=? AND tenant_wechatapp_id=? AND user_id IN|3|6|4||0|0|9048|7518|0|0|
|tenant|SELECT count(DISTINCT concat(dept_erp_id,?,sales_date)) AS total FROM tenant.erp_sales WHERE tenant_id=? AND tenant_wechatapp_id=? AND member_erp_id=? AND sales_status=? AND is_sales=?|3|9|4||0|0|45420|40193|3|1|
|authorization_service|SELECT id,user_id,tenant_id,tenant_wx_app_id,account_id,login_way,login_code,login_token,roles,status,expire_time,create_time,update_time,login_ip,login_time,login_data,employee_id,shop_id,platform_user_id,wx_user_id,wx_app_user_id FROM user_login_token WHERE user_id=? AND tenant_id=? AND tenant_wx_app_id=? AND login_way=? AND status=? AND expire_time>now()|3|4|1||0|0|1084|483|3|1|
|v4_coupon|SELECT COUNT(*) AS total FROM (SELECT DISTINCT c.id,c.activity_name,c.push_time,c.tag_id,c.butler_call_member FROM v4_coupon.tag_push_coupon c JOIN v4_coupon.tag_push_coupon_log l ON l.tag_push_coupon_id=c.id AND l.push_coupon_state=? AND l.tenant_id=? AND l.tenant_app_id=? WHERE c.push_state=? AND c.butler_visible=? AND l.shop_id=? AND l.employee_id=? AND c.push_time>=? AND c.tenant_id=? AND c.tenant_app_id=? ORDER BY c.push_time DESC)c|3|4|2||0|0|1038882|346294|3|1|
|authorization_service|UPDATE user_login_token SET status=? WHERE login_token IN|3|5|1||0|0|2140|1111|0|0|
|tenant|SELECT count(?) FROM (SELECT sg.id,sg.sneak_guest_no,sg.user_id,sg.user_type,ey.employee_name AS maintainEmployeeName,sg.last_maintain_date,ws.shop_name AS createShopName,sg.status,sg.create_time,t?.employee_name AS createEmployeeName,sg.finish_date,sg.fail_type,gs.sales_id,gs.sales_no,w?.shop_name salesShopName,gs.create_time AS salesDate,gs.product_name,gs.product_quantity,gs.amount salesAmount,if(sg.status=?,(CASE WHEN sg.fail_type=? THEN ? ELSE ifnull(emp.employee_name,?) END),?) AS operFailEmployeeName FROM sneak_guest sg LEFT JOIN employee ey ON sg.maintain_employee_id=ey.id LEFT JOIN tenant_wechatapp_shop ws ON sg.create_shop_id=ws.id LEFT JOIN employee t? ON sg.create_employee_id=t?.id LEFT JOIN sneak_guest_sales gs ON sg.tenant_app_id=gs.tenant_app_id AND sg.id=gs.sneak_guest_id LEFT JOIN tenant_wechatapp_shop w? ON gs.shop_id=w?.id LEFT JOIN tenant.sneak_guest_maintain gm ON gm.sneak_guest_id=sg.id AND gm.event_type=? LEFT JOIN employee emp ON gm.employee_id=emp.id WHERE sg.tenant_app_id=? ORDER BY sg.id DESC)tmp_count|3|19|14||0|0|412595|186544|3|1|
|erp_app|INSERT INTO app_status(id,tenant_id,app_name,version,pid) VALUES (?,?,?,?,?) ON DUPLICATE key UPDATE version=?,pid=?,online_status_time=?|3|4|1||0|0|0|0|0|0|
|tenant|SELECT count(?) FROM sneak_guest sg LEFT JOIN employee ey ON sg.maintain_employee_id=ey.id WHERE sg.tenant_app_id=? AND sg.create_shop_id=? AND sg.maintain_employee_id=? AND EXISTS (SELECT ? FROM tenant.sneak_guest_maintain sgm WHERE sg.id=sgm.sneak_guest_id AND sgm.event_type=? AND sgm.intention_info REGEXP ?) AND sg.status=?|3|4|2||0|0|1974|781|3|1|
|tenant|SELECT shop.*,dept.dept_name,count(es.id) AS employeesCount FROM tenant_wechatapp_shop shop LEFT JOIN erp_department dept ON shop.dept_erp_id=dept.dept_erp_id AND shop.tenant_id=dept.tenant_id LEFT JOIN employee_shop es ON shop.id=es.shop_id AND es.status IN(?) WHERE shop.tenant_wechatapp_id=? AND shop.status IN (?) GROUP BY shop.id ORDER BY shop.create_time DESC LIMIT ?|3|3|1||0|0|279864|93299|60|20|
|user_service|SELECT obj.id,obj.total, CASE WHEN @rowtotal=obj.total THEN @rownum WHEN @rowtotal:=obj.total THEN @rownum:=@rownum+? WHEN @rowtotal=? THEN @rownum:=@rownum+? END AS rank_idx FROM (SELECT us.from_id AS id,count(?)total FROM user_source us WHERE us.tenant_id=? AND us.tenant_wechatapp_id=? AND us.shop_id=? AND us.create_time>=? AND us.create_time<? AND us.source_type=? AND us.from_id IS NOT ? AND us.shop_id IS NOT ? GROUP BY us.from_id ORDER BY count(?) DESC) AS obj,(SELECT @rownum:=?,@rowtotal:=?)r|3|4|1||0|0|14296|5192|90|30|
|tenant|SELECT count(?) FROM sneak_guest sg LEFT JOIN employee ey ON sg.maintain_employee_id=ey.id WHERE sg.tenant_app_id=? AND sg.create_shop_id=? AND EXISTS (SELECT ? FROM tenant.sneak_guest_maintain sgm WHERE sg.id=sgm.sneak_guest_id AND sgm.event_type=? AND sgm.intention_info REGEXP ?) AND sg.status=?|3|8|5||0|0|6777|3330|3|1|
|v4_sales|SELECT COUNT(*) AS total FROM comment WHERE (order_id=? AND member_id=?) AND tenant_id=? AND tenant_app_id=?|2|2|1||0|0|126080|63056|2|1|
|order|SELECT id,type,operator_type operatorType,operator_result operatorResult,reason_label reasonLabel,reason_value reasonValue,remark,create_time createTime,status FROM order_service_log WHERE order_id=? ORDER BY create_time DESC|2|2|1||0|0|52337|26169|0|0|
|order|SELECT od.id,od.order_no orderNo,od.status,od.take_type takeType,od.create_time createTime,od.remark,od.total_fee totalFee,od.freight_fee freightFee,od.discount_fee discountFee,od.take_id takeId,od.payment_fee paymentFee,dt.product_id productId,dt.price,dt.quantity,dt.sku_id skuId,dt.art_no artNo,dt.image_url imageUrl,dt.product_name productName,dt.take_remark takeRemark,dt.take_day takeDay,od.product_fee productFee,ad.user_name receiveName,ad.mobile_no mobileNo,ad.shop_name shopName,ad.address,ad.express_no expressNo,ad.express_company expressCompany,od.user_name userName,od.update_time updateTime,od.child_status childStatus,od.finish_type finishType,od.receive_time receiveTime,od.user_id userId,od.mobile_no buyMobileNo,od.edit_fee_flag editFeeFlag,dt.spec spec,od.source,od.take_shop_id,od.take_shop_name,od.take_employee_user_id,od.take_employee_user_name,od.activity_type,od.activity_id,od.offline_payment_fee,od.online_wait_fee,od.offline_wait_fee,od.pay_way,od.take_employee_id,od.pay_id FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id LEFT JOIN order_address ad ON od.id=ad.order_id WHERE od.tenant_id=? AND od.tenant_wechatapp_id=? AND (od.mobile_no=? OR ad.mobile_no=?) AND (od.status=?) ORDER BY od.create_time DESC LIMIT ?|2|5|3||0|0|287049|143525|4|2|
|gift_mail|SELECT * FROM (SELECT p.id,p.default_image_url,p.product_name,p.product_type,p.tag_price,ifnull(pp.integral_price,ifnull((SELECT min(inventory.price) FROM gift_mail.inventory WHERE inventory.product_id=p.id),?)) AS price,p.volume,p.category_id,p.product_status,? AS quantity,pp.partner_id AS partner_id,p.topping FROM gift_mail.product p LEFT JOIN gift_mail.partner_product pp ON p.id=pp.product_id LEFT JOIN gift_mail.product_status ps ON ps.product_id=p.id WHERE p.tenant_id=? AND product_status=? AND (p.is_disable IS ? OR p.is_disable=?) AND (ps.tenant_wechatapp_id=? OR p.product_type=?)) AS p WHERE (p.topping=?) ORDER BY p.price DESC LIMIT ?,?|2|2|1||0|0|36708|18372|12|6|
|tenant|SELECT count(?) FROM erp_sales_detail t? LEFT JOIN erp_sales_detail_extend t? ON t?.tenant_id=t?.tenant_id AND t?.tenant_wechatapp_id=t?.tenant_wechatapp_id AND t?.sales_erp_id=t?.sales_erp_id AND t?.sales_index=t?.sales_index LEFT JOIN erp_sales t? ON t?.tenant_id=t?.tenant_id AND t?.tenant_wechatapp_id=t?.tenant_wechatapp_id AND t?.sales_erp_id=t?.sales_erp_id WHERE t?.tenant_id=? AND t?.tenant_wechatapp_id=? AND t?.tenant_id=t?.tenant_id AND t?.tenant_wechatapp_id=t?.tenant_wechatapp_id AND t?.member_erp_id=? AND t?.sales_status=? AND t?.is_sales=?|2|2|1||0|0|410|321|2|1|
|warranty_service|SELECT count(*) FROM warranty WHERE user_id=? AND tenant_wechatapp_id=? AND is_disable=?|2|9|7||0|0|17097|16761|2|1|
||SELECT tm.mobile_no,tmb.external_user_id FROM user_service.tenant_member_bind tmb JOIN user_service.tenant_member tm ON tm.tenant_id=tmb.tenant_id AND tm.user_id=tmb.user_id AND tm.tenant_app_id=tmb.tenant_app_id WHERE tmb.tenant_id=? AND tmb.tenant_app_id=? AND tmb.external_user_id IS NOT ? AND tmb.external_user_id!=?|2|5|3||0|0|322728|161364|14076|7038|
|tenant|SELECT count(?) FROM (SELECT es.id,es.sales_no,es.sales_date,es.sales_erp_id,es.amount,ifnull(shop.shop_name,ed.dept_name)dept_name,es.employee_name FROM tenant.erp_sales es JOIN tenant.erp_department ed ON ed.dept_erp_id=es.dept_erp_id AND ed.tenant_id=? LEFT JOIN tenant.tenant_wechatapp_shop shop ON shop.dept_erp_id=ed.dept_erp_id AND shop.tenant_wechatapp_id=? WHERE es.member_erp_id=? AND es.tenant_id=? AND es.tenant_wechatapp_id=? AND es.sales_status=? AND NOT EXISTS (SELECT i.id FROM tenant.erp_sales_ignore i WHERE i.tenant_id=? AND i.tenant_app_id=? AND es.sales_erp_id=i.erp_sales_id))table_count|2|3|1||0|0|2086174|1465726|2|1|
|v4_user|SELECT COUNT(*) AS total FROM potential_customer pc WHERE EXISTS (SELECT ? FROM potential_customer_maintain t? WHERE pc.id=t?.potential_customer_id AND t?.create_time>=? AND t?.create_time<=? AND t?.event_type IN (?) AND t?.tenant_app_id=?) AND pc.tenant_app_id=?|2|11|9||0|0|55404|27705|2|1|
|corpwx_license|DELETE FROM cwx_sync_active_info WHERE (tenant_id=? AND user_id=?) AND tenant_id=?|2|2|1||0|0|58879|29472|0|0|
|order|SELECT count(?) FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id LEFT JOIN order_address ad ON od.id=ad.order_id WHERE od.tenant_id=? AND od.tenant_wechatapp_id=? AND (od.mobile_no=? OR ad.mobile_no=?) AND (od.status=?)|2|7|4||0|0|250224|125112|2|1|
|coupon_service|SELECT cmod.coupon_id,cmo.pay_type,cmo.id orderId,cmo.cash_flow_id AS payId FROM coupon_service.coupon_market_order_detail cmod JOIN coupon_service.coupon_market_order cmo ON cmo.tenant_id=? AND cmo.tenant_app_id=? AND cmo.id=cmod.order_id WHERE cmod.tenant_id=? AND cmod.tenant_app_id=? AND cmod.coupon_id IN (?)|2|6|3||0|0|124459|116841|31|20|
||SELECT *FROM erp_sync.sync_record WHERE tenant_id=? AND tenant_app_id=? AND business_type=? ORDER BY id DESC LIMIT ?|2|15|8||0|0|39050|19525|4000|2000|
|tenant|SELECT sales_erp_id FROM tenant.erp_sales es JOIN tenant.erp_sales_ignore ei ON ei.tenant_id=? AND ei.tenant_app_id=? AND es.sales_erp_id=ei.erp_sales_id WHERE es.tenant_id=? AND es.tenant_wechatapp_id=? AND member_erp_id=?|2|4|3||0|0|19846|10430|0|0|
|order|SELECT id,tenant_id,tenant_wechatapp_id,order_id,user_id,user_name,shop_id,shop_name,operator_type,src_status,dst_status,full_message,remark,create_time,update_time,src_child_status,dst_child_status FROM order_operator_log WHERE tenant_wechatapp_id=? AND order_id=? AND dst_status=? ORDER BY create_time DESC|2|6|4||0|0|2177251|1089031|1|1|
|user_service|SELECT tm.user_id AS userId,tm.head_img_url AS headImgUrl,tm.user_name AS nickName,tm.mobile_no AS mobileNo,tm.sex,DATE_FORMAT(tm.create_time,?) AS registerTime,tm.id AS tenantUserId FROM user_service.tenant_member tm JOIN user_service.tenant_member_info tmi ON tm.tenant_id=tmi.tenant_id AND tm.id=tmi.id LEFT JOIN user_service.user_employee t? ON tm.user_id=t?.user_id AND tm.tenant_id=t?.tenant_id AND tm.tenant_app_id=t?.tenant_wechatapp_id WHERE t?.id IS ? AND tmi.shop_id=? AND tmi.tenant_id=? AND tmi.tenant_app_id=? ORDER BY tm.id ASC LIMIT ?|2|14|13||0|0|555173|301134|20|10|
|user_service|SELECT obj.id,obj.shop_id,obj.total, CASE WHEN @rowtotal=obj.total THEN @rownum WHEN @rowtotal:=obj.total THEN @rownum:=@rownum+? WHEN @rowtotal=? THEN @rownum:=@rownum+? END AS rank_idx FROM (SELECT us.from_id AS id,us.shop_id,count(?)total FROM user_source us WHERE us.tenant_id=? AND us.tenant_wechatapp_id=? AND us.create_time>=? AND us.create_time<? AND us.source_type=? AND us.from_id IS NOT ? AND us.shop_id IS NOT ? GROUP BY us.from_id,us.shop_id ORDER BY count(?) DESC) AS obj,(SELECT @rownum:=?,@rowtotal:=?)r|2|2|1||0|0|11214|5930|550|276|
||INSERT INTO v4_user.wx_user(id,app_type,app_id,open_id,union_id,nick_name,mobile_no,head_img_url,is_subscribe,subscribe_time,cancel_subscribe_time,sex,country,province,city) SELECT id,?,wx_app_id,open_id,union_id,nick_name,mobile_no,head_img_url,is_subscribe,subscribe_time,unsubscribe_time,sex,country,province,city FROM user_service.wx_user WHERE wx_app_id=? ON DUPLICATE key UPDATE update_time=now()|2|211|108||0|0|100387|50194|0|0|
|v4_coupon|SELECT tenant_id,tenant_app_id,member_id,count(?)total FROM v4_coupon.coupon WHERE DATEDIFF(DATE_FORMAT(end_time,?),DATE_FORMAT(now(),?))=? AND coupon_status IN (?) GROUP BY tenant_id,tenant_app_id,member_id|2|47|27||0|0|3101385|1703737|120|61|
|v4_user|SELECT id,member_id,external_user_id,serial_number,checkin_shop_id,checkin_employee_id,checkin_employee_name,checkin_time,maintain_shop_id,maintain_employee_id,maintain_employee_name,first_maintain_time,last_maintain_time,next_maintain_time,maintain_num,intention_num,latest_intention,status,finish_time,finish_shop_id,deal_employee_id,deal_employee_name,deal_sale_amount,fail_employee_id,fail_employee_name,fail_reason,remark,sex,cutomer_grade,maintain_level,tenant_id,tenant_app_id,create_time,update_time FROM potential_customer WHERE ((member_id=? OR external_user_id=?) AND status IN (?) AND maintain_shop_id=? AND maintain_employee_id=?) AND tenant_id=? AND tenant_app_id=?|2|2|1||0|0|817|588|0|0|
|tenant|SELECT sg.tenant_app_id AS tenantAppId,sg.create_shop_id AS shopId,sg.maintain_employee_id AS employeeId,emp.corp_wx_user_id AS corpwxUserId,count(*) AS waitMaintainNum FROM tenant.sneak_guest sg JOIN tenant.employee emp ON sg.maintain_employee_id=emp.id WHERE sg.tenant_app_id=? AND sg.status=? AND sg.next_maintain_date>=CURRENT_DATE AND sg.next_maintain_date<DATE_ADD(CURRENT_DATE,INTERVAL ? day) GROUP BY sg.tenant_app_id,sg.create_shop_id,sg.maintain_employee_id,emp.corp_wx_user_id|2|5|3||0|0|13037|7429|8|8|
|v4_user|SELECT t?.maintain_shop_id,t?.maintain_employee_id,t?.maintain_level,count(*) AS maintainNum FROM potential_customer t? WHERE t?.tenant_app_id=? AND t?.`status` IN (?) AND t?.next_maintain_time>=? AND t?.tenant_id=? AND t?.tenant_app_id=? GROUP BY t?.maintain_shop_id,t?.maintain_employee_id,t?.maintain_level|2|8|7||0|0|15707|9039|500|338|
|user_service|SELECT tm.user_id AS userId,tm.head_img_url AS headImgUrl,tm.user_name AS nickName,tm.mobile_no AS mobileNo,tm.sex,DATE_FORMAT(tm.create_time,?) AS registerTime,tm.id AS tenantUserId FROM user_service.tenant_member tm JOIN user_service.tenant_member_info tmi ON tm.tenant_id=tmi.tenant_id AND tm.id=tmi.id LEFT JOIN user_service.user_employee t? ON tm.user_id=t?.user_id AND tm.tenant_id=t?.tenant_id AND tm.tenant_app_id=t?.tenant_wechatapp_id WHERE t?.id IS ? AND tmi.shop_id=? AND tmi.tenant_id=? AND tmi.tenant_app_id=? ORDER BY tm.id ASC|2|7|5||0|0|665482|365360|27553|19837|
|v4_user|SELECT id FROM potential_customer WHERE (status IN (?) AND next_maintain_time<?) AND tenant_id=? AND tenant_app_id=?|2|6|5||0|0|14706|8363|851|450|
|order|SELECT count(*)amount FROM `order`.order_info od LEFT JOIN `order`.order_detail dt ON od.id=dt.order_id LEFT JOIN ORDER.order_address ad ON od.id=ad.order_id WHERE od.tenant_wechatapp_id=? AND od.take_type=? AND od.type=? AND od.status=? AND ad.shop_id=? AND dt.take_start_date=?|2|2|1||0|0|2947|1480|2|1|
|coupon_service|SELECT t.id FROM coupon_service.template t LEFT JOIN coupon_service.coupon_scope s ON s.tenant_id=t.tenant_id AND s.tenant_app_id=t.tenant_app_id AND s.template_id=t.id WHERE t.coupon_type=? AND t.tenant_id=? AND t.tenant_app_id=? AND (t.scope=? OR (s.scope=? AND s.product_id=?) OR (s.scope=? AND s.classify_id=?))|2|2|1||0|0|44101|22090|1|1|
|employee|UPDATE backlog_system SET status=?,finish_time=now() WHERE tenant_app_id=? AND scene=?|2|27|25||0|0|1622658|1434712|0|0|
|gift_mail|SELECT * FROM (SELECT p.id,p.default_image_url,p.product_name,p.product_type,p.tag_price,ifnull(pp.integral_price,ifnull((SELECT min(inventory.price) FROM gift_mail.inventory WHERE inventory.product_id=p.id),?)) AS price,p.volume,p.category_id,p.product_status,? AS quantity,pp.partner_id AS partner_id,p.topping FROM gift_mail.product p LEFT JOIN gift_mail.partner_product pp ON p.id=pp.product_id LEFT JOIN gift_mail.product_status ps ON ps.product_id=p.id WHERE p.tenant_id=? AND product_status=? AND (p.is_disable IS ? OR p.is_disable=?) AND (ps.tenant_wechatapp_id=? OR p.product_type=?)) AS p WHERE (p.topping=?) ORDER BY p.volume DESC,p.id DESC LIMIT ?,?|2|2|1||0|0|36576|18288|12|6|
|gift_mail|SELECT count(*) FROM gift_mail.trade t WHERE t.tenant_wechatapp_id=? AND t.trade_type=? AND t.order_status=?|2|6|3||0|0|18475|9238|2|1|
|gift_mail|SELECT * FROM (SELECT p.id,p.default_image_url,p.product_name,p.product_type,p.tag_price,ifnull(pp.integral_price,ifnull((SELECT min(inventory.price) FROM gift_mail.inventory WHERE inventory.product_id=p.id),?)) AS price,p.volume,p.category_id,p.product_status,? AS quantity,pp.partner_id AS partner_id,p.topping FROM gift_mail.product p LEFT JOIN gift_mail.partner_product pp ON p.id=pp.product_id LEFT JOIN gift_mail.product_status ps ON ps.product_id=p.id WHERE p.tenant_id=? AND product_status=? AND (p.is_disable IS ? OR p.is_disable=?) AND (ps.tenant_wechatapp_id=? OR p.product_type=?)) AS p WHERE (p.topping=?) ORDER BY p.volume DESC,p.id DESC LIMIT ?|2|2|1||0|0|36597|18321|12|6|
|v4_user|INSERT INTO employee_external_bind(id,external_user_id,corp_user_id,employee_id,create_time,update_time,tenant_id) VALUES (?,?,?,?,?,?,?)|2|3|1||0|0|0|0|0|0|
|order|SELECT count(?) FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id LEFT JOIN order_address ad ON od.id=ad.order_id WHERE od.tenant_id=? AND od.tenant_wechatapp_id=? AND dt.product_name LIKE concat(?,?,?) AND od.take_type=?|1|3|3||0|0|65220|65220|1|1|
|tenant|SELECT count(?) FROM erp_sales JOIN tenant.tenant_wechatapp tw ON tw.tenant_id=erp_sales.tenant_id AND tw.is_disable=? AND tw.id=erp_sales.tenant_wechatapp_id JOIN erp_department ON tw.tenant_id=erp_department.tenant_id AND erp_department.dept_erp_id=erp_sales.dept_erp_id JOIN tenant tenant ON tw.tenant_id=tenant.id AND tenant.`status`=? WHERE erp_sales.tenant_id=? AND erp_sales.sales_no=?|1|2|2||0|0|468041|468041|1|1|
|v4_activity|SELECT ? member_id,(SELECT count(?) FROM lottery_log WHERE activity_id=? AND member_id=? AND qualified_id=? AND tenant_id=? AND tenant_app_id=?)play_count,(SELECT count(?) FROM lottery_log WHERE win_status=? AND activity_id=? AND member_id=? AND qualified_id=? AND tenant_id=? AND tenant_app_id=?)play_count_win|1|1|1||0|0|29142|29142|1|1|
|authorization_service|SELECT id,user_id,tenant_id,tenant_wx_app_id,account_id,login_way,login_code,login_token,roles,status,expire_time,create_time,update_time,login_ip,login_time,login_data,employee_id,shop_id,platform_user_id,wx_user_id,wx_app_user_id FROM user_login_token WHERE wx_user_id=? AND tenant_id=? AND tenant_wx_app_id=? AND login_way=? AND expire_time>now() AND status=? AND user_id=?|1|1|1||0|0|0|0|0|0|
|value_added|SELECT ID,tenant_wechatapp_id AS tenantWechatappId,user_id AS userId,template_id AS templateId,sales_erp_id AS saleserpid,product_name AS productName,shop_name AS shopName,product_barcode AS productBarcode,amount_total AS amountTotal,amount_pay AS amountPay,amount_added AS amountAdded,state AS state,add_days,added_percent_per_day AS addedPercentPerDay,devalue_percent_per_day AS devaluePercentPerDay,keeping_days AS keepingDays,exchange_days AS exchangeDays,coupon_user_id AS couponUserId,sales_index AS salesIndex,start_add_time AS createtime,DATE_ADD(start_add_time,INTERVAL add_days? DAY),DATE_ADD(start_add_time,INTERVAL add_days+keeping_days? DAY) FROM value_added_user WHERE state=? AND start_add_time=date_add(CURDATE(),interval ?*(add_days+keeping_days?)day)|1|2|2||0|0|2105550|2105550|905|905|
||DELETE FROM v4_sales.sjfx_dct_erp_sales_extend? WHERE create_time<?|1|5|5||0|0|421109|421109|0|0|
|tenant|SELECT count(*)amount FROM sneak_guest WHERE tenant_app_id=? AND status=? AND create_shop_id=? AND maintain_employee_id=? AND create_time>=?|1|1|1||0|0|193|193|1|1|
|user_service|SELECT id,tenant_id,wechat_app_id,open_id,union_id,nick_name,head_img_url,sex,wx_mobile_no,create_time,update_time FROM mini_app_user WHERE (wechat_app_id=? AND wx_mobile_no=? AND id<>?)|1|1|1||0|0|3807|3807|0|0|
|order|SELECT count(?)total,ifnull(sum(if(od.status>?,od.payment_fee,?)),?)paymentFee,ifnull(sum(if(od.status>?,od.offline_payment_fee,?)),?)offlinePaymentFee,ifnull(sum(if(od.status>?,od.payment_fee+od.offline_payment_fee,?)),?)payTotalFee FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id LEFT JOIN order_address ad ON od.id=ad.order_id WHERE od.tenant_id=? AND od.tenant_wechatapp_id=? AND dt.product_name LIKE concat(?,?,?) AND od.take_type=?|1|3|3||0|0|65220|65220|1|1|
|tenant|SELECT es.sales_erp_id FROM tenant.erp_sales es JOIN tenant.erp_sales_detail esd ON esd.tenant_id=? AND esd.tenant_wechatapp_id=? AND esd.sales_erp_id=es.sales_erp_id WHERE es.tenant_id=? AND es.tenant_wechatapp_id=? AND member_erp_id=? AND es.sales_status=? AND es.is_sales=? AND (esd.product_barcode=? OR esd.product_name LIKE concat(?,?,?))|1|2|2||0|0|10277|10277|1|1|
|gift_mail|SELECT count(?) FROM (SELECT p.*,sp.take_type,ifnull(pp.integral_price,ifnull((SELECT min(inventory.price) FROM inventory WHERE inventory.product_id=p.id),?)) AS price,ifnull(t.quantity,?)quantity,pt.partner_name vendorName,? distance,c.categroy_name categroy_name,pp.partner_id FROM product p INNER JOIN category c ON c.id=p.category_id LEFT OUTER JOIN self_product sp ON p.id=sp.product_id LEFT OUTER JOIN partner_product pp ON p.id=pp.product_id LEFT OUTER JOIN partner pt ON pt.id=pp.partner_id LEFT OUTER JOIN (SELECT product_id,sum(quantity)quantity FROM gift_mail.inventory GROUP BY product_id)t ON p.id=t.product_id WHERE ((p.is_disable IS ? OR p.is_disable=?))) AS p LEFT OUTER JOIN product_status ps ON p.id=ps.product_id AND ps.tenant_wechatapp_id=? WHERE (p.tenant_id=? AND p.product_type=? AND (ps.id IS NOT ? OR p.tenant_wechatapp_id=?))|1|1|1||0|0|55134|55134|1|1|
|order|SELECT count(*) FROM order_info WHERE tenant_wechatapp_id=? AND status=? AND payment_time BETWEEN ? AND ? AND confirm_time IS ?|1|2|2||0|0|3818|3818|1|1|
|v4_user|SELECT id,member_id,external_user_id,serial_number,checkin_shop_id,checkin_employee_id,checkin_employee_name,checkin_time,maintain_shop_id,maintain_employee_id,maintain_employee_name,first_maintain_time,last_maintain_time,next_maintain_time,maintain_num,intention_num,latest_intention,status,finish_time,finish_shop_id,deal_employee_id,deal_employee_name,deal_sale_amount,fail_employee_id,fail_employee_name,fail_reason,remark,sex,cutomer_grade,maintain_level,tenant_id,tenant_app_id,create_time,update_time FROM potential_customer WHERE ((member_id=?) AND status IN (?) AND maintain_shop_id=? AND maintain_employee_id=?) AND tenant_id=? AND tenant_app_id=?|1|1|1||0|0|337|337|0|0|
|tenant|SELECT count(DISTINCT sg.id) AS createNum,count(sgm.id) AS maintainCount FROM tenant.sneak_guest sg LEFT JOIN tenant.sneak_guest_maintain sgm ON sg.id=sgm.sneak_guest_id AND sgm.event_type=? AND sgm.create_time>=? AND sgm.create_time<? WHERE sg.tenant_app_id=? AND sg.create_time>=? AND sg.create_time<? AND sg.create_shop_id=?|1|1|1||0|0|1888|1888|1|1|
|order|SELECT od.id,od.order_no orderNo,od.status,od.take_type takeType,od.create_time createTime,od.remark,od.total_fee totalFee,od.freight_fee freightFee,od.discount_fee discountFee,od.take_id takeId,od.payment_fee paymentFee,dt.product_id productId,dt.price,dt.quantity,dt.sku_id skuId,dt.art_no artNo,dt.image_url imageUrl,dt.product_name productName,dt.take_remark takeRemark,dt.take_day takeDay,od.product_fee productFee,ad.user_name receiveName,ad.mobile_no mobileNo,ad.shop_name shopName,ad.address,ad.express_no expressNo,ad.express_company expressCompany,od.finish_type finishType,od.send_time sendTime,od.receive_time receiveTime,od.finish_time finishTime,od.child_status childStatus,od.send_good_remark sendGoodRemark,od.service_flag serviceFlag,od.coupon_id couponId,od.tenant_wechatapp_id tenantAppId,od.tenant_id FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id LEFT JOIN order_address ad ON od.id=ad.order_id WHERE od.status=? AND od.send_time<=? AND od.take_type=?|1|3|3||0|0|262999|262999|0|0|
||SELECT *FROM tenant.erp_sales WHERE tenant_id=? AND sales_no=?|1|30|30||0|0|1247668|1247668|1|1|
|user_service|INSERT INTO user_employee_alloc_log(id,tenant_id,tenant_wechatapp_id,user_id,from_employee_id,to_employee_id,alloc_employee_id,alloc_date_time,remark) VALUES (?,?,?,?,?,?,?,?,?)...|1|1|1||0|0|0|0|0|0|
|tenant|SELECT t.id AS employeeId,t.employee_erp_id AS employeeErpId,t.employee_name AS employeeName,t.employee_type_id AS employeeTypeId,t.employee_type AS employeeType,t.shop_id,sp.shop_name,t.employee_no AS employeeNo,t.sex,t.mobile_no AS mobileNo,t.head_img_url AS headImgUrl,t.status,t.corp_wx_user_id corpWxUserId,t.dept_erp_id FROM tenant.employee t LEFT JOIN tenant.tenant_wechatapp_shop sp ON t.shop_id=sp.id WHERE ?=? AND t.tenant_id=?|1|1|1||0|0|3348|3348|1674|1674|
|v4_sales|SELECT t?.sales_erp_id AS salesErpId,t?.sales_no AS salesNo,DATE_FORMAT(t?.sales_date,?) AS salesDate,t?.member_erp_id AS memberId,t?.employee_erp_id AS employeeErpId,t?.employee_name AS employeeName,t?.assist_employee_erp_id AS assistEmployeeErpId,t?.assist_employee_name AS assistEmployeeName,t?.dept_erp_id AS deptErpId,t?.amount,t?.post_time AS postTime FROM erp_sales t? WHERE t?.member_erp_id IN (?) AND t?.post_time>=? AND t?.sales_status=? AND NOT EXISTS (SELECT ? FROM erp_sales_relate esr WHERE t?.tenant_id=esr.tenant_id AND t?.tenant_app_id=esr.tenant_app_id AND t?.sales_erp_id=esr.sales_erp_id AND esr.sales_status IN (?) AND esr.tenant_id=? AND esr.tenant_app_id=?) AND EXISTS (SELECT ? FROM erp_sales_detail esd WHERE t?.tenant_id=esd.tenant_id AND t?.tenant_app_id=esd.tenant_app_id AND t?.sales_erp_id=esd.sales_erp_id AND esd.sales_type IN (?) AND esd.tenant_id=? AND esd.tenant_app_id=?) AND t?.tenant_id=? AND t?.tenant_app_id=?|1|1|1||0|0|760|760|114|114|
||SELECT tm.mobile_no,wu.open_id FROM user_service.tenant_member_bind tmb JOIN user_service.tenant_member tm ON tmb.tenant_id=tm.tenant_id AND tmb.user_id=tm.user_id JOIN user_service.wx_user_back wu ON tmb.wx_user_id=wu.id WHERE tmb.tenant_id=? AND tmb.tenant_app_id=?|1|1|1||0|0|194446|194446|33082|33082|
|v4_sales|SELECT rownum FROM (SELECT erp_employee_id,average,@rank:=@rank+? AS rownum FROM (SELECT erp_employee_id,round(avg(c.average_score),?) AS average FROM v4_sales.comment c WHERE c.tenant_id=? AND c.tenant_app_id=? AND c.erp_dept_id=? AND c.create_time BETWEEN ? AND ? GROUP BY c.erp_employee_id) AS a,(SELECT @rank:=?)b ORDER BY average DESC)r WHERE r.erp_employee_id=?|1|1|1||0|0|62876|62876|0|0|
||DELETE FROM tenant.sjfx_dct_erp_sales_detail WHERE create_time<?|1|1|1||0|0|176737|176737|0|0|
|value_added|UPDATE value_added_user SET amount_added=IF(?>(((added_percent_per_day/?)*IF(?>=TIMESTAMPDIFF(DAY,DATE_FORMAT(start_add_time,?),CURRENT_DATE)+?-add_days,TIMESTAMPDIFF(DAY,DATE_FORMAT(start_add_time,?),CURRENT_DATE)+?,add_days))-((devalue_percent_per_day/?)*IF(?>=TIMESTAMPDIFF(DAY,DATE_FORMAT(start_add_time,?),CURRENT_DATE)+?-add_days-keeping_days,?,TIMESTAMPDIFF(DAY,DATE_FORMAT(start_add_time,?),CURRENT_DATE)+?-add_days-keeping_days)))*amount_pay,?,(((added_percent_per_day/?)*IF(?>=TIMESTAMPDIFF(DAY,DATE_FORMAT(start_add_time,?),CURRENT_DATE)+?-add_days,TIMESTAMPDIFF(DAY,DATE_FORMAT(start_add_time,?),CURRENT_DATE)+?,add_days))-((devalue_percent_per_day/?)*IF(?>=TIMESTAMPDIFF(DAY,DATE_FORMAT(start_add_time,?),CURRENT_DATE)+?-add_days-keeping_days,?,TIMESTAMPDIFF(DAY,DATE_FORMAT(start_add_time,?),CURRENT_DATE)+?-add_days-keeping_days)))*amount_pay),update_time=now() WHERE state=? AND update_time<=CURDATE() AND (start_add_time>=DATE_ADD(CURDATE(),INTERVAL-(add_days+keeping_days-?)DAY) OR (amount_added>? AND start_add_time<DATE_ADD(CURDATE(),INTERVAL-(add_days+keeping_days-?)DAY)))|1|19|19||0|0|2105546|2105546|0|0|
|gift_mail|SELECT p.id,p.product_name,p.tag_price,i.volume,p.product_status AS status,p.default_image_url,i.quantity,i.market_price,if(prp.id IS ?,?,?) AS hasRecommend FROM gift_mail.platform_product p JOIN gift_mail.platform_inventory i ON i.product_id=p.id LEFT JOIN gift_mail.platform_recommend_product prp ON prp.tenant_app_id=? AND prp.is_recommend=? AND prp.platform_product_id=p.id WHERE prp.id IS ? AND p.product_status=? ORDER BY i.volume DESC ,p.tag_price ASC ,p.id DESC LIMIT ?,?|1|1|1||0|0|8947|8947|6|6|
|coupon_service|SELECT tenant_id,tenant_app_id,employee_id,count(DISTINCT user_id) AS count FROM coupon_service.coupon_expire_task WHERE tenant_id=? AND tenant_app_id=? AND status=? AND expire_time>now() AND expire_time BETWEEN ? AND ? GROUP BY tenant_id,tenant_app_id,employee_id|1|1|1||0|0|50898|50898|13|13|
||DELETE FROM v4_user.sjfx_dct_member_grade WHERE create_time<?|1|2|2||0|0|418070|418070|0|0|
|user_service|INSERT INTO user_employee_alloc_log(id,tenant_id,tenant_wechatapp_id,user_id,from_employee_id,to_employee_id,alloc_employee_id,alloc_date_time,remark) VALUES (?,?,?,?,?,?,?,?,?)|1|2|2||0|0|0|0|0|0|
|v4_sales|SELECT id,value_added_id,change_amount,balance,tenant_id,tenant_app_id,create_time,update_time FROM value_added_record WHERE (value_added_id=?) AND tenant_id=? AND tenant_app_id=? ORDER BY create_time DESC LIMIT ?|1|1|1||0|0|2379427|2379427|7|7|
|user_service|SELECT ue.user_id AS id,tm.user_name AS userName,tm.head_img_url AS headImgUrl,tm.user_name AS nickName,tm.mobile_no AS mobile,tm.sex FROM user_service.user_employee ue JOIN user_service.tenant_member tm ON tm.tenant_id=ue.tenant_id AND tm.tenant_app_id=ue.tenant_wechatapp_id AND tm.user_id=ue.user_id WHERE ue.employee_id=? AND ue.tenant_id=? AND ue.tenant_wechatapp_id=? AND ue.shop_id=? ORDER BY tm.id DESC LIMIT ?|1|1|1||0|0|22565|22565|10|10|
|user_service|SELECT count(?) FROM user_service.tenant_member t? JOIN user_service.tenant_member_info t? ON t?.tenant_id=t?.tenant_id AND t?.id=t?.id AND t?.tenant_app_id=? AND t?.shop_id=? JOIN user_service.user_employee ue ON t?.tenant_id=ue.tenant_id AND t?.tenant_app_id=ue.tenant_wechatapp_id AND t?.user_id=ue.user_id AND ue.employee_id=? AND ue.shop_id=? WHERE t?.tenant_id=? AND t?.tenant_app_id=? AND (t?.mobile_no LIKE concat(?,?) OR t?.user_name LIKE concat(?,?,?))|1|1|1||0|0|1709|1709|1|1|
|user_service|SELECT tm.user_id AS id,tm.user_name AS userName,tm.head_img_url AS headImgUrl,tm.user_name AS nickName,tm.mobile_no AS mobile,tm.sex FROM user_service.tenant_member tm JOIN user_service.user_employee ue ON ue.tenant_id=? AND ue.tenant_wechatapp_id=? AND tm.user_id=ue.user_id AND ue.employee_id=? AND ue.shop_id=? WHERE tm.tenant_id=? AND tm.tenant_app_id=? ORDER BY tm.id DESC LIMIT ?|1|5|5||0|0|5712|5712|12|12|
|gift_mail|SELECT * FROM (SELECT p.id,p.default_image_url,p.product_name,p.product_type,p.tag_price,ifnull(pp.integral_price,ifnull((SELECT min(inventory.price) FROM gift_mail.inventory WHERE inventory.product_id=p.id),?)) AS price,p.volume,p.category_id,p.product_status,? AS quantity,pp.partner_id AS partner_id,p.topping FROM gift_mail.product p LEFT JOIN gift_mail.partner_product pp ON p.id=pp.product_id LEFT JOIN gift_mail.product_status ps ON ps.product_id=p.id WHERE p.tenant_id=? AND product_status=? AND (p.is_disable IS ? OR p.is_disable=?) AND (ps.tenant_wechatapp_id=? OR p.product_type=?)) AS p WHERE (p.topping=?) ORDER BY p.price DESC LIMIT ?|1|1|1||0|0|18276|18276|6|6|
|v4_activity|SELECT COUNT(*) AS total FROM lottery_log l WHERE l.win_status=? AND l.win_prize_id IS NOT ? AND l.activity_id=? AND l.member_id=? AND qualified_id=? AND l.tenant_id=? AND l.tenant_app_id=?|1|1|1||0|0|14571|14571|1|1|
|v4_sales|SELECT count(DISTINCT es.id) FROM v4_sales.erp_sales es JOIN v4_sales.erp_sales_detail esd ON esd.sales_erp_id=es.sales_erp_id AND esd.sales_type IN (?) AND member_erp_id IN (?) AND esd.tenant_id=? AND esd.tenant_app_id=? WHERE es.tenant_id=? AND es.tenant_app_id=?|1|1|1||0|0|3851|3851|1|1|
||INSERT INTO corpwx.corpwx_external_user(id,tenant_id,external_user_id,union_id,avatar,nick_name) SELECT id+?,?,external_user_id,union_id,avatar,nick_name FROM corpwx.corpwx_external_user WHERE tenant_id=? ON DUPLICATE key UPDATE update_time=now()|1|41|41||0|0|32566|32566|0|0|
|v4_sales|SELECT id,comment_id,subject_id,subject_type,subject,score,labels,content,tenant_id,tenant_app_id,create_time,update_time FROM comment_detail WHERE (comment_id IN (?)) AND tenant_id=? AND tenant_app_id=?|1|1|1||0|0|314250|314250|50|50|
|gift_mail|SELECT t.id,t.trade_no,t.create_time,t.order_status AS tradeStatus,p.product_name,p.default_image_url AS productImage,t.specification,t.price FROM gift_mail.trade t LEFT OUTER JOIN gift_mail.product p ON p.id=t.product_id LEFT OUTER JOIN gift_mail.trade_take tt ON tt.trade_id=t.id WHERE (t.tenant_wechatapp_id=? AND t.trade_type=? AND t.order_status=?) ORDER BY id DESC LIMIT ?,?|1|1|1||0|0|204088|204088|1|1|
|tenant|SELECT count(*)amount FROM sneak_guest WHERE tenant_app_id=? AND status=? AND create_shop_id=? AND maintain_employee_id=? AND create_time<=?|1|1|1||0|0|438|438|1|1|
|user_service|SELECT count(?) FROM user_service.tenant_member tm JOIN user_service.tenant_member_info tmi ON tmi.tenant_id=? AND tmi.tenant_app_id=? AND tm.id=tmi.id WHERE tm.tenant_id=? AND tm.tenant_app_id=? AND tm.user_id IN|1|1|1||0|0|1932|1932|1|1|
|coupon_service|SELECT count(?) FROM coupon_service.coupon cu JOIN coupon_service.coupon_extend ce ON ce.tenant_id=? AND ce.tenant_app_id=? AND ce.id=cu.id JOIN (SELECT coupon_id FROM coupon_service.coupon_write_off_log wol WHERE wol.tenant_id=? AND wol.tenant_app_id=? AND wol.state=? AND wol.create_time>=? AND wol.create_time<=? GROUP BY coupon_id)w ON w.coupon_id=cu.id WHERE cu.tenant_id=? AND cu.tenant_app_id=? AND cu.coupon_type=? AND cu.create_time>=? AND cu.create_time<=? AND cu.source=?|1|1|1||0|0|4628|4628|1|1|
|tenant|SELECT esd.id,esd.sales_erp_id,es.employee_name,esd.product_barcode,es.sales_no,es.member_erp_id,esd.category_name,es.sales_date,esd.category_erp_id,esd.product_name,esd.cert_no,esd.amount_pay,esd.sales_index,ifnull(ee.not_add_value_plan,?) AS not_add_value_plan FROM erp_sales_detail esd JOIN erp_sales es ON es.tenant_id=esd.tenant_id AND es.tenant_wechatapp_id=esd.tenant_wechatapp_id AND es.sales_erp_id=esd.sales_erp_id LEFT JOIN erp_sales_extend ee ON ee.tenant_id=es.tenant_id AND es.tenant_wechatapp_id=ee.tenant_wechatapp_id AND es.sales_erp_id=ee.sales_erp_id AND esd.sales_index=ee.sales_index WHERE esd.tenant_id=? AND es.sales_status=? AND es.tenant_wechatapp_id=? AND esd.product_barcode=? ORDER BY es.sales_date DESC|1|4|4||0|0|39347|39347|4034|4034|
|v4_employee|SELECT count(*) AS total_count,count(finish_time) AS finish_count,count(send_coupons) AS coupon_send_count,count(recv_coupons) AS coupon_recv_count,count(accept_time) AS accept_count,count(arrival_shop_time) AS arrival_shop_count,count(trade_time) AS trade_count FROM task_task WHERE task_type=? AND status!=? AND shop_id=? AND system_task_type=? AND end_time>? AND end_time<=? AND tenant_id=? AND tenant_app_id=?|1|1|1||0|0|5608|5608|1|1|
|employee|SELECT count(*) FROM employee.backlog_? WHERE tenant_id=? AND tenant_app_id=? AND shop_id=? AND status=? AND finish_time BETWEEN ? AND ?|1|1|1||0|0|1497|1497|1|1|
|tenant|SELECT count(?) FROM erp_sales JOIN tenant.tenant_wechatapp tw ON tw.tenant_id=erp_sales.tenant_id AND tw.is_disable=? AND tw.id=erp_sales.tenant_wechatapp_id JOIN erp_department ON tw.tenant_id=erp_department.tenant_id AND erp_department.dept_erp_id=erp_sales.dept_erp_id JOIN tenant tenant ON tw.tenant_id=tenant.id AND tenant.`status`=? WHERE erp_sales.tenant_id=?|1|5|5||0|0|936079|936079|1|1|
|order|SELECT count(?) FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id LEFT JOIN order_address ad ON od.id=ad.order_id WHERE od.tenant_id=? AND od.tenant_wechatapp_id=? AND dt.product_name LIKE concat(?,?,?)|1|7|7||0|0|121039|121039|1|1|
|mysql|DELETE FROM wx_gateway.wx_template_msg WHERE create_time<DATE_SUB(now(),interval ? day)|1|24|24||0|0|644920|644920|0|0|
|coupon_service|SELECT c.* FROM coupon_service.coupon c LEFT JOIN coupon_service.coupon_expire_task ct ON ct.tenant_id=? AND ct.tenant_app_id=? AND c.id=ct.coupon_id WHERE c.tenant_id=? AND c.tenant_app_id=? AND c.end_time BETWEEN ? AND ? AND c.coupon_state IN (?) AND ct.id IS ?|1|1|1||0|0|39480|39480|19740|19740|
|order|SELECT count(?) FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id LEFT JOIN order_address ad ON od.id=ad.order_id WHERE od.tenant_id=? AND od.tenant_wechatapp_id=? AND dt.product_name LIKE concat(?,?,?) AND od.take_type=? AND (od.status=?)|1|5|5||0|0|44202|44202|1|1|
||UPDATE v4_user.wx_user wu JOIN v4_user.member m ON wu.open_id=m.h5_open_id SET wu.external_user_id=m.external_user_id WHERE wu.external_user_id!=m.external_user_id AND m.external_user_id IS NOT ? AND m.tenant_id=? AND m.tenant_app_id=?|1|5|5||0|0|89660|89660|0|0|
|order|SELECT count(?)total,ifnull(sum(if(od.status>?,od.payment_fee,?)),?)paymentFee,ifnull(sum(if(od.status>?,od.offline_payment_fee,?)),?)offlinePaymentFee,ifnull(sum(if(od.status>?,od.payment_fee+od.offline_payment_fee,?)),?)payTotalFee FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id LEFT JOIN order_address ad ON od.id=ad.order_id WHERE od.tenant_id=? AND od.tenant_wechatapp_id=? AND dt.product_name LIKE concat(?,?,?)|1|7|7||0|0|121039|121039|1|1|
|gift_mail|SELECT p.id,p.product_name,p.tag_price,i.volume,p.product_status AS status,p.default_image_url,i.quantity,i.market_price,if(prp.id IS ?,?,?) AS hasRecommend FROM gift_mail.platform_product p JOIN gift_mail.platform_inventory i ON i.product_id=p.id LEFT JOIN gift_mail.platform_recommend_product prp ON prp.tenant_app_id=? AND prp.is_recommend=? AND prp.platform_product_id=p.id WHERE prp.id IS ? AND p.product_status=? ORDER BY p.tag_price ASC ,p.id DESC LIMIT ?,?|1|1|1||0|0|8905|8905|6|6|
|activity_service|SELECT *FROM activity_service.sign_in_activity_log WHERE user_id=? AND sign_in_id=? LIMIT ?|1|1|1||0|0|39573|39573|0|0|
|v4_sales|SELECT COUNT(*) AS total FROM value_added_record WHERE (value_added_id=?) AND tenant_id=? AND tenant_app_id=?|1|6|6||0|0|2379420|2379420|1|1|
|wx_gateway|SELECT media_id FROM wx_gateway.wx_image WHERE tenant_app_id=? AND state=?|1|2|2||0|0|231717|231717|0|0|
||INSERT INTO v4_user.cwx_external_user(id,tenant_id,external_user_id,external_user_name,sex,create_time,update_time,raw_external_user_id) SELECT ceu.id,?,ceu.external_user_id,ceu.nick_name,ceu.sex,now(),now(),eut.raw_external_user_id FROM corpwx.corpwx_external_user ceu LEFT JOIN corpwx.external_userid_transform eut ON ceu.tenant_id=eut.tenant_id AND ceu.external_user_id=eut.external_user_id WHERE ceu.tenant_id=? ON DUPLICATE key UPDATE update_time=now()|1|17|17||0|0|32566|32566|0|0|
|v4_sales|SELECT t?.sales_erp_id AS salesErpId,t?.sales_no AS salesNo,DATE_FORMAT(t?.sales_date,?) AS salesDate,t?.member_erp_id AS memberId,t?.employee_erp_id AS employeeErpId,t?.employee_name AS employeeName,t?.assist_employee_erp_id AS assistEmployeeErpId,t?.assist_employee_name AS assistEmployeeName,t?.dept_erp_id AS deptErpId,t?.amount,t?.post_time AS postTime FROM erp_sales t? WHERE t?.dept_erp_id=? AND t?.member_erp_id IN (?) AND t?.post_time>=? AND t?.sales_status=? AND NOT EXISTS (SELECT ? FROM erp_sales_relate esr WHERE t?.tenant_id=esr.tenant_id AND t?.tenant_app_id=esr.tenant_app_id AND t?.sales_erp_id=esr.sales_erp_id AND esr.sales_status IN (?) AND esr.tenant_id=? AND esr.tenant_app_id=?) AND EXISTS (SELECT ? FROM erp_sales_detail esd WHERE t?.tenant_id=esd.tenant_id AND t?.tenant_app_id=esd.tenant_app_id AND t?.sales_erp_id=esd.sales_erp_id AND esd.sales_type IN (?) AND esd.tenant_id=? AND esd.tenant_app_id=?) AND t?.tenant_id=? AND t?.tenant_app_id=?|1|1|1||0|0|1528|1528|249|249|
|export|SELECT od.coupon_id, CASE o.pay_type WHEN ? THEN ? ELSE ? END payTypeText FROM coupon_service.coupon_market_order_detail od JOIN coupon_service.coupon_market_order o ON o.tenant_id=? AND o.tenant_app_id=? AND o.id=od.order_id WHERE od.tenant_id=? AND od.tenant_app_id=? AND od.coupon_id IN (?)|1|1|1||0|0|116841|116841|78|78|
|gift_mail|SELECT count(?) FROM gift_mail.trade t LEFT OUTER JOIN gift_mail.product p ON p.id=t.product_id LEFT OUTER JOIN gift_mail.trade_take tt ON tt.trade_id=t.id WHERE (t.tenant_wechatapp_id=? AND t.trade_type=? AND t.order_status=?)|1|1|1||0|0|3433|3433|1|1|
|tenant|SELECT id,tenant_id,tenant_app_id,user_id,status,group_label,maintain_level,remark,create_time,create_shop_id,create_employee_id,update_time,update_shop_id,update_employee_id,sales_amount,next_maintain_date,maintain_employee_id,sneak_guest_no,last_maintain_date,finish_date,fail_type,oid,user_type FROM sneak_guest WHERE (tenant_app_id=? AND status=? AND create_time<?)|1|2|2||0|0|4210|4210|12|12|
|coupon_service|SELECT * FROM coupon_service.coupon WHERE DATEDIFF(DATE_FORMAT(end_time,?),DATE_FORMAT(now(),?))=? AND coupon_state IN(?)|1|134|134||0|0|11950407|11950407|1197|1197|
|tenant|SELECT sum(tt.maintainCount) AS maintainCount,sum(tt.maintainNum) AS maintainNum,sum(tt.successNum) AS successNum,sum(tt.failNum) AS failNum,sum(tt.saleMoney) AS saleMoney FROM (SELECT count(?) AS maintainCount,count(DISTINCT t.sneak_guest_id) AS maintainNum,? AS successNum,? AS failNum,? AS saleMoney FROM tenant.sneak_guest g JOIN tenant.sneak_guest_maintain t ON t.sneak_guest_id=g.id WHERE g.tenant_app_id=? AND (g.fail_type IS ? OR g.fail_type=?) AND t.event_type IN (?) AND t.create_time>=? AND t.create_time<? UNION ALL SELECT ? AS maintainCount,? AS maintainNum,count(sgs.sneak_guest_id) AS successNum,? AS failNum,sum(sgs.`amount`) AS saleMoney FROM tenant.sneak_guest g JOIN tenant.sneak_guest_sales sgs ON g.id=sgs.sneak_guest_id WHERE g.tenant_app_id=? AND sgs.create_time>=? AND sgs.create_time<? UNION ALL SELECT ? AS maintainCount,? AS maintainNum,? AS successNum,count(DISTINCT t.sneak_guest_id) AS failNum,? AS saleMoney FROM tenant.sneak_guest g JOIN tenant.sneak_guest_maintain t ON t.sneak_guest_id=g.id WHERE g.tenant_app_id=? AND g.fail_type=? AND t.event_type IN (?) AND t.create_time>=? AND t.create_time<?)tt|1|1|1||0|0|30584|30584|1|1|
||UPDATE v4_user.wx_user wu JOIN v4_user.member m ON wu.open_id=m.h5_open_id SET wu.member_id=m.id WHERE wu.member_id=? AND m.tenant_id=?|1|47|47||0|0|115739|115739|0|0|
|corpwx|COMMIT ?|1|1|1||0|0|0|0|0|0|
|activity_service|SELECT count(DISTINCT (user_id)) FROM user_trace WHERE tenant_app_id=? AND activity_id=? AND status!=?|1|1|1||0|0|3515|3515|1|1|
|value_added|SELECT ? AS limitDayType,t.tenant_wechatapp_id,t.user_id,min(ue.employee_erp_id)employee_erp_id,ue.dept_erp_id,GROUP_CONCAT(t.product_barcode ORDER BY product_barcode ASC) AS productCode,GROUP_CONCAT(t.product_name ORDER BY product_barcode ASC) AS productName FROM value_added_user t INNER JOIN value_added_user_extend ue ON t.id=ue.id WHERE t.tenant_wechatapp_id=? AND t.state=? AND t.start_add_time>=date_add(DATE_FORMAT(?,?),interval ?*(t.add_days+t.keeping_days?)day) AND t.start_add_time<date_add(DATE_FORMAT(?,?),interval(?*(t.add_days+t.keeping_days?)+?)day) GROUP BY t.tenant_wechatapp_id,t.user_id,ue.dept_erp_id|1|1|1||0|0|473029|473029|51|51|
||INSERT INTO corpwx.external_user(id,tenant_id,cwx_user_id,user_id,union_id,name,avatar,corp_user_id) SELECT eu.id+?,cu.tenant_id,cu.id,eu.user_id,eu.union_id,eu.name,eu.avatar,cu.corp_user_id FROM corpwx.external_user eu JOIN corpwx.cwx_user cu ON eu.corp_user_id=cu.corp_user_id WHERE eu.tenant_id=? AND cu.tenant_id=? ON DUPLICATE key UPDATE update_time=now()|1|1|1||0|0|47947|47947|0|0|
|v4_sales|SELECT COUNT(*) AS total FROM v4_sales.erp_sales es LEFT JOIN v4_sales.warranty w ON w.sales_id=es.id AND w.tenant_id=? AND w.tenant_app_id=? WHERE is_sales=? AND sales_status=? AND (es.sales_no LIKE concat(?,?) OR es.member_erp_id=?) AND w.id IS NOT ? AND es.tenant_id=? AND es.tenant_app_id=?|1|1|1||0|0|50027|50027|1|1|
|user_service|SELECT count(?) FROM user_service.tenant_member tm JOIN user_service.tenant_member_info tmi ON tmi.tenant_id=? AND tmi.tenant_app_id=? AND tm.id=tmi.id WHERE tm.tenant_id=? AND tm.tenant_app_id=? AND (tm.user_name LIKE concat(?,?,?) OR tm.mobile_no=?)|1|1|1||0|0|92823|92823|1|1|
|order|SELECT od.id,od.order_no orderNo,od.status,od.take_type takeType,od.create_time createTime,od.remark,od.total_fee totalFee,od.freight_fee freightFee,od.discount_fee discountFee,od.take_id takeId,od.payment_fee paymentFee,dt.product_id productId,dt.price,dt.quantity,dt.sku_id skuId,dt.art_no artNo,dt.image_url imageUrl,dt.product_name productName,dt.take_remark takeRemark,dt.take_day takeDay,od.product_fee productFee,od.finish_type finishType,od.send_time sendTime,od.receive_time receiveTime,od.finish_time finishTime,od.child_status childStatus,od.send_good_remark sendGoodRemark,od.service_flag serviceFlag,od.coupon_id couponId,od.tenant_wechatapp_id tenantAppId,od.tenant_id tenantId,od.pay_id payId,od.user_id userId,od.user_name userName,od.mobile_no buyMobileNo,od.activity_id,od.offline_payment_fee,od.activity_type,dt.spec,od.take_shop_id,od.take_shop_name,od.take_employee_user_id,od.take_employee_user_name FROM order_info od LEFT JOIN order_detail dt ON od.id=dt.order_id WHERE od.status=? AND od.receive_time<=?|1|3|3||0|0|263035|263035|36|36|
|activity_service|SELECT count(*)>? FROM activity_service.online_sign_user_sign_log WHERE tenant_app_id=? AND user_id=? AND to_days(create_time)=to_days(?)|1|1|1||0|0|910|910|1|1|
|user_service|SELECT count(?) FROM user_service.tenant_member t? JOIN user_service.tenant_member_info t? ON t?.tenant_id=t?.tenant_id AND t?.id=t?.id AND t?.tenant_app_id=? AND t?.shop_id=? WHERE t?.tenant_id=? AND t?.tenant_app_id=? AND (t?.mobile_no LIKE concat(?,?) OR t?.user_name LIKE concat(?,?,?))|1|2|2||0|0|536834|536834|1|1|
|value_added|UPDATE value_added_user SET state=? WHERE state=? AND tenant_id=? AND tenant_wechatapp_id=? AND user_id=? AND product_barcode=?|1|2|2||0|0|171|171|0|0|
|authorization_service|SELECT ar.tenant_id,ar.tenant_app_id,a.employee_id,ar.shop_id,ar.role_code,ar.role_name,a.status AS account_status,ar.status AS role_status FROM authorization_service.account_role? ar JOIN authorization_service.account a ON ar.account_id=a.id WHERE ar.tenant_id=? AND ar.tenant_app_id=? AND ar.role_code IN (?)|1|1|1||0|0|65954|65954|2|2|
|corpwx_license|SELECT corp_id,agent_id,corp_wx_user_id,max(blocked_time)blocked_time FROM app_blocked WHERE corp_wx_user_id=? AND tenant_id=? GROUP BY corp_id,agent_id,corp_wx_user_id|1|1|1||0|0|20827|20827|0|0|
|v4_user|SELECT pc.id,count(*) AS maintainCount FROM potential_customer pc JOIN potential_customer_maintain pcm ON pc.id=pcm.potential_customer_id AND pcm.tenant_id=? AND pcm.tenant_app_id=? WHERE pc.maintain_shop_id=? AND pc.status=? AND pcm.event_type IN (?) AND pc.finish_time>=? AND pc.finish_time<? AND pc.tenant_id=? AND pc.tenant_app_id=? GROUP BY pc.id|1|1|1||0|0|662|662|0|0|
|mysql|DELETE FROM message_push.message_log WHERE create_time<DATE_SUB(now(),interval ? day)|1|70|70||0|0|2480210|2480210|0|0|
|user_service|SELECT tu.user_name AS memberName,tu.mobile_no AS mobile,emg.grade_name AS gradeLevel,tu.user_id AS memberUserId,tu.tenant_id AS tenantId,tu.tenant_app_id AS tenantAppId,ue.employee_id AS employeeId,ue.employee_erp_id AS employeeErpId,tmb.erp_member_id AS memberErpId,tmi.shop_id FROM user_service.tenant_member tu JOIN user_service.tenant_member_info tmi ON tu.tenant_id=tmi.tenant_id AND tu.id=tmi.id LEFT JOIN user_service.tenant_member_bind tmb ON tu.tenant_id=tmb.tenant_id AND tu.id=tmb.id LEFT JOIN user_service.erp_member_grade emg ON tu.tenant_id=emg.tenant_id AND tmi.grade_id=emg.grade_erp_id LEFT JOIN user_service.user_employee ue ON tu.tenant_id=ue.tenant_id AND tu.tenant_app_id=ue.tenant_wechatapp_id AND tu.user_id=ue.user_id WHERE tu.tenant_id=? AND tu.tenant_app_id=? AND tu.user_id IN (?)|1|1|1||0|0|400|400|80|80|
|v4_sales|SELECT id,sales_id,status,tenant_id,tenant_app_id,create_time,update_time FROM comment_not_remind_sales WHERE (status=?)|1|1|1||0|0|119107|119107|402|402|
||INSERT INTO v4_user.employee_external_bind(id,tenant_id,external_user_id,corp_user_id,employee_id) SELECT eu.id,?,eu.user_id,eu.corp_user_id,e.id FROM corpwx.external_user eu JOIN tenant.employee e ON e.corp_wx_user_id=eu.corp_user_id WHERE eu.tenant_id=? AND e.tenant_id=?|1|15|15||0|0|33075|33075|0|0|
||INSERT INTO user_service.wx_user_back SELECT * FROM user_service.wx_user WHERE wx_app_id=? ON DUPLICATE key UPDATE update_time=now()|1|44|44||0|0|50193|50193|0|0|
|value_added|SELECT ID,tenant_wechatapp_id AS tenantWechatappId,user_id AS userId,template_id AS templateId,sales_erp_id AS saleserpid,product_name AS productName,shop_name AS shopName,product_barcode AS productBarcode,amount_total AS amountTotal,amount_pay AS amountPay,amount_added AS amountAdded,state AS state,add_days,added_percent_per_day AS addedPercentPerDay,devalue_percent_per_day AS devaluePercentPerDay,keeping_days AS keepingDays,exchange_days AS exchangeDays,coupon_user_id AS couponUserId,sales_index AS salesIndex,start_add_time AS createtime,DATE_ADD(start_add_time,INTERVAL add_days? DAY),DATE_ADD(start_add_time,INTERVAL add_days+keeping_days? DAY) FROM value_added_user WHERE keeping_days>? AND state=? AND start_add_time=date_add(CURDATE(),interval ?*(add_days?)day)|1|12|12||0|0|2105550|2105550|784|784|
