|数据库名称|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 NULL AND es.tenant_id = ? AND es.tenant_app_id = ?|638|1091|9||0|0|2906253|28454|638|1|
|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 NULL 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|167|261|7||0|0|530601|7309|362|5|
|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 < ?|153|389|16||0|0|17624382|115193|0|0|
|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 ?|149|339|5||0|0|2714630|39537|149|1|
|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 = ?|106|162|4||0|0|28209570|266750|530|5|
|tenant|SELECT count(0) 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 = ?|87|125|4||0|0|325723|3934|87|1|
|user_service|SELECT tu.user_id, tm.shop_id, mb.erp_member_id AS 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 (?)|86|237|19||0|0|40022139|1902231|6712|470|
|user_service|SELECT count(0) FROM user_service.tenant_member t1 JOIN user_service.tenant_member_info t2 ON t1.tenant_id = t2.tenant_id AND t1.id = t2.id AND t2.tenant_app_id = ? AND t2.shop_id = ? JOIN user_service.user_employee ue ON t1.tenant_id = ue.tenant_id AND t1.tenant_app_id = ue.tenant_wechatapp_id AND t1.user_id = ue.user_id AND ue.employee_id = ? AND ue.shop_id = ? WHERE t1.tenant_id = ? AND t1.tenant_app_id = ?|85|144|4||0|0|566786|14900|85|1|
|tenant|SELECT sg.id, sg.sneak_guest_no, sg.user_id, sg.user_type, sg.maintain_level , sg.maintain_employee_id, sg.create_time, sg.last_maintain_date, ey.employee_name AS maintainEmployeeName, sg.status , sg.finish_date, sg.next_maintain_date 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 = ? ORDER BY sg.id DESC LIMIT ?, ?|81|111|1||0|0|296298|4361|805|10|
|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|59|86|5||0|0|109450|2040|49970|939|
|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 = ?|43|77|8||0|0|11508678|292294|43|1|
|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 > ?|31|60|5||0|0|5446664|175699|0|0|
|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 ?|29|38|1||0|0|8473029|292294|36|2|
|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 = ?|29|50|4||0|0|207745|15340|29|1|
|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 = ?|29|50|4||0|0|192566|13382|29|1|
|order|SELECT max(create_time) FROM `order`.order_operator_log WHERE tenant_wechatapp_id = ? AND order_id = ?|28|168|15||0|0|30188567|1078226|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|27|70|4||0|0|218896|8273|15|1|
|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 = ?|26|40|2||0|0|6920720|266855|26|1|
|corpwx|UPDATE external_user SET un_assign_flag = ? WHERE tenant_id = ? AND status = ? AND un_assign_flag = ?|26|95|8||0|0|790198|73914|0|0|
|tenant|SELECT count(0) 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 = ?|22|30|2||0|0|77486|6696|22|1|
|v4_sales|SELECT ifnull(sum(integral), ?) AS 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 = ?|21|58|10||0|0|380492|36370|21|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 = ?|20|27|2||0|0|7946|460|3772|220|
|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 = ?|17|39|4||0|0|140234|8272|7|1|
|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 ?|16|50|8||0|0|4830897|795761|3|1|
|user_service|SELECT count(0) FROM user_service.tenant_member t1 JOIN user_service.tenant_member_info t2 ON t1.tenant_id = t2.tenant_id AND t1.id = t2.id AND t2.tenant_app_id = ? AND t2.shop_id = ? WHERE t1.tenant_id = ? AND t1.tenant_app_id = ?|16|45|12||0|0|4542975|880647|16|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_role2 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 = ?|16|23|3||0|0|1047772|65521|289|28|
|user_service|SELECT count(0) 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 t3 ON tm.user_id = t3.user_id AND tm.tenant_id = t3.tenant_id AND tm.tenant_app_id = t3.tenant_wechatapp_id WHERE t3.id IS NULL AND tmi.shop_id = ? AND tmi.tenant_id = ? AND tmi.tenant_app_id = ?|15|65|9||0|0|518152|80541|15|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 ?|15|19|2||0|0|5999876|399997|16|2|
|coupon_service|SELECT * FROM coupon_service.coupon_can_give WHERE coupon_id = ? LIMIT ?|14|21|3||0|0|4616999|332126|14|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, '%Y-%m-%d') >= ?) AND w.id IS NOT NULL AND es.tenant_id = ? AND es.tenant_app_id = ?|13|18|2||0|0|51595|6679|13|1|
|v4_employee|SELECT count(*) AS total_count, count(finish_time) AS finish_count FROM task_task t JOIN task_invite_task_template t2 ON t.task_template_id = t2.id AND t2.tenant_id = ? AND t2.tenant_app_id = ? WHERE t2.invite_time < ? AND t.end_time > ? AND t2.status IN (?) AND t.task_type = ? AND t.status = ? AND t.shop_id = ? AND t.tenant_id = ? AND t.tenant_app_id = ?|13|64|12||0|0|7992746|658505|13|1|
|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 NULL AND es.tenant_id = ? AND es.tenant_app_id = ?|12|23|2||0|0|2496014|367529|12|1|
|v4_employee|SELECT count(1) AS total_count, count(finish_time) AS finish_count FROM task_task t JOIN task_system_task_template t2 ON t.task_template_id = t2.id AND t2.status = ? AND t2.tenant_id = ? AND t2.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 = ?|12|38|4||0|0|2404061|273076|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 = ? AND status IN (?) AND maintain_shop_id = ? AND tenant_id = ? AND tenant_app_id = ?|11|24|4||0|0|26393|2406|0|0|
|warranty_service|SELECT count(*) FROM warranty WHERE user_id = ? AND tenant_wechatapp_id = ? AND is_disable = ?|10|83|19||0|0|191773|30893|10|1|
|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 = ?|10|23|3||0|0|114887|14773|10|1|
|coupon_service|SELECT cet.id, cet.coupon_id, cet.user_id, cet.coupon_type, cet.expire_time , if(cet.expire_time < now() AND cet.status = ?, ?, cet.status) AS status FROM coupon_service.coupon_expire_task cet JOIN coupon_service.coupon_extend ce ON ce.tenant_id = ? AND ce.tenant_app_id = ? AND ce.coupon_id = cet.coupon_id WHERE cet.tenant_id = ? AND cet.tenant_app_id = ? AND cet.employee_id = ? AND cet.shop_id = ?|10|14|1||0|0|26962|15146|13481|7573|
|tenant|SELECT t1.id AS employeeId, t1.employee_name, t2.shop_id, sp.shop_name , ifnull(sum(t3.maintainCount), ?) AS maintainCount , ifnull(sum(t3.maintainNum), ?) AS maintainNum , ifnull(sum(t3.successNum), ?) AS successNum , ifnull(sum(t3.failNum), ?) AS failNum , ifnull(sum(t3.saleMoney), ?) AS saleMoney FROM tenant.employee t1 JOIN tenant.employee_shop t2 ON t1.id = t2.employee_id JOIN tenant.tenant_wechatapp_shop sp ON t2.shop_id = sp.id LEFT JOIN ( SELECT t.employee_id AS employeeId, count(1) AS maintainCount, count(DISTINCT t.sneak_guest_id) AS maintainNum , ? AS successNum, ? AS failNum, ? AS saleMoney FROM ( SELECT sgm.employee_id, g.id AS sneak_guest_id FROM tenant.sneak_guest g JOIN tenant.sneak_guest_maintain sgm ON sgm.sneak_guest_id = g.id WHERE g.tenant_app_id = ? AND g.create_shop_id = ? AND sgm.event_type IN (?) AND sgm.create_time >= ? AND sgm.create_time < ? UNION ALL SELECT g.maintain_employee_id AS employee_id, g.id AS sneak_guest_id FROM tenant.sneak_guest g JOIN tenant.sneak_guest_maintain sgm ON sgm.sneak_guest_id = g.id WHERE g.tenant_app_id = ? AND g.create_shop_id = ? AND g.fail_type = ? AND sgm.event_type = ? AND sgm.create_time >= ? AND sgm.create_time < ? ) t GROUP BY employee_id UNION ALL SELECT t.employee_id AS employeeId, ? AS maintainCount, ? AS maintainNum, count(DISTINCT t.sneak_guest_id) AS successNum , ? AS failNum, sum(sgs.`amount`) AS saleMoney FROM tenant.sneak_guest g JOIN tenant.sneak_guest_maintain t ON t.sneak_guest_id = g.id JOIN tenant.sneak_guest_sales sgs ON g.id = sgs.sneak_guest_id WHERE g.tenant_app_id = ? AND g.create_shop_id = ? AND t.event_type = ? AND t.create_time >= ? AND t.create_time < ? GROUP BY t.employee_id UNION ALL SELECT g.maintain_employee_id AS employeeId, ? 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.create_shop_id = ? AND t.event_type = ? AND g.fail_type = ? AND t.create_time >= ? AND t.create_time < ? GROUP BY g.maintain_employee_id ) t3 ON t1.id = t3.employeeId WHERE t1.tenant_id = ? AND t2.tenant_app_id = ? AND t2.shop_id = ? GROUP BY t1.id, t1.employee_name|9|19|3||0|0|902761|172034|282|43|
|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 = ?|9|14|3||0|0|21564|2403|1|1|
|user_service|SELECT t1.id, t1.user_id AS userId, t1.user_name AS userName, t1.sex, t1.mobile_no AS mobileNo , t1.head_img_url AS headImg FROM user_service.tenant_member t1 JOIN user_service.tenant_member_info t2 ON t1.tenant_id = t2.tenant_id AND t1.id = t2.id AND t2.tenant_app_id = ? AND t2.shop_id = ? JOIN user_service.user_employee ue ON t1.tenant_id = ue.tenant_id AND t1.tenant_app_id = ue.tenant_wechatapp_id AND t1.user_id = ue.user_id AND ue.employee_id = ? AND ue.shop_id = ? WHERE t1.tenant_id = ? AND t1.tenant_app_id = ? ORDER BY ue.update_time DESC, t1.id DESC LIMIT ?|9|12|2||0|0|123116|19780|90|10|
|v4_employee|SELECT ? AS task_type, t1.id AS invite_task_id, t1.name , ifnull(t2.undo_count, ?) AS undo_count, t1.invite_time AS invite_task_start_time , ifnull(t1.interrupt_time, t1.end_time) AS invite_task_end_time FROM task_invite_task_template t1 LEFT JOIN ( SELECT t.task_template_id AS id , sum(if(t.finish_time IS NULL, ?, ?)) 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 ) t2 ON t1.id = t2.id WHERE t1.status IN (?) AND t1.tenant_id = ? AND t1.tenant_app_id = ? ORDER BY t1.id DESC|9|18|5||0|0|28011|3391|54|6|
|coupon_service|SELECT count(0) 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 WHERE cu.tenant_id = ? AND cu.tenant_app_id = ? AND cu.coupon_name LIKE CONCAT(CONCAT(?, ?), ?) AND cu.coupon_type = ?|9|260|46||0|0|1639267|182179|9|1|
|user_service|SELECT count(0) 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 = ?|9|71|18||0|0|797692|99134|9|1|
|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(1) 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 NULL OR g.fail_type = ?) AND t.event_type IN (?) AND t.create_time >= ? AND t.create_time < ? AND g.create_shop_id = ? 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 < ? AND g.create_shop_id = ? 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 < ? AND g.create_shop_id = ? ) tt|8|20|3||0|0|447139|90065|8|1|
|v4_sales|SELECT es.id AS salesId, es.sales_no, es.sales_date, es.member_erp_id AS 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 NULL AND es.tenant_id = ? AND es.tenant_app_id = ? ORDER BY es.sales_date DESC, es.id DESC LIMIT ?|8|12|1||0|0|3643246|627646|9|2|
|v4_coupon|UPDATE v4_coupon.coupon SET coupon_status = ? WHERE tenant_id = ? AND tenant_app_id = ? AND coupon_status = ? AND end_time < now()|7|11|3||0|0|2792664|916872|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 = ?|7|28|6||0|0|228428|39537|7|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, '%Y-%m-%d') >= ?) AND w.id IS NULL AND es.tenant_id = ? AND es.tenant_app_id = ?|7|11|2||0|0|42968|15708|7|1|
|employee|SELECT count(*) FROM label_task_employee t1 JOIN label_task_setting t2 ON t1.label_task_id = t2.id AND t2.disabled = ? WHERE t1.tenant_app_id = ? AND t1.shop_id = ? AND t1.visit_status > ? AND t1.finish_time >= DATE_SUB(CURRENT_DATE, INTERVAL ? DAY) AND t1.finish_time < CURRENT_DATE|7|12|2||0|0|128327|51424|7|1|
|v4_sales|SELECT t1.sales_erp_id AS salesErpId, t1.sales_no AS salesNo, DATE_FORMAT(t1.sales_date, '%Y-%m-%d') AS salesDate , t1.member_erp_id AS memberId, t1.employee_erp_id AS employeeErpId, t1.employee_name AS employeeName, t1.assist_employee_erp_id AS assistEmployeeErpId, t1.assist_employee_name AS assistEmployeeName , t1.dept_erp_id AS deptErpId, t1.amount, t1.post_time AS postTime FROM erp_sales t1 WHERE t1.employee_erp_id = ? AND t1.post_time >= ? AND t1.post_time <= ? AND t1.is_sales = ? AND t1.sales_status = ? AND t1.tenant_id = ? AND t1.tenant_app_id = ?|6|9|1||0|0|20422|5937|9|2|
|employee|SELECT id, scene, employee_id, member_user_name AS 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 ?|6|28|6||0|0|2981029|544317|28|8|
|order|SELECT count(0) 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 = ?|6|14|4||0|0|754593|174594|6|1|
|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 ?|6|11|2||0|0|259925|54281|6|1|
|authorization_service|update user_login_token set status=? where login_token in|6|9|3||0|0|6811|1743|0|0|
|order|SELECT count(1) AS total , ifnull(sum(if(od.status > ?, od.payment_fee, ?)), ?) AS paymentFee , ifnull(sum(if(od.status > ?, od.offline_payment_fee, ?)), ?) AS offlinePaymentFee , ifnull(sum(if(od.status > ?, od.payment_fee + od.offline_payment_fee, ?)), ?) AS 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 = ?|6|14|4||0|0|754593|174594|6|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, '%Y-%m-%d %H') = date_format(now(), '%Y-%m-%d %H')|5|75|24||0|0|1039933|327713|10725|3304|
|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 = ?|5|6|1||0|0|49960|10193|37|37|
|tenant|SELECT e.id, e.employee_name FROM ( SELECT DISTINCT sgm.employee_id FROM tenant.sneak_guest sg JOIN tenant.sneak_guest_maintain sgm ON sgm.sneak_guest_id = sg.id WHERE sg.tenant_id = ? AND sg.tenant_app_id = ? AND sg.update_shop_id = ? AND sgm.event_type IN (?) AND (sg.fail_type IS NULL OR sg.fail_type = ?) AND sgm.create_time BETWEEN ? AND ? ) t JOIN tenant.employee e ON e.id = t.employee_id|5|61|25||0|0|465408|122400|53|15|
|tenant|SELECT sg.id, sg.sneak_guest_no, sg.user_id, sg.user_type, sg.maintain_level , sg.maintain_employee_id, sg.create_time, sg.last_maintain_date, ey.employee_name AS maintainEmployeeName, sg.status , sg.finish_date, sg.next_maintain_date 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 = ? ORDER BY sg.id DESC LIMIT ?|5|6|1||0|0|15859|3265|50|10|
|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 = ?|5|5|1||0|0|3481|1106|5|1|
|v4_sales|SELECT COUNT(*) AS total FROM value_added_record WHERE value_added_id = ? AND tenant_id = ? AND tenant_app_id = ?|5|44|10||0|0|11128585|2225717|5|1|
|value_added|SELECT ? AS limitDayType, t.tenant_wechatapp_id AS tenantAppId, t.user_id AS userId, min(ue.employee_erp_id) AS 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(?, '%Y-%m-%d'), INTERVAL ? * (t.add_days - ?) DAY) AND t.start_add_time < date_add(DATE_FORMAT(?, '%Y-%m-%d'), INTERVAL ? * (t.add_days - ?) + ? DAY) GROUP BY t.tenant_wechatapp_id, t.user_id, ue.dept_erp_id|5|18|12||0|0|1359195|470906|235|101|
|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 = ?|5|6|1||0|0|19597|4569|5|1|
|user_service|SELECT count(0) 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 = ?)|5|6|1||0|0|1114263|480487|5|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|5|5|1||0|0|34155|9414|17009|4707|
|user_service|SELECT count(0) FROM user_service.tenant_member t1 JOIN user_service.tenant_member_info t2 ON t1.tenant_id = t2.tenant_id AND t1.id = t2.id AND t2.tenant_app_id = ? AND t2.shop_id = ? WHERE t1.tenant_id = ? AND t1.tenant_app_id = ? AND (t1.mobile_no LIKE concat(?, ?) OR t1.user_name LIKE concat(?, ?, ?))|4|5|1||0|0|1921889|480476|4|1|
|user_service|SELECT count(0) FROM user_service.tenant_member t1 JOIN user_service.tenant_member_info t2 ON t1.tenant_id = t2.tenant_id AND t1.id = t2.id AND t2.tenant_app_id = ? AND t2.shop_id = ? JOIN user_service.user_employee ue ON t1.tenant_id = ue.tenant_id AND t1.tenant_app_id = ue.tenant_wechatapp_id AND t1.user_id = ue.user_id AND ue.employee_id = ? AND ue.shop_id = ? WHERE t1.tenant_id = ? AND t1.tenant_app_id = ? AND (t1.mobile_no LIKE concat(?, ?) OR t1.user_name LIKE concat(?, ?, ?))|4|6|2||0|0|14880|5088|4|1|
|v4_user|SELECT maintain_employee_id, id FROM potential_customer WHERE maintain_shop_id = ? AND status IN (?) AND tenant_id = ? AND tenant_app_id = ?|4|10|7||0|0|9564|2404|1061|619|
|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 = ?)|4|4|1||0|0|8427|3270|4|1|
|erp_app|INSERT INTO app_status (id, tenant_id, app_name, version, pid) VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE version = ?, pid = ?, online_status_time = ?|4|5|1||0|0|0|0|0|0|
|tenant|SELECT count(0) 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, t1.employee_name AS createEmployeeName , sg.finish_date, sg.fail_type, gs.sales_id, gs.sales_no, w1.shop_name AS salesShopName , gs.create_time AS salesDate, gs.product_name, gs.product_quantity, gs.amount AS salesAmount , if(sg.status = ?, CASE  WHEN sg.fail_type = ? THEN ? 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 t1 ON sg.create_employee_id = t1.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 w1 ON gs.shop_id = w1.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|4|48|17||0|0|3067092|766773|4|1|
|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 ?|3|20|8||0|0|3234390|1078182|0|0|
|v4_user|SELECT checkin_time, id FROM potential_customer WHERE maintain_shop_id = ? AND status IN (?) AND tenant_id = ? AND tenant_app_id = ?|3|9|7||0|0|7182|2404|442|275|
|coupon_service|SELECT count(0) 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 WHERE cu.tenant_id = ? AND cu.tenant_app_id = ? AND cu.coupon_name LIKE CONCAT(CONCAT(?, ?), ?) AND cu.coupon_type = ? AND cu.coupon_state = ? AND cu.end_time > now()|3|4|1||0|0|20818|6970|3|1|
|employee|SELECT id, scene, employee_id, member_user_name AS 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|32|17||0|0|3922821|1307607|6|2|
|coupon_service|SELECT count(0) 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 WHERE cu.tenant_id = ? AND cu.tenant_app_id = ? AND cu.coupon_name LIKE CONCAT(CONCAT(?, ?), ?) AND cu.coupon_type = ? AND cu.coupon_state = ? AND cu.end_time > now() AND cu.create_time >= ? AND cu.create_time <= ?|3|7|3||0|0|20940|6988|3|1|
|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 / ?, ?) AS 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 WHERE cu.tenant_id = ? AND cu.tenant_app_id = ? AND cu.coupon_name LIKE CONCAT(CONCAT(?, ?), ?) AND cu.coupon_type = ? LIMIT ?|3|8|5||0|0|155757|51919|60|20|
||SELECT wx_app_id, count(*) AS c FROM user_service.wx_user WHERE wx_app_id IN (?) GROUP BY wx_app_id|3|40|25||0|0|37994|12666|5|2|
|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 (?)|3|3|1||0|0|147|51|49|17|
|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|2|4|2||0|0|624715|315373|2|1|
|tenant|SELECT es.id, es.sales_no, es.sales_date, es.sales_erp_id, es.amount , ifnull(shop.shop_name, ed.dept_name) AS 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 ) ORDER BY es.sales_date DESC LIMIT ?|2|3|1||0|0|12321644|6160822|20|10|
|employee|UPDATE backlog_system SET status = ?, finish_time = now() WHERE tenant_app_id = ? AND scene = ?|2|8|7||0|0|1599200|1415300|0|0|
|tenant|SELECT count(0) FROM ( SELECT es.id, es.sales_no, es.sales_date, es.sales_erp_id, es.amount , ifnull(shop.shop_name, ed.dept_name) AS 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|12324392|6162196|2|1|
|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|2|2|1||0|0|70117|42432|64|53|
|user_service|SELECT * FROM user_employee WHERE tenant_wechatapp_id = ? AND employee_id = ?|2|2|1||0|0|6405|3559|6405|3559|
||SELECT * FROM timer.task_execute_log WHERE task_id = ? ORDER BY id DESC|2|3|1||0|0|780622|390312|1002|501|
|v4_employee|SELECT LEFT(start_time, ?) AS day, count(*) AS undo_count , datediff(end_time, NULL) AS left_days FROM task_task WHERE task_type = ? AND status = ? AND system_task_type = ? AND finish_time IS NULL AND end_time > NULL AND shop_id = ? AND tenant_id = ? AND tenant_app_id = ? GROUP BY LEFT(start_time, ?), end_time|2|3|1||0|0|93049|88203|0|0|
|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|2|3|2||0|0|5819|3172|5819|3172|
|v4_sales|SELECT * FROM v4_sales.value_added_record WHERE value_added_id = ? AND date_format(create_time, '%Y-%m-%d') = ? AND tenant_id = ? AND tenant_app_id = ?|2|6|5||0|0|4441875|2221587|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) AS category_erp_id, max(es.sales_date) AS 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, 1 = 1) AND va.id IS NULL AND i.id IS NULL|2|3|2||0|0|22297|17756|2|1|
||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 / ?, ?) AS 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 WHERE cu.tenant_id = ? AND cu.tenant_app_id = ?|2|85|83||0|0|353460|343458|176730|171729|
||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 / ?, ?) AS 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 WHERE cu.tenant_id = ? AND cu.tenant_app_id = ? AND cu.coupon_name LIKE CONCAT(CONCAT(?, ?), ?) LIMIT ?|2|12|7||0|0|104158|52079|200|100|
|coupon_service|SELECT count(0) 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 WHERE cu.tenant_id = ? AND cu.tenant_app_id = ? AND cu.coupon_name LIKE CONCAT(CONCAT(?, ?), ?) AND cu.create_time >= ? AND cu.create_time <= ?|2|9|5||0|0|41209|20656|2|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|2|3|2||0|0|13356|6774|6678|3387|
||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 / ?, ?) AS 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 WHERE cu.tenant_id = ? AND cu.tenant_app_id = ? AND cu.coupon_name LIKE CONCAT(?, ?, ?) LIMIT ?|2|17|10||0|0|104158|52079|200|100|
|employee|SELECT count(0) FROM employee.backlog WHERE tenant_id = ? AND tenant_app_id = ? AND shop_id = ? AND status = ? AND finish_time BETWEEN ? AND ? AND employee_id = ? AND scene NOT IN (?)|2|4|2||0|0|10056|6720|2|1|
|gift_mail|SELECT count(0) 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, ?) AS quantity, pt.partner_name AS vendorName , ? AS distance, c.categroy_name AS categroy_name, pp.partner_id FROM product p INNER JOIN category c ON c.id = p.category_id LEFT JOIN self_product sp ON p.id = sp.product_id LEFT JOIN partner_product pp ON p.id = pp.product_id LEFT JOIN partner pt ON pt.id = pp.partner_id LEFT JOIN ( SELECT product_id, sum(quantity) AS quantity FROM gift_mail.inventory GROUP BY product_id ) t ON p.id = t.product_id WHERE p.is_disable IS NULL OR p.is_disable = ? ) p LEFT JOIN product_status ps ON p.id = ps.product_id AND ps.tenant_wechatapp_id = ? WHERE p.product_status = ? AND p.topping = ? AND p.tenant_id = ? AND (ps.id IS NOT NULL OR p.tenant_wechatapp_id = ?)|2|3|2||0|0|107916|53959|2|1|
|v4_coupon|SELECT tenant_id, tenant_app_id, member_id, count(1) AS total FROM v4_coupon.coupon WHERE DATEDIFF(DATE_FORMAT(end_time, '%Y-%m-%d'), DATE_FORMAT(now(), '%Y-%m-%d')) = ? AND coupon_status IN (?) GROUP BY tenant_id, tenant_app_id, member_id|2|25|13||0|0|1835388|918182|327|164|
|authorization_service|SELECT id, platform_user_id, user_id, wx_user_id, employee_id , shop_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 , wx_app_user_id FROM user_login_token WHERE tenant_id = ? AND employee_id = ? AND status = ?|2|4|2||0|0|2562|1743|2562|1743|
|erp_sync|SELECT * FROM erp_sync.retry_data WHERE (need_erp_member_id = ? OR (need_erp_member_id = ? AND erp_member_id IS NOT NULL)) AND retry_times > ? ORDER BY id|2|2|1||0|0|7674|3837|420|210|
|gift_mail|SELECT count(0) 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) AS address , if(t.trade_type = ?, pl.id, it.barcode) AS barcode , if(t.trade_type = ?, pl.default_image_url, p.default_image_url) AS defaultImageUrl FROM trade t LEFT JOIN trade_take tt ON t.tenant_wechatapp_id = tt.tenant_wechatapp_id AND t.id = tt.trade_id LEFT JOIN trade_addr ta ON t.tenant_wechatapp_id = ta.tenant_wechatapp_id AND t.id = ta.trade_id LEFT JOIN product p ON p.id = t.product_id LEFT JOIN platform_product pl ON pl.id = t.product_id LEFT JOIN inventory it ON it.product_id = t.product_id AND it.specification = t.specification LEFT 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|2|2|1||0|0|97202|56000|2|1|
|tenant|SELECT count(*) AS amount FROM sneak_guest WHERE tenant_app_id = ? AND status = ? AND create_shop_id = ? AND create_time <= ?|2|3|2||0|0|6678|3387|2|1|
|coupon_service|SELECT cmod.coupon_id, cmo.pay_type, cmo.id AS 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|3|2||0|0|83687|55163|21|20|
|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 NULL|2|2|1||0|0|27772|16000|13886|8000|
|coupon_service|SELECT count(0) 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 WHERE cu.tenant_id = ? AND cu.tenant_app_id = ? AND cu.coupon_name LIKE CONCAT(CONCAT(?, ?), ?)|2|43|29||0|0|364238|182119|2|1|
|tenant|SELECT count(0) 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_department.dept_name LIKE concat(?, ?, ?)|2|2|1||0|0|1617250|808625|2|1|
|gift_mail|SELECT count(*) FROM gift_mail.trade t WHERE t.tenant_wechatapp_id = ? AND t.trade_type = ? AND t.order_status = ?|2|2|1||0|0|18380|9190|2|1|
|timer|SELECT id, service, name, callback, params , cron, delay, next_time, status, create_time , update_time FROM task_info WHERE status = ?|2|3|1||0|0|377568|188784|3256|2693|
|order|SELECT count(1) AS total , ifnull(sum(if(od.status > ?, od.payment_fee, ?)), ?) AS paymentFee , ifnull(sum(if(od.status > ?, od.offline_payment_fee, ?)), ?) AS offlinePaymentFee , ifnull(sum(if(od.status > ?, od.payment_fee + od.offline_payment_fee, ?)), ?) AS 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|1|1||0|0|9924|9924|1|1|
|user_service|SELECT count(0) 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|308061|308061|1|1|
|mysql|DELETE FROM message_push.message_log WHERE create_time < DATE_SUB(now(), INTERVAL ? DAY)|1|68|68||0|0|2436937|2436937|0|0|
||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 / ?, ?) AS 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 WHERE cu.tenant_id = ? AND cu.tenant_app_id = ? AND cu.coupon_name LIKE CONCAT(CONCAT(?, ?), ?)|1|30|30||0|0|182131|182131|3709|3709|
|order|SELECT count(0) 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 = ?|1|1|1||0|0|21738|21738|1|1|
|gift_mail|SELECT id, tenant_wechatapp_id, shop_id, shop_name, product_id , create_time, update_time FROM take_shop WHERE product_id = ?|1|1|1||0|0|49044|49044|18|18|
|tenant|SELECT erp_sales.id, erp_sales.sales_erp_id AS saleserpid, erp_sales.sales_no AS salesno, erp_sales.sales_date AS salesdate, erp_sales.member_erp_id AS membererpid , erp_sales.employee_erp_id AS employeeerpid, erp_sales.employee_name AS employeename, erp_sales.dept_erp_id AS depterpid, erp_sales.amount AS amount, erp_sales.sales_remark AS salesremark , erp_sales.receipts AS receipts, erp_sales.sales_status AS salesstatus, erp_sales.busi_date AS busidate, erp_department.dept_name AS deptname, tenant.full_name AS tenantFullName , tenant.short_name AS tenantShortName 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_department.dept_name LIKE concat(?, ?, ?) LIMIT ?, ?|1|1|1||0|0|808625|808625|7|7|
|mysql|DELETE FROM wx_gateway.wx_template_msg WHERE create_time < DATE_SUB(now(), INTERVAL ? DAY)|1|29|29||0|0|794852|794852|0|0|
|tenant|SELECT sp.id AS shopId, sp.shop_name AS shopName , ifnull(sum(tt.maintainCount), ?) AS maintainCount , ifnull(sum(tt.maintainNum), ?) AS maintainNum , ifnull(sum(tt.successNum), ?) AS successNum , ifnull(sum(tt.failNum), ?) AS failNum , ifnull(sum(tt.saleMoney), ?) AS saleMoney FROM tenant.tenant_wechatapp_shop sp LEFT JOIN ( SELECT g.create_shop_id AS shop_id, count(1) 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 NULL OR g.fail_type = ?) AND t.event_type IN (?) AND t.create_time >= ? AND t.create_time < ? GROUP BY g.create_shop_id UNION ALL SELECT g.create_shop_id AS shop_id, ? 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.tenant_app_id = sgs.tenant_app_id AND g.id = sgs.sneak_guest_id WHERE g.tenant_app_id = ? AND sgs.create_time >= ? AND sgs.create_time < ? GROUP BY g.create_shop_id UNION ALL SELECT g.create_shop_id AS shop_id, ? 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 < ? GROUP BY g.create_shop_id ) tt ON sp.id = tt.shop_id WHERE sp.status = ? AND sp.tenant_wechatapp_id = ? GROUP BY sp.id, sp.shop_name ORDER BY sp.id|1|1|1||0|0|746298|746298|23|23|
|tenant|SELECT count(0) 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|4|4||0|0|808625|808625|1|1|
|coupon_service|SELECT count(0) 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 WHERE cu.tenant_id = ? AND cu.tenant_app_id = ? AND cu.create_time >= ? AND cu.create_time <= ?|1|11|11||0|0|33568|33568|1|1|
|v4_user|SELECT t1.id AS memberId, t1.external_user_id AS externalUserId, t2.corp_user_id AS corpUserId, t2.employee_id, t3.raw_external_user_id AS rawExternalUserId FROM member t1 JOIN employee_external_bind t2 ON t1.tenant_id = t2.tenant_id AND t1.external_user_id = t2.external_user_id AND t2.tenant_id = ? JOIN cwx_external_user t3 ON t1.tenant_id = t3.tenant_id AND t1.external_user_id = t3.external_user_id AND t3.tenant_id = ? WHERE t1.id IN (?) AND t1.tenant_id = ? AND t1.tenant_app_id = ?|1|1|1||0|0|1462|1462|582|582|
|order|SELECT count(0) 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|1|1||0|0|9924|9924|1|1|
|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|1|1|1||0|0|1222101|1222101|1553|1553|
|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|1323|1323|1|1|
|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|14|14||0|0|2128966|2128966|631|631|
|v4_user|SELECT id FROM potential_customer WHERE status IN (?) AND next_maintain_time < ? AND tenant_id = ? AND tenant_app_id = ?|1|5|5||0|0|8273|8273|466|466|
|v4_sales|SELECT es.id AS salesId, es.sales_no, es.sales_date, es.member_erp_id AS 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 NOT NULL AND es.tenant_id = ? AND es.tenant_app_id = ? ORDER BY es.sales_date DESC, es.id DESC LIMIT ?|1|1|1||0|0|627646|627646|1|1|
|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|1|4|4||0|0|7251|7251|10|10|
|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 ?|1|1|1||0|0|4682|4682|0|0|
|v4_giftmall|SELECT * FROM v4_giftmall.trade WHERE trade_type = ? AND order_status = ? AND update_time <= DATE_SUB(NOW(), INTERVAL ? MINUTE)|1|1|1||0|0|10791|10791|0|0|
||SELECT count(*) FROM coupon_service.coupon WHERE create_time < ? AND coupon_state <> ?|1|144|144||0|0|11823798|11823798|1|1|
|employee|SELECT count(0) FROM employee.backlog bg WHERE bg.tenant_app_id = ? AND bg.scene NOT IN (?) AND bg.expire_time BETWEEN ? AND ? AND bg.status IN (?) AND bg.leave_flag = ?|1|11|11||0|0|1307607|1307607|1|1|
|v4_user|SELECT id, checkin_employee_name, maintain_employee_name FROM potential_customer WHERE member_id = ? AND status IN (?) AND tenant_id = ? AND tenant_app_id = ? ORDER BY id ASC|1|2|2||0|0|2391|2391|0|0|
|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|1|1|1||0|0|6344|6344|0|0|
|v4_user|SELECT t2.id AS memberId, t1.id AS potentialCustomerId, t1.checkin_time AS checkinTime FROM potential_customer t1 JOIN member t2 ON t2.id = t1.member_id AND t2.tenant_id = ? AND t2.tenant_app_id = ? WHERE t1.maintain_shop_id = ? AND t1.maintain_employee_id = ? AND t1.`status` IN (?) AND t1.tenant_id = ? AND t1.tenant_app_id = ? UNION SELECT t2.id AS memberId, t1.id AS potentialCustomerId, t1.checkin_time AS checkinTime FROM potential_customer t1 JOIN member t2 ON t2.external_user_id = t1.external_user_id AND t2.tenant_id = ? AND t2.tenant_app_id = ? WHERE t1.maintain_shop_id = ? AND t1.maintain_employee_id = ? AND t1.`status` IN (?) AND t1.member_id = ? AND t1.tenant_id = ? AND t1.tenant_app_id = ?|1|1|1||0|0|922|922|101|101|
|value_added|SELECT ? AS limitDayType, t.tenant_wechatapp_id, t.user_id, min(ue.employee_erp_id) AS 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(?, '%Y-%m-%d'), INTERVAL ? * (t.add_days + t.keeping_days - ?) DAY) AND t.start_add_time < date_add(DATE_FORMAT(?, '%Y-%m-%d'), 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|470942|470942|56|56|
|value_added|UPDATE value_added_user SET amount_added = IF(? > (added_percent_per_day / ? * IF(? >= TIMESTAMPDIFF(DAY, DATE_FORMAT(start_add_time, '%Y-%m-%d'), CURRENT_DATE) + ? - add_days, TIMESTAMPDIFF(DAY, DATE_FORMAT(start_add_time, '%Y-%m-%d'), CURRENT_DATE) + ?, add_days) - devalue_percent_per_day / ? * IF(? >= TIMESTAMPDIFF(DAY, DATE_FORMAT(start_add_time, '%Y-%m-%d'), CURRENT_DATE) + ? - add_days - keeping_days, ?, TIMESTAMPDIFF(DAY, DATE_FORMAT(start_add_time, '%Y-%m-%d'), CURRENT_DATE) + ? - add_days - keeping_days)) * amount_pay, ?, (added_percent_per_day / ? * IF(? >= TIMESTAMPDIFF(DAY, DATE_FORMAT(start_add_time, '%Y-%m-%d'), CURRENT_DATE) + ? - add_days, TIMESTAMPDIFF(DAY, DATE_FORMAT(start_add_time, '%Y-%m-%d'), CURRENT_DATE) + ?, add_days) - devalue_percent_per_day / ? * IF(? >= TIMESTAMPDIFF(DAY, DATE_FORMAT(start_add_time, '%Y-%m-%d'), CURRENT_DATE) + ? - add_days - keeping_days, ?, TIMESTAMPDIFF(DAY, DATE_FORMAT(start_add_time, '%Y-%m-%d'), 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|2128951|2128951|0|0|
|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|46904|46904|1|1|
|user_service|SELECT us.from_id AS id, count(1) AS 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 NULL AND us.shop_id IS NOT NULL GROUP BY us.from_id ORDER BY count(1) DESC|1|5|5||0|0|17280|17280|12|12|
|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 = ?|1|1|1||0|0|580|580|1|1|
|tenant|SELECT count(0) 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 = ? AND es.is_sales = ?|1|1|1||0|0|3603|3603|1|1|
|employee|SELECT count(*) FROM employee.backlog WHERE tenant_id = ? AND tenant_app_id = ? AND shop_id = ? AND status = ? AND expire_time BETWEEN ? AND ?|1|1|1||0|0|3941|3941|1|1|
|tenant|SELECT count(*) FROM sneak_guest WHERE tenant_app_id = ? AND status = ? AND create_shop_id = ? AND maintain_employee_id = ?|1|1|1||0|0|377|377|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 user_id = ? AND tenant_id = ? AND tenant_wx_app_id = ? AND login_way = ? AND status = ? AND expire_time > now()|1|1|1||0|0|245|245|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 NULL, ?, ?) 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 NULL AND p.product_status = ? ORDER BY p.tag_price ASC, p.id DESC LIMIT ?, ?|1|1|1||0|0|8914|8914|6|6|
|employee|SELECT bg.id, bg.employee_id, bg.shop_id, bg.scene, bg.status , bg.create_time, bg.begin_time, bg.expire_time, bg.member_user_name, bg.mobile_no AS member_mobile_no 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.status IN (?) AND bg.scene = ? AND bg.leave_flag = ? ORDER BY id DESC LIMIT ?|1|1|1||0|0|245461|245461|18|18|
|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|12|12||0|0|2128966|2128966|1160|1160|
|order|SELECT od.id, od.order_no AS orderNo, od.status, od.take_type AS takeType, od.create_time AS createTime , od.remark, od.total_fee AS totalFee, od.freight_fee AS freightFee, od.discount_fee AS discountFee, od.take_id AS takeId , od.payment_fee AS paymentFee, dt.product_id AS productId, dt.price, dt.quantity, dt.sku_id AS skuId , dt.art_no AS artNo, dt.image_url AS imageUrl, dt.product_name AS productName, dt.take_remark AS takeRemark, dt.take_day AS takeDay , od.product_fee AS productFee, od.finish_type AS finishType, od.send_time AS sendTime, od.receive_time AS receiveTime, od.finish_time AS finishTime , od.child_status AS childStatus, od.send_good_remark AS sendGoodRemark, od.service_flag AS serviceFlag, od.coupon_id AS couponId, od.tenant_wechatapp_id AS tenantAppId , od.tenant_id AS tenantId, od.pay_id AS payId, od.user_id AS userId, od.user_name AS userName, od.mobile_no AS 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|260191|260191|35|35|
||SELECT * FROM coupon_service.coupon WHERE create_time < ? AND coupon_state <> ?|1|1|1||0|0|27307|27307|5001|5001|
||DELETE FROM tenant.sjfx_dct_erp_sales_detail_extend WHERE create_time < ?|1|1|1||0|0|194673|194673|0|0|
|user_service|SELECT count(*) FROM wx_user WHERE wx_app_id = ?|1|5|5||0|0|11888|11888|1|1|
|employee|SELECT count(0) FROM employee.backlog bg WHERE bg.tenant_app_id = ? AND bg.scene NOT IN (?) AND bg.expire_time BETWEEN ? AND ? AND bg.leave_flag = ?|1|6|6||0|0|1307607|1307607|1|1|
|tenant|SELECT erp_sales.id, erp_sales.sales_erp_id AS saleserpid, erp_sales.sales_no AS salesno, erp_sales.sales_date AS salesdate, erp_sales.member_erp_id AS membererpid , erp_sales.employee_erp_id AS employeeerpid, erp_sales.employee_name AS employeename, erp_sales.dept_erp_id AS depterpid, erp_sales.amount AS amount, erp_sales.sales_remark AS salesremark , erp_sales.receipts AS receipts, erp_sales.sales_status AS salesstatus, erp_sales.busi_date AS busidate, erp_department.dept_name AS deptname, tenant.full_name AS tenantFullName , tenant.short_name AS tenantShortName 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 = ? LIMIT ?, ?|1|1|1||0|0|808625|808625|9|9|
||SELECT count(1) FROM coupon_service.coupon|1|14|14||0|0|11823544|11823544|1|1|
|user_service|SELECT tenant_id, id, tenant_app_id, user_id, mobile_no , user_name, head_img_url, sex, status, create_time , update_time FROM tenant_member WHERE tenant_id = ? AND tenant_app_id = ? AND user_name LIKE ?|1|1|1||0|0|1735|1735|1733|1733|
||SELECT * FROM timer.task_info WHERE name LIKE ?|1|1|1||0|0|188781|188781|1|1|
|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 ) a, ( SELECT @rank := ? ) b ORDER BY average DESC ) r WHERE r.erp_employee_id = ?|1|1|1||0|0|53119|53119|0|0|
|v4_user|SELECT COUNT(*) AS total FROM potential_customer t1 WHERE t1.maintain_shop_id = ? AND t1.maintain_employee_id = ? AND t1.status IN (?) AND t1.tenant_id = ? AND t1.tenant_app_id = ?|1|1|1||0|0|360|360|1|1|
|employee|UPDATE backlog SET leave_flag = ? WHERE tenant_app_id = ? AND employee_id = ?|1|1|1||0|0|1704|1704|0|0|
|order|SELECT count(1) AS total , ifnull(sum(if(od.status > ?, od.payment_fee, ?)), ?) AS paymentFee , ifnull(sum(if(od.status > ?, od.offline_payment_fee, ?)), ?) AS offlinePaymentFee , ifnull(sum(if(od.status > ?, od.payment_fee + od.offline_payment_fee, ?)), ?) AS 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 = ?|1|1|1||0|0|21738|21738|1|1|
|order|SELECT od.id, od.order_no AS orderNo, od.status, od.take_type AS takeType, od.create_time AS createTime , od.remark, od.total_fee AS totalFee, od.freight_fee AS freightFee, od.discount_fee AS discountFee, od.take_id AS takeId , od.payment_fee AS paymentFee, dt.product_id AS productId, dt.price, dt.quantity, dt.sku_id AS skuId , dt.art_no AS artNo, dt.image_url AS imageUrl, dt.product_name AS productName, dt.take_remark AS takeRemark, dt.take_day AS takeDay , od.product_fee AS productFee, ad.user_name AS receiveName, ad.mobile_no AS mobileNo, ad.shop_name AS shopName, ad.address , ad.express_no AS expressNo, ad.express_company AS expressCompany, od.finish_type AS finishType, od.send_time AS sendTime, od.receive_time AS receiveTime , od.finish_time AS finishTime, od.child_status AS childStatus, od.send_good_remark AS sendGoodRemark, od.service_flag AS serviceFlag, od.coupon_id AS couponId , od.tenant_wechatapp_id AS 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|260156|260156|0|0|
|employee|SELECT bg.id, bg.employee_id, bg.shop_id, bg.scene, bg.status , bg.create_time, bg.begin_time, bg.expire_time, bg.member_user_name, bg.mobile_no AS member_mobile_no 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.status IN (?) AND bg.leave_flag = ? ORDER BY id DESC LIMIT ?|1|1|1||0|0|57931|57931|8|8|
||DELETE FROM tenant.sjfx_dct_erp_sales_detail WHERE create_time < ?|1|2|2||0|0|339076|339076|0|0|
|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(1) 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 NULL 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|11|11||0|0|748924|748924|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 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 ?, ?|1|1|1||0|0|399976|399976|8|8|
|coupon_service|SELECT * FROM coupon_service.coupon WHERE DATEDIFF(DATE_FORMAT(end_time, '%Y-%m-%d'), DATE_FORMAT(now(), '%Y-%m-%d')) = ? AND coupon_state IN (?)|1|138|138||0|0|11822699|11822699|4670|4670|
|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|4575|4575|8|8|
|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 ?|1|1|1||0|0|14179|14179|0|0|
|v4_user|SELECT t1.maintain_shop_id, t1.maintain_employee_id, t1.maintain_level, count(*) AS maintainNum FROM potential_customer t1 WHERE t1.tenant_app_id = ? AND t1.`status` IN (?) AND t1.next_maintain_time >= ? AND t1.tenant_id = ? AND t1.tenant_app_id = ? GROUP BY t1.maintain_shop_id, t1.maintain_employee_id, t1.maintain_level|1|5|5||0|0|8936|8936|332|332|
