|数据库名称|SQL语句|总执行次数|总执行时间(秒)|最大执行时长|平均执行时间|锁定总时长|最大锁定时长|解析总行数|解析最大行数|返回总行数|返回最大行数|
| - | - | - | - | - | - | - | - | - | - | - | - |
|user_service|SELECT ue.employee_id AS employeeId, count(*) AS quantity FROM user_service.user_employee ue WHERE ue.employee_id IN (?) AND ue.tenant_id = ? AND ue.tenant_wechatapp_id = ? AND ue.shop_id = ? GROUP BY ue.employee_id|5135|23825|54||0|0|10709183|69823|5136|4|
|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 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 if(wca.source = ?, es.sales_date >= ?, date_format(wca.create_time, '%Y-%m-%d') >= ?) AND es.employee_erp_id = ? AND dept_erp_id = ? AND w.id IS NULL AND es.tenant_id = ? AND es.tenant_app_id = ?|2005|13883|108||0|0|7391691|20534|2005|1|
|v4_user|SELECT id, shop_id, mobile_no, member_name, head_img_url , sex, birthday, birthday_is_lunar, memorial_name, memorial_day , memorial_day_is_lunar, address, interest, wx_union_id, mini_open_id , h5_open_id, wx_card_code, recommend_id, recommend_bind_time, external_user_id , status, combine_status, combine_id, tenant_id, tenant_app_id , create_time, update_time FROM member WHERE (mobile_no = ? OR wx_card_code = ?) AND tenant_id = ? AND tenant_app_id = ? LIMIT ?|1247|13697|105||0|0|167520683|339854|1013|1|
|corpwx|SELECT id, tenant_id, cwx_user_id, user_id, old_user_id , union_id, name, sex, avatar, tenant_user_id , un_assign_flag, corp_user_id, wx_user_id, create_time, update_time , status FROM external_user WHERE tenant_id = ? AND cwx_user_id = ?|982|4906|53||0|0|1427359|6677|1427359|6677|
|tenant|SELECT count(*) FROM sneak_guest WHERE tenant_app_id = ? AND create_shop_id = ? AND maintain_employee_id = ? AND status = ? AND next_maintain_date BETWEEN ? AND ?|750|3058|45||7|7|3732161|12785|750|1|
|tenant|SELECT count(*) FROM sneak_guest WHERE tenant_app_id = ? AND status = ? AND create_shop_id = ? AND maintain_employee_id = ?|741|3056|45||7|7|3714489|12785|741|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 (?)|657|1656|8||0|0|23652|60|7884|20|
|tenant|SELECT count(*) AS amount FROM sneak_guest WHERE tenant_app_id = ? AND status = ? AND create_shop_id = ? AND maintain_employee_id = ? AND create_time <= ?|612|2534|43||0|0|3260928|12785|612|1|
|message_push|INSERT INTO message_log (id, tenant_id, tenant_app_id, user_id, scene_type , msg_id, post_data, create_time, update_time) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?)|581|939|4||0|0|0|0|0|0|
|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|569|5957|61||0|0|7301028|29875|5075|35|
|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 ?|528|4787|106||0|0|3405373|34618|437|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|503|1924|28||0|0|883297|4871|744|5|
|corpwx|SELECT count(*) AS addedNum FROM external_user t WHERE t.tenant_id = ? AND t.corp_user_id = ? AND t.create_time >= ? AND t.create_time < ?|481|1091|14||0|0|7264999|77438|481|1|
|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 (?)|480|770|3||0|0|2706|80|2706|80|
|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 = ?|475|820|16||0|0|3119903|8629|4|2|
|gift_mail|SELECT ifnull(count(1), ?) AS amount FROM trade WHERE tenant_wechatapp_id = ? AND user_id = ? AND order_status IN (?)|447|1667|34||0|0|2565187|15396|447|1|
|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 = ?|323|1757|35||0|0|2197577|24381|323|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()|308|549|7||0|0|3870|405|117|2|
|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 = ?|305|947|28||0|0|192987|4581|305|1|
|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 = ?|295|594|25||0|0|383448|34617|295|1|
|v4_sales|SELECT count(s.sales_erp_id) FROM ( SELECT esd.product_barcode, max(esd.sales_erp_id) AS sales_erp_id, max(esd.category_erp_id) AS category_erp_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.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 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 = ? LEFT 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 = ? LEFT 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 va.id IS NULL AND i.id IS NULL AND vat.id IS NOT NULL|281|572|6||0|0|26321|484|281|1|
|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(?)|280|1867|33||0|0|124730680|445551|280|1|
|user_service|INSERT LOW_PRIORITY IGNORE INTO `user_service`.`_user_employee_new` (`id`, `tenant_id`, `tenant_wechatapp_id`, `user_id`, `employee_id` , `employee_user_id`, `employee_erp_id`, `create_time`, `update_time`, `shop_id`) SELECT `id`, `tenant_id`, `tenant_wechatapp_id`, `user_id`, `employee_id` , `employee_user_id`, `employee_erp_id`, `create_time`, `update_time`, `shop_id` FROM `user_service`.`user_employee` FORCE INDEX (`PRIMARY`) WHERE `id` >= ? AND `id` <= ? LOCK IN SHARE MODE|275|466|6||0|0|1259742|14142|0|0|
|tenant|SELECT id, tenant_id, tenant_app_id, sneak_guest_maintain_id, sneak_guest_id , url, create_time, update_time FROM sneak_guest_maintain_file WHERE tenant_app_id = ? AND sneak_guest_maintain_id IN (?)|257|14407|210||0|0|432355845|1682405|1059|20|
|tenant|SELECT id, tenant_id AS tenantid, tenant_wechatapp_id AS tenantwechatappid, sales_erp_id AS salesErpId, sales_index AS salesIndex , sales_type AS salestype, product_barcode AS productbarcode, product_name AS productname, cert_no AS certno, hand_size AS handsize , category_erp_id AS categoryerpid, category_name AS categoryname, stone_weight AS stoneweight, gold_weight AS goldweight, total_weight AS totalweight , quantity, amount_total AS amounttotal, amount_pay AS amountpay, integral, remark FROM erp_sales_detail WHERE tenant_id = ? AND tenant_wechatapp_id = ? AND sales_erp_id = ? ORDER BY sales_index|231|321|2||0|0|61|6|61|6|
|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 sg.maintain_employee_id = ? AND sg.next_maintain_date >= ? AND sg.next_maintain_date <= ? AND sg.status = ? ORDER BY sg.id DESC LIMIT ?|230|3229|80||0|0|163168555|749720|856|10|
|v4_coupon|SELECT count(*) FROM ( SELECT grant_id FROM v4_coupon.coupon WHERE put_id = ? AND member_id = ? AND tenant_id = ? AND tenant_app_id = ? GROUP BY grant_id ) c|200|1457|78||0|0|26071863|185031|200|1|
|v4_coupon|SELECT * FROM v4_coupon.sales_give_coupon_record WHERE sales_id = ? AND sales_detail_id IS NULL AND tenant_id = ? AND tenant_app_id = ?|192|1113|26||0|0|35437053|184829|0|0|
|corpwx|INSERT INTO mini_app_msg (id, tenant_id, to_user, msg_type, msg_scene , msg_id, msg_content, status, err_msg, template_id) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ?)|191|304|3||0|0|0|0|0|0|
|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_id IN (?)|191|267|3||0|0|1059|16|1059|16|
|v4_user|SELECT COUNT(*) AS total FROM reception_customer WHERE shop_id = ? AND (member_id = ? OR external_user_id = ?) AND tenant_id = ? AND tenant_app_id = ?|177|1169|65||0|0|1688786|18543|177|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 = ?|174|953|47||0|0|1201553|95825|174|1|
|activity_service|SELECT id, tenant_id, tenant_app_id, activity_id, user_id , day, continuous_day, has_subscribe, user_name, create_time , update_time, first_sign_time, mobile_no FROM online_sign_user WHERE tenant_app_id = ? AND user_id = ?|168|838|17||0|0|22611394|134616|45|1|
|warranty_service|SELECT count(*) FROM warranty WHERE user_id = ? AND tenant_wechatapp_id = ? AND is_disable = ?|162|3075|452||0|0|250978|22516|162|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 = ?|157|267|3||0|0|12|2|5|1|
|coupon_service|SELECT count(1) FROM coupon_service.coupon_expire_task WHERE tenant_id = ? AND tenant_app_id = ? AND shop_id = ? AND employee_id = ? AND status = ? AND expire_time > now()|154|344|7||0|0|88965|5122|154|1|
|v4_user|SELECT COUNT(*) AS total FROM potential_customer WHERE maintain_shop_id = ? AND maintain_employee_id = ? AND status IN (?) AND tenant_id = ? AND tenant_app_id = ?|154|312|9||0|0|38013|1269|154|1|
|v4_coupon|SELECT COUNT(*) AS total FROM coupon WHERE coupon_status = ? AND member_id = ? AND tenant_id = ? AND tenant_app_id = ?|150|516|14||0|0|65877|1243|150|1|
|v4_coupon|SELECT COUNT(*) AS total FROM coupon WHERE member_id = ? AND scene = ? AND scene_id = ? AND tenant_id = ? AND tenant_app_id = ?|145|969|53||0|0|8629635|178314|145|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 = ?|143|423|17||0|0|9143509|63980|3606|64|
|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 = ?|134|570|12||0|0|10101035|101350|134|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 = ?|123|445|44||0|0|588999|29732|123|1|
|tenant|SELECT count(*) FROM erp_sales es WHERE tenant_id = ? AND member_erp_id = ? AND tenant_wechatapp_id = ? AND sales_status = ? AND (comment_id IS NULL OR comment_id = ?) AND sales_date >= ? 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 )|122|186|3||0|0|279267|45419|122|1|
|warranty_service|SELECT * FROM warranty WHERE tenant_wechatapp_id = ? AND erp_sales_id = ? LIMIT ?|119|165|2||0|0|45|1|45|1|
|tenant|SELECT count(*) FROM sneak_guest WHERE tenant_app_id = ? AND create_shop_id = ? AND status = ? AND next_maintain_date >= ? AND next_maintain_date < ?|119|297|7||0|0|509395|12790|119|1|
|goods|SELECT * FROM goods_take_shop WHERE tenant_id = ? AND goods_id = ? AND activity_id = ? ORDER BY create_time DESC|114|512|20||0|0|12096011|106158|2377|64|
|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 < ?|109|4686|105||0|0|12471194|114416|0|0|
|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 ?|104|631|48||0|0|701733|46484|1040|10|
|v4_sales|SELECT count(*) FROM v4_sales.erp_sales WHERE employee_erp_id = ? AND sales_status = ? AND is_sales = ? AND tenant_id = ? AND tenant_app_id = ?|104|472|35||0|0|443143|37268|104|1|
|tenant|SELECT count(*) FROM sneak_guest WHERE tenant_app_id = ? AND status = ? AND create_shop_id = ?|103|261|7||0|0|444717|12790|103|1|
|tenant|SELECT count(*) FROM tenant.sneak_guest_maintain s JOIN tenant.sneak_guest sg ON sg.tenant_id = s.tenant_id AND sg.tenant_app_id = s.tenant_app_id AND sg.id = s.sneak_guest_id JOIN tenant.employee e ON e.tenant_id = s.tenant_id AND e.id = s.employee_id WHERE s.tenant_id = ? AND s.tenant_app_id = ? AND sg.create_shop_id = ? AND (sg.fail_type IS NULL OR sg.fail_type = ?) AND s.event_type = ? AND s.create_time BETWEEN ? AND ?|101|314|19||0|0|181596|3779|101|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 (|97|430|35||0|0|118975|1946|54827|897|
|user_service|UPDATE user_service.tenant_member_bind SET external_user_id = NULL WHERE external_user_id = ? AND tenant_id = ? AND tenant_app_id = ? AND wx_user_id != ?|97|155|2||0|0|15|1|0|0|
|authorization_service|INSERT INTO user_login_token (id, platform_user_id, user_id, wx_user_id, wx_app_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) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?)|94|158|2||0|0|0|0|0|0|
|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 = ?|94|567|38||0|0|261131|10364|94|1|
|coupon_service|SELECT * FROM coupon_service.coupon_market_order WHERE pay_type IN (?) AND order_state = ? AND update_time <= DATE_SUB(NOW(), INTERVAL ? MINUTE)|93|1217|70||0|0|54238938|583242|0|0|
|gift_mail|SELECT count(0) 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 NULL OR p.is_disable = ?) AND (ps.tenant_wechatapp_id = ? OR p.product_type = ?) ) p WHERE p.topping = ?|91|162|4||0|0|1421667|17083|91|1|
|v4_coupon|SELECT COUNT(*) AS total FROM ( SELECT c.id, c.display_name, c.type AS couponType , round(c.face_value / ?, ?) AS faceValue , round(c.face_value / ?, ?) AS points , c.face_value AS discount, c.begin_time, c.end_time, c.template_id , round(c.use_threshold / ?) AS useThreshold, ce.exchange_goods , CASE  WHEN c.begin_time > now() AND c.coupon_status = ? THEN ? ELSE c.coupon_status END AS coupon_status FROM v4_coupon.coupon c JOIN v4_coupon.coupon_extend ce ON ce.id = c.id AND ce.tenant_id = ? AND ce.tenant_app_id = ? WHERE c.member_id = ? AND c.tenant_id = ? AND c.tenant_app_id = ? ) c|87|1540|101||0|0|39317213|612342|87|1|
|corpwx|SELECT id, tenant_id, cwx_user_id, user_id, old_user_id , union_id, name, sex, avatar, tenant_user_id , un_assign_flag, corp_user_id, wx_user_id, create_time, update_time , status FROM external_user WHERE tenant_id = ? AND union_id = ? AND status = ?|85|120|2||0|0|9|2|9|2|
|employee|SELECT task_amount - finish_amount FROM backlog t WHERE t.tenant_app_id = ? AND t.shop_id = ? AND t.employee_id = ? AND t.status IN (?) AND t.scene = ? AND t.begin_time <= ? AND t.expire_time >= ?|85|165|6||0|0|18480|439|47|1|
|coupon_service|SELECT count(1) FROM coupon_service.coupon_expire_task WHERE tenant_id = ? AND tenant_app_id = ? AND shop_id = ? AND status = ? AND expire_time > now()|84|312|30||0|0|3347049|128368|84|1|
|tenant|SELECT * FROM erp_sales_detail WHERE tenant_id = ? AND tenant_wechatapp_id = ? AND sales_erp_id = ? ORDER BY sales_index|81|110|2||0|0|207|9|207|9|
|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 = ?|78|152|5||0|0|27080|1775|78|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|76|1402|89||0|0|1434016|20254|53|2|
|user_service|UPDATE user_service.tenant_member_bind SET wx_user_id = NULL WHERE tenant_id = ? AND tenant_app_id = ? AND erp_member_id = ?|74|115|3||0|0|0|0|0|0|
|coupon_service|SELECT count(*) FROM employee_give_coupon_log WHERE tenant_app_id = ? AND coupon_push_id = ?|71|473|35||0|0|894575|20731|71|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 sg.maintain_employee_id = ? AND sg.status = ? ORDER BY sg.id DESC LIMIT ?|70|780|42||0|0|52471644|749717|370|9|
|user_service|SELECT count(0) FROM ( SELECT count(1) FROM user_source us WHERE us.tenant_id = ? AND us.tenant_wechatapp_id = ? AND us.from_id = ? AND us.shop_id = ? AND us.source_type = ? AND us.from_id IS NOT NULL AND us.shop_id IS NOT NULL ) table_count|68|99|4||0|0|34311|1796|68|1|
|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(1) AS 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 NULL AND us.shop_id IS NOT NULL GROUP BY us.from_id, us.shop_id ORDER BY count(1) DESC ) obj, ( SELECT @rownum := ?, @rowtotal := NULL ) r|66|230|13||0|0|157278|16123|7907|262|
|v4_employee|SELECT tt.task_template_id AS taskId, tt.task_name AS taskName, tt.task_type, tt.system_task_type , count(*) AS num FROM v4_employee.task_task tt JOIN v4_employee.task_system_task_template st ON tt.task_template_id = st.id AND st.`status` = ? AND st.tenant_id = ? AND st.tenant_app_id = ? WHERE tt.task_type = ? AND tt.shop_id = ? AND tt.`status` = ? AND tt.start_time <= ? AND tt.end_time > ? AND tt.finish_time IS NULL AND tt.tenant_id = ? AND tt.tenant_app_id = ? GROUP BY tt.task_template_id, tt.task_name, tt.system_task_type, tt.task_type|66|495|37||0|0|1273604|27151|174|5|
|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(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 ) obj, ( SELECT @rownum := ?, @rowtotal := NULL ) r|65|229|13||0|0|134298|15829|520|41|
|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 = ?|64|216|19||0|0|350062|14911|64|1|
|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|64|4653|300||0|0|53612661|881660|64|1|
|coupon_service|SELECT count(*) FROM coupon WHERE coupon_state = ? AND user_id = ? AND tenant_app_id = ? AND end_time > ?|62|75|1||0|0|8|2|62|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 = ?))|61|204|10||0|0|1293069|21208|45|2|
|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 = ?|60|627|127||0|0|1213622|20255|13|2|
|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 ?|60|3974|269||0|0|23435446|1058020|14|1|
|v4_employee|SELECT COUNT(*) FROM ( SELECT t.id AS task_id, task_type , if(task_type = ?, st.description, it.description) AS description , if(task_type = ?, st.quick_reply, it.quick_reply) AS quick_reply , task_name, member_id, member_name, member_mobile_no, member_sex , member_level, t.start_time, t.end_time , datediff(t.end_time, ?) AS left_days, send_coupons , recv_coupons, st.coupons, t.accept_time, t.plan_arrival_shop_time, t.arrival_shop_time , t.trade_time FROM task_task t LEFT JOIN task_system_task_template st ON st.id = t.task_template_id AND st.tenant_id = ? AND st.tenant_app_id = ? LEFT JOIN task_invite_task_template it ON it.id = t.task_template_id AND it.tenant_id = ? AND it.tenant_app_id = ? WHERE t.status = ? AND task_type = ? AND system_task_type = ? AND t.start_time <= ? AND t.end_time > ? AND shop_id = ? AND employee_id = ? AND finish_time IS NULL AND t.tenant_id = ? AND t.tenant_app_id = ? ) TOTAL|59|433|37||0|0|575560|17634|59|1|
|corpwx_license|SELECT id, employee_id, corp_wx_user_id, lic_base_activated, lic_base_active_code , lic_base_expire_time, lic_external_activated, lic_external_active_code, lic_external_expire_time, tenant_id , create_time, update_time FROM active_employee WHERE corp_wx_user_id = ? AND tenant_id = ?|58|130|5||0|0|1319028|22743|58|1|
|v4_employee|SELECT t.id AS task_id, task_type , if(task_type = ?, st.description, it.description) AS description , if(task_type = ?, st.quick_reply, it.quick_reply) AS quick_reply , task_name, member_id, member_name, member_mobile_no, member_sex , member_level, t.start_time, t.end_time , datediff(t.end_time, NULL) AS left_days, send_coupons , recv_coupons, st.coupons, t.accept_time, t.plan_arrival_shop_time, t.arrival_shop_time , t.trade_time FROM task_task t LEFT JOIN task_system_task_template st ON st.id = t.task_template_id AND st.tenant_id = ? AND st.tenant_app_id = ? LEFT JOIN task_invite_task_template it ON it.id = t.task_template_id AND it.tenant_id = ? AND it.tenant_app_id = ? WHERE t.status = ? AND task_type = ? AND task_template_id = ? AND shop_id = ? AND employee_id = ? AND finish_time IS NULL AND t.end_time > now() AND t.tenant_id = ? AND t.tenant_app_id = ? ORDER BY t.id DESC LIMIT ?|57|696|81||0|0|15097800|337104|570|10|
|v4_employee|SELECT id, batch_no, task_type, system_task_type, task_frequency , task_name, task_template_id, business_id, shop_id, employee_id , member_id, start_time, end_time, finish_time, send_coupons , recv_coupons, recv_coupon_time, accept_time, plan_arrival_shop_time, arrival_shop_time , trade_nos, trade_num, trade_amount, trade_time, member_name , member_mobile_no, member_latest_birthday, member_sex, member_age, member_level_id , member_level, member_sales_amount, member_sales_count, member_integral_balance, member_integral_total , status, remark, tenant_id, tenant_app_id, create_time , update_time FROM task_task WHERE member_id = ? AND task_template_id IN (?) AND tenant_id = ? AND tenant_app_id = ?|56|190|16||0|0|18|1|18|1|
|v4_user|SELECT id, shop_id, mobile_no, member_name, head_img_url , sex, birthday, birthday_is_lunar, memorial_name, memorial_day , memorial_day_is_lunar, address, interest, wx_union_id, mini_open_id , h5_open_id, wx_card_code, recommend_id, recommend_bind_time, external_user_id , status, combine_status, combine_id, tenant_id, tenant_app_id , create_time, update_time FROM member WHERE h5_open_id = ? AND tenant_id = ? AND tenant_app_id = ?|54|81|2||0|0|29|1|29|1|
|coupon_service|SELECT id, tenant_id, tenant_app_id, template_id, coupon_id , give_user_id, user_id, create_time, update_time FROM user_coupon_give_record WHERE tenant_id = ? AND tenant_app_id = ? AND coupon_id = ? AND give_user_id = ? AND user_id = ?|53|117|5||0|0|73029|3310|4|1|
|user_service|SELECT count(0) FROM ( SELECT count(1) 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 NULL AND us.shop_id IS NOT NULL ) table_count|53|222|22||0|0|52316|2241|53|1|
|employee|SELECT count(0) FROM backlog WHERE tenant_app_id = ? AND employee_id = ? AND status IN (?) AND scene = ? AND shop_id = ? AND expire_time >= ?|52|84|3||0|0|6981|851|52|1|
|v4_employee|SELECT LEFT(start_time, ?) AS day, count(*) AS undo_count , datediff(end_time, ?) AS left_days FROM task_task WHERE task_type = ? AND status = ? AND system_task_type = ? AND finish_time IS NULL AND end_time > ? AND shop_id = ? AND employee_id = ? AND tenant_id = ? AND tenant_app_id = ? GROUP BY LEFT(start_time, ?), end_time|51|79|3||0|0|661032|17628|46|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 IN (?) AND t.order_status = ? AND t.take_type = ? AND tt.shop_id = ?|49|166|19||0|0|237346|12994|49|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 mb.erp_member_id IN (?)|47|96|7||0|0|18963665|1314259|3585|224|
|corpwx|SELECT id, tenant_id, cwx_user_id, user_id, old_user_id , union_id, name, sex, avatar, tenant_user_id , un_assign_flag, corp_user_id, wx_user_id, create_time, update_time , status FROM external_user WHERE tenant_id = ? AND user_id = ? AND status = ? AND union_id IS NOT NULL|47|75|2||0|0|76|7|14|4|
|v4_user|INSERT INTO member_change_log (id, member_id, change_type, change_time, oper_employee_id , oper_desc, oper_detail, old_shop_id, new_shop_id, old_butler_id , new_butler_id, member_status, tenant_id, tenant_app_id, create_time , update_time) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?)|46|68|2||0|0|0|0|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 (?) AND t.un_assign_flag = ?|46|123|12||0|0|13361|392|6304|185|
|employee|SELECT count(*) FROM label_task_employee t1 JOIN label_task_setting t2 ON t1.label_task_id = t2.id AND t2.disabled = ? WHERE t2.tenant_id = ? AND t2.tenant_app_id = ? AND t2.task_status = ? AND t2.end_date >= CURRENT_DATE AND t1.shop_id = ? AND t1.employee_id = ? AND t1.visit_status = ?|45|66|2||0|0|11007|773|45|1|
|coupon_service|SELECT id, tenant_id, tenant_app_id, template_id, shop_id , shop_name, create_time, update_time FROM coupon_limit_shop WHERE tenant_id = ? AND template_id = ?|43|85|5||0|0|1024564|23835|72|36|
|tenant|SELECT count(0) FROM erp_sales_detail t1 LEFT JOIN erp_sales_detail_extend t2 ON t2.tenant_id = t1.tenant_id AND t2.tenant_wechatapp_id = t1.tenant_wechatapp_id AND t2.sales_erp_id = t1.sales_erp_id AND t2.sales_index = t1.sales_index LEFT JOIN erp_sales t3 ON t3.tenant_id = t1.tenant_id AND t3.tenant_wechatapp_id = t1.tenant_wechatapp_id AND t3.sales_erp_id = t1.sales_erp_id WHERE t1.tenant_id = ? AND t1.tenant_wechatapp_id = ? AND t3.tenant_id = t1.tenant_id AND t3.tenant_wechatapp_id = t1.tenant_wechatapp_id AND t3.member_erp_id = ? AND t3.sales_status = ? AND t3.is_sales = ?|43|87|5||0|0|3283|1227|43|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 ?|43|101|11||0|0|515829|54281|36|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 sg.maintain_employee_id = ? AND sg.next_maintain_date >= ? AND sg.next_maintain_date <= ? AND sg.status = ? ORDER BY sg.id DESC LIMIT ?, ?|43|596|64||0|0|31892699|749721|230|10|
|goods|SELECT count(0) FROM ( SELECT gs.id, gs.category_id, gs.goods_name, gs.style_no, gs.status , gs.thumbnail_img, gs.express_type, gs.take_stock_day, gs.take_remark, gs.express_fee , ifnull(gs.base_sale_number, ?) + ifnull(t1.sales_volume, ?) AS total_sales_volume , ifnull(ifnull(t2.quantity, t3.quantity), ?) AS total_quantity , ifnull(ifnull(t2.price, t3.price), ?) AS min_price , gs.create_time, gs.exchange_money, ifnull(t2.number, ?) AS skuNumber , ifnull(t3.number, ?) AS activitySkuNumber FROM goods.goods gs LEFT JOIN goods.goods_category cg ON gs.category_id = cg.id INNER JOIN goods.goods_up_app t ON gs.id = t.goods_id AND t.tenant_app_id = ? LEFT JOIN ( SELECT tenant_app_id, goods_id, sum(sales_volume) AS sales_volume FROM goods.goods_sku GROUP BY tenant_app_id, goods_id ) t1 ON t.tenant_app_id = t1.tenant_app_id AND t.goods_id = t1.goods_id LEFT JOIN ( SELECT tenant_app_id, goods_id, sum(quantity) AS quantity , min(price) AS price, count(*) AS number FROM goods.goods_sku WHERE activity_id = ? GROUP BY tenant_app_id, goods_id ) t2 ON t.tenant_app_id = t2.tenant_app_id AND t.goods_id = t2.goods_id LEFT JOIN ( SELECT tenant_app_id, goods_id, sum(quantity) AS quantity , min(price) AS price, count(*) AS number FROM goods.goods_sku WHERE activity_id > ? GROUP BY tenant_app_id, goods_id ) t3 ON t.tenant_app_id = t3.tenant_app_id AND t.goods_id = t3.goods_id WHERE 1 = 1 AND gs.topping = ? ) tmp|43|97|5||0|0|5465564|127692|43|1|
|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))) AND user_id = ? AND tenant_wechatapp_id = ?|43|57|2||0|0|325|162|0|0|
|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 = ?|41|186|25||0|0|793171|29058|41|1|
|employee|SELECT tenant_id, tenant_app_id, employee_id, scene, shop_id , count(*) AS record FROM backlog WHERE tenant_app_id = ? AND employee_id = ? AND expire_time >= ? AND status IN (?) AND shop_id = ? AND scene NOT IN (?) GROUP BY tenant_id, tenant_app_id, employee_id, scene, shop_id|40|57|2||0|0|4567|402|95|6|
|tenant|SELECT count(*) FROM tenant.sneak_guest_maintain s JOIN tenant.sneak_guest sg ON sg.id = s.sneak_guest_id WHERE s.tenant_id = ? AND s.tenant_app_id = ? AND s.shop_id = ? AND s.event_type = ? AND s.create_time BETWEEN ? AND ?|39|667|78||0|0|1475587|228853|39|1|
|wx_gateway|INSERT INTO wx_template_msg (id, tenant_id, tenant_app_id, user_id, push_id , tenant_user_open_id, template_id, template_no, url, data , msg_id, status, err_msg, title, content , create_time, update_time, tenant_short_name, tenant_app_name, user_mobile_no , user_name, user_head_img_url) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?)|38|65|3||0|0|0|0|0|0|
|goods|SELECT min(price) AS minPrice, max(market_price) AS marketPrice , sum(sales_volume) AS totalSalesVolume, sum(quantity) AS totalQuantity FROM goods_sku WHERE goods_id = ? AND activity_id = ? GROUP BY tenant_id, goods_id LIMIT ?|38|90|3||0|0|803156|21136|38|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|38|120|15||0|0|350853|30820|38|1|
|user_service|SELECT count(*) FROM user_service.tenant_member_info t WHERE t.tenant_id = ? AND t.tenant_app_id = ? AND t.shop_id = ?|38|66|4||0|0|777902|94288|38|1|
|employee|SELECT * FROM backlog WHERE tenant_app_id = ? AND employee_id = ? AND status IN (?) AND scene = ? AND shop_id = ? AND expire_time >= ? ORDER BY id DESC|37|60|4||0|0|6559|883|427|57|
|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 = ?|37|1023|218||0|0|1811100|90028|37|1|
|user_service|UPDATE tenant_member SET tenant_app_id = ?, user_id = ?, mobile_no = ?, user_name = ?, sex = ?, status = ?, create_time = ?, update_time = ? WHERE tenant_id = ? AND id = ?|37|53|2||0|0|37|1|0|0|
|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 = ?|36|143|23||0|0|30992|5818|15496|2909|
|tenant|UPDATE erp_sales SET sales_date = ?, member_erp_id = ?, employee_erp_id = ?, employee_name = ?, dept_erp_id = ?, amount = ?, sales_remark = ?, receipts = ?, sales_status = ?, is_sales = ?, busi_date = ?, update_time = ? WHERE tenant_id = ? AND tenant_wechatapp_id = ? AND sales_erp_id = ? AND sales_no = ?|36|253|51||188|50|35|1|0|0|
|tenant|SELECT id, tenant_id, tenant_app_id, sneak_guest_id, shop_id , employee_id, maintain_level, remark, create_time, update_time , event_type, data, group_label FROM sneak_guest_maintain WHERE tenant_app_id = ? AND sneak_guest_id IN (?) AND event_type = ?|36|65|4||0|0|4218|635|3269|155|
|v4_sales|SELECT id, sales_index, sales_erp_id, sales_type, product_barcode , product_name, cert_no, hand_size, category_erp_id, category_name , stone_weight, gold_weight, total_weight, quantity, amount_total , amount_pay, integral, remark, sales_brand, sales_craft , erp_create_time, tenant_id, tenant_app_id, create_time, update_time FROM erp_sales_detail WHERE sales_erp_id = ? AND sales_index = ? AND tenant_id = ? AND tenant_app_id = ?|35|51|2||0|0|4|1|4|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 = ?|35|76|4||0|0|520238|14925|2|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 = ?)|35|404|67||0|0|9843924|481512|35|1|
|v4_employee|SELECT task_template_id AS taskId, t.task_type, t2.name AS taskName , ifnull(sum(IF(finish_time IS NULL, ?, ?)), ?) AS num FROM task_task t JOIN task_invite_task_template t2 ON t.task_template_id = t2.id AND t2.STATUS = ? AND t2.tenant_id = ? AND t2.tenant_app_id = ? WHERE t.shop_id = ? AND t.`status` = ? AND t.end_time > CURRENT_DATE AND t.tenant_id = ? AND t.tenant_app_id = ? GROUP BY t.task_template_id, t.task_type, t2.name|35|240|37||0|0|1022640|30060|35|1|
|tenant|SELECT id, tenant_id, tenant_wechatapp_id, sales_erp_id, sales_index , sales_type, product_barcode, product_name, cert_no, hand_size , category_erp_id, category_name, stone_weight, gold_weight, total_weight , quantity, amount_total, amount_pay, integral, remark , create_time, update_time FROM erp_sales_detail WHERE tenant_id = ? AND sales_erp_id = ? AND tenant_wechatapp_id = ?|33|44|1||0|0|81|10|81|10|
|v4_coupon|SELECT * FROM ( SELECT c.id, c.display_name, c.type AS couponType , round(c.face_value / ?, ?) AS faceValue , round(c.face_value / ?, ?) AS points , c.face_value AS discount, c.begin_time, c.end_time, c.template_id , round(c.use_threshold / ?) AS useThreshold, ce.exchange_goods , CASE  WHEN c.begin_time > now() AND c.coupon_status = ? THEN ? ELSE c.coupon_status END AS coupon_status FROM v4_coupon.coupon c JOIN v4_coupon.coupon_extend ce ON ce.id = c.id AND ce.tenant_id = ? AND ce.tenant_app_id = ? WHERE c.member_id = ? AND c.tenant_id = ? AND c.tenant_app_id = ? ) c ORDER BY field(coupon_status, ?, ?, ?, ?, ?, ?), id DESC LIMIT ?|32|778|85||0|0|19323936|612040|156|10|
|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 sg.maintain_employee_id = ? AND sg.next_maintain_date >= ? AND sg.next_maintain_date <= ? AND sg.status = ?|32|96|9||0|0|240399|12800|32|1|
|v4_employee|SELECT COUNT(*) AS total FROM task_task WHERE task_template_id = ? AND tenant_id = ? AND tenant_app_id = ?|31|181|19||0|0|6045944|201479|31|1|
|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|31|54|4||0|0|4056028|578424|31|1|
|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 ?|31|91|8||0|0|401082|12940|0|0|
|tenant|SELECT count(*) AS amount FROM sneak_guest WHERE tenant_app_id = ? AND status = ? AND create_shop_id = ? AND maintain_employee_id = ? AND create_time >= ?|30|37|1||0|0|2542|408|30|1|
|v4_user|SELECT id, shop_id, mobile_no, member_name, head_img_url , sex, birthday, birthday_is_lunar, memorial_name, memorial_day , memorial_day_is_lunar, address, interest, wx_union_id, mini_open_id , h5_open_id, wx_card_code, recommend_id, recommend_bind_time, external_user_id , status, combine_status, combine_id, tenant_id, tenant_app_id , create_time, update_time FROM member WHERE id IN (?) AND tenant_id = ? AND tenant_app_id = ?|30|40|1||0|0|106|10|106|10|
|tenant|INSERT INTO erp_sales_detail (id, tenant_id, tenant_wechatapp_id, sales_erp_id, sales_index , sales_type, product_barcode, product_name, cert_no, hand_size , category_erp_id, category_name, stone_weight, gold_weight, total_weight , quantity, amount_total, amount_pay, integral, remark) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE update_time = now(), sales_type = ?, product_barcode = ?, product_name = ?, cert_no = ? , hand_size = ?, category_erp_id = ?, category_name = ?, stone_weight = ?, gold_weight = ? , total_weight = ?, quantity = ?, amount_total = ?, amount_pay = ?, integral = ? , remark = ?|28|49|2||0|0|0|0|0|0|
|corpwx|SELECT id, tenant_id, tenant_app_id, external_user_id, wx_user_id FROM external_user_bind WHERE tenant_id = ? AND wx_user_id = ?|27|33|1||0|0|19|1|19|1|
|warranty_service|SELECT count(0) FROM warranty WHERE user_id = ? AND tenant_wechatapp_id = ? AND is_disable = ?|27|34|1||0|0|350|185|27|1|
|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 = ?|27|44|3||0|0|11078|2708|939|88|
|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 sg.maintain_employee_id = ? AND sg.status = ? ORDER BY sg.id DESC LIMIT ?, ?|26|218|58||0|0|15876677|749726|125|10|
|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|26|60|5||0|0|105522|4063|19484|754|
|authorization_service|SELECT id, tenant_id, account_id, type, login_name , hash_password, salt, user_id, employee_id, tenant_app_id , status, create_time, update_time FROM login_account WHERE type = ? AND login_name = ?|25|103|11||0|0|1581514|63267|25|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(?, ?, ?))|25|113|13||0|0|55494|7066|25|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 = ?|25|96|14||0|0|234201|11646|25|1|
|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 = ?|24|39|3||0|0|65087|11695|24|1|
|gift_mail|SELECT count(1) FROM gift_mail.product WHERE product_type = ? AND product_status = ? AND is_disable != ? AND tenant_id = ?|24|38|2||0|0|184272|7678|24|1|
|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|24|347|61||0|0|1316736|109401|192|13|
|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 ?|24|148|47||0|0|158733|25248|288|12|
|wx_gateway|UPDATE wx_template_msg SET status = ?, err_msg = ? WHERE msg_id = ?|24|35|2||0|0|24|1|0|0|
|erp_sync|INSERT INTO sync_record (id, tenant_id, tenant_app_id, data_id, business_type , operate_type, user_id, erp_member_id, data, send_time , create_time) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?)|23|40|2||0|0|0|0|0|0|
|tenant|SELECT count(*) AS amount FROM sneak_guest WHERE tenant_app_id = ? AND status = ? AND create_shop_id = ? AND maintain_employee_id = ? AND create_time >= ? AND create_time <= ?|23|41|5||0|0|45739|7215|23|1|
|tenant|SELECT count(*) FROM ( SELECT s.sneak_guest_id FROM tenant.sneak_guest_maintain s JOIN tenant.sneak_guest sg ON sg.id = s.sneak_guest_id AND (sg.fail_type IS NULL OR sg.fail_type = ?) WHERE s.tenant_id = ? AND s.tenant_app_id = ? AND s.shop_id = ? AND s.event_type = ? AND s.create_time BETWEEN ? AND ? GROUP BY s.sneak_guest_id ) a|23|1195|136||0|0|1751251|229276|23|1|
|coupon_service|SELECT id, tenant_id, tenant_app_id, template_id, coupon_type , take_effect_way, take_start_day, take_effect_day, begin_time, end_time , source, source_id, can_give, need_booking, use_threshold , wx_card_id, state, create_time, update_time FROM coupon_push WHERE tenant_id = ? AND tenant_app_id = ? AND wx_card_id = ?|23|48|5||0|0|30702|1928|0|0|
|gift_mail|SELECT c.id, c.categroy_name, c.parent_id, count(p.id) AS hasProducedCount FROM gift_mail.platform_category c LEFT JOIN gift_mail.platform_product p ON p.category_id = c.id GROUP BY c.id, c.categroy_name, c.parent_id ORDER BY c.parent_id ASC, c.update_time ASC|22|29|2||0|0|50028|2274|2200|100|
|gift_mail|SELECT count(*) FROM gift_mail.product p LEFT JOIN gift_mail.partner_product pp ON p.id = pp.product_id WHERE tenant_wechatapp_id = ? AND product_status = ?|22|35|2||0|0|169028|7701|22|1|
|corpwx|UPDATE external_user SET update_time = ?, status = ? WHERE tenant_id = ? AND cwx_user_id = ? AND user_id = ?|22|32|2||0|0|21|1|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 = ? AND tenant_id = ? AND tenant_app_id = ?|21|52|5||0|0|1562075|74840|105|5|
|v4_user|ROLLBACK ?|21|61|8||0|0|0|0|0|0|
|corpwx|SELECT count(*) FROM external_user WHERE tenant_id = ? AND corp_user_id = ? AND user_id = ? AND status = ?|21|31|2||0|0|42|6|21|1|
|v4_user|SELECT COUNT(*) AS total FROM potential_customer WHERE maintain_shop_id = ? AND status IN (?) AND tenant_id = ? AND tenant_app_id = ?|20|49|8||0|0|31832|2092|20|1|
|tenant|SELECT esd.id, esd.product_name, esd.category_name, esd.product_barcode, esd.cert_no , esd.amount_total, esd.amount_pay, esd.sales_index, esd.sales_type, esd.integral , esd.quantity, ifnull(ee.not_add_value_plan, ?) AS not_add_value_plan FROM erp_sales_detail esd LEFT JOIN erp_sales_extend ee ON ee.tenant_id = esd.tenant_id AND esd.tenant_wechatapp_id = ee.tenant_wechatapp_id AND esd.sales_erp_id = ee.sales_erp_id AND esd.sales_index = ee.sales_index WHERE esd.sales_erp_id = ? AND esd.tenant_id = ? AND esd.tenant_wechatapp_id = ? AND (esd.sales_type = ? OR esd.amount_pay > ?)|20|29|2||0|0|90|24|37|10|
|employee|SELECT count(*) FROM employee.backlog WHERE tenant_id = ? AND tenant_app_id = ? AND shop_id = ? AND status = ? AND finish_time BETWEEN ? AND ?|20|35|4||0|0|34389|2261|20|1|
|employee|SELECT id, tenant_id, tenant_app_id, shop_id, employee_id , user_id, external_user_id, mobile_no, scene, status , begin_time, expire_time, create_time, update_time, directional_task_id , member_erp_id, finish_time, md5_str, tenant_open_id, data FROM backlog_system WHERE tenant_app_id = ? AND scene = ? AND status = ? AND create_time BETWEEN ? AND ?|20|72|36||0|0|4417783|557747|523|237|
|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 = ?)|20|71|23||0|0|25115|3173|20|1|
|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 sg.maintain_employee_id = ? AND sg.status = ?|19|60|8||0|0|74179|10440|19|1|
|activity_service|SELECT count(0) FROM ( SELECT t1.id AS activityId, t1.activity_name AS activityname, t1.activity_main_pic_url AS activityMainPicUrl, t1.activity_type AS activitytype , date_format(t1.start_time, '%Y-%m-%d %H:%i:%s') AS startTime , date_format(t1.end_time, '%Y-%m-%d %H:%i:%s') AS endTime, t1.activity_remark AS activityremark , t1.`status` AS activityStatus, t1.must_attention AS mustAttention, t1.must_register AS mustRegister, t1.activity_rule AS activityRule, t1.activity_list_pic_url AS activityListPicUrl , t1.contact_merchant AS contactMerchant , if(t1.end_time > now(), ?, ?) AS overdue , t1.background_color, t1.share_type, t1.share_icon_url, t1.share_text FROM activity t1 WHERE participation_type = ? AND t1.`status` = ? AND t1.`status` = ? AND t1.activity_type IN (?) AND t1.end_time >= now() AND t1.tenant_id = ? AND t1.tenant_wechatapp_id = ? ORDER BY overdue ASC, t1.start_time ASC ) tmp_count|19|26|2||0|0|4440|354|19|1|
|goods|SELECT id, img_url, img_index FROM goods_img WHERE goods_id = ? ORDER BY update_time DESC|19|46|7||0|0|516464|27186|57|5|
|coupon_service|SELECT count(*) FROM coupon WHERE tenant_id = ? AND tenant_app_id = ? AND user_id = ? AND coupon_push_id = ?|19|27|1||0|0|66|49|19|1|
|gift_mail|SELECT count(0) 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 NULL OR p.is_disable = ?) AND (ps.tenant_wechatapp_id = ? OR p.product_type = ?) UNION ALL SELECT pp.id, pp.default_image_url, pp.product_name, ? AS product_type, pi.market_price AS tag_price , ROUND(pp.tag_price * ?, ?) AS price , pi.volume, ? AS category_id, pp.product_status, pi.quantity, ? AS partner_id , ? AS topping FROM gift_mail.platform_recommend_product prp JOIN gift_mail.platform_product pp ON pp.id = prp.platform_product_id JOIN gift_mail.platform_inventory pi ON pi.product_id = pp.id WHERE prp.is_recommend = ? AND tenant_app_id = ? AND pp.product_status = ? ) p WHERE p.topping = ?|19|42|3||0|0|347482|20255|19|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 ?|18|219|40||0|0|7532083|470048|18|1|
|order|SELECT id, type, operator_type AS operatorType, operator_result AS operatorResult, reason_label AS reasonLabel , reason_value AS reasonValue, remark, create_time AS createTime, status FROM order_service_log WHERE order_id = ? ORDER BY create_time DESC|18|43|4||0|0|434170|24123|4|3|
|tenant|SELECT count(0) FROM ( SELECT sg.employee_id AS employeeId, sg._actual AS actualNum, sg._maintain AS continueNum, sg._failure AS failNum, sg._success AS dealNum , e.employee_name, e.head_img_url FROM ( SELECT sgm.employee_id, count(DISTINCT sneak_guest_id) AS _actual, sum(_maintain) AS _maintain , sum(_success) AS _success, sum(_failure) AS _failure , max(sgm.create_time) AS create_time FROM ( SELECT sgm.employee_id, sneak_guest_id , if(event_type = ?, ?, ?) AS _maintain , if(event_type = ?, ?, ?) AS _success , if(event_type = ?, ?, ?) AS _failure , sgm.create_time AS create_time FROM tenant.sneak_guest_maintain sgm JOIN tenant.sneak_guest sg ON sgm.sneak_guest_id = sg.id WHERE sgm.tenant_id = ? AND sgm.tenant_app_id = ? AND sgm.shop_id = ? AND sgm.create_time BETWEEN ? AND ? AND sgm.event_type IN (?) AND (sg.fail_type IS NULL OR sg.fail_type = ?) ) sgm WHERE 1 = 1 GROUP BY sgm.employee_id ) sg JOIN tenant.employee e ON e.id = sg.employee_id ORDER BY sg.create_time DESC ) tmp_count|17|1456|174||0|0|2510979|229390|17|1|
|coupon_service|SELECT * FROM coupon_service.coupon_can_give WHERE coupon_id = ? LIMIT ?|17|111|17||0|0|4902429|292754|17|1|
|corpwx|SELECT id, tenant_id, tenant_app_id, external_user_id, wx_user_id FROM external_user_bind WHERE tenant_id = ? AND wx_user_id IN (?)|17|23|1||0|0|56|8|56|8|
|v4_user|SELECT ifnull(t2.id, ?) AS id, t2.tenant_id, t2.tenant_app_id , t2.shop_id, t2.mobile_no , CASE  WHEN t2.member_name IS NULL OR t2.member_name = ? THEN t1.external_user_name ELSE t2.member_name END AS member_name, t2.head_img_url, ifnull(t2.sex, t1.sex) AS sex , t2.wx_union_id, t2.mini_open_id, t2.h5_open_id, t1.external_user_id FROM cwx_external_user t1 LEFT JOIN member t2 ON t1.external_user_id = t2.external_user_id AND t2.`status` IN (?) AND t2.tenant_id = ? AND t2.tenant_app_id = ? WHERE t1.external_user_id = ? AND t1.tenant_id = ? LIMIT ?|17|22|1||0|0|17|1|17|1|
|employee|UPDATE backlog SET finish_amount = ?, finish_time = IF(task_amount <= finish_amount, ifnull(finish_time, now()), NULL), status = IF(task_amount <= finish_amount, ?, ?), update_time = now() WHERE tenant_id = ? AND tenant_app_id = ? AND employee_id = ? AND scene = ? AND begin_time <= ? AND expire_time >= ?|17|23|2||0|0|3200|396|0|0|
|corpwx|UPDATE external_user SET un_assign_flag = ? WHERE tenant_id = ? AND status = ? AND un_assign_flag = ?|16|68|9||0|0|493466|71974|0|0|
|authorization_service|UPDATE user_login_token SET 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_data = ? WHERE id = ?|16|25|2||0|0|16|1|0|0|
|message_push|INSERT INTO message_log (id, tenant_id, tenant_app_id, user_id, scene_type , msg_id, content, post_data, create_time, update_time) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ?)|16|30|3||0|0|0|0|0|0|
|v4_user|SELECT COUNT(*) AS total FROM potential_customer WHERE maintain_shop_id = ? AND maintain_employee_id IN (?) AND status IN (?) AND tenant_id = ? AND tenant_app_id = ?|16|46|6||0|0|10089|1148|16|1|
|tenant|SELECT count(*) FROM ( SELECT DISTINCT s.sneak_guest_id FROM tenant.sneak_guest_maintain s JOIN tenant.sneak_guest sg ON sg.id = s.sneak_guest_id AND (sg.fail_type IS NULL OR sg.fail_type = ?) WHERE s.tenant_id = ? AND s.tenant_app_id = ? AND s.shop_id = ? AND s.event_type = ? AND s.create_time BETWEEN ? AND ? ) a|16|578|168||0|0|1301140|228812|16|1|
|user_service|UPDATE tenant_member_info SET tenant_app_id = ?, user_id = ?, shop_id = ?, birthday_is_lunar = ?, memorial_name = ?, memorial_day_is_lunar = ?, grade_id = ?, create_time = ?, update_time = ?, erp_card_no = ? WHERE tenant_id = ? AND id = ?|16|25|3||0|0|16|1|0|0|
|gift_mail|SELECT ifnull(sum(quantity), ?) FROM gift_mail.trade WHERE tenant_wechatapp_id = ? AND user_id = ? AND trade_type = ? AND product_id = ? AND order_status IN (?) AND source = ?|16|55|9||0|0|78719|8854|16|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 = ?|16|51|9||0|0|2579602|510524|16|1|
|coupon_service|SELECT egc.id, tmp.coupon_name, tmp.coupon_type, tmp.remark, cp.take_effect_way , cp.take_start_day, cp.take_effect_day, DATE_FORMAT(cp.begin_time, '%Y-%m-%d') AS begin_time , DATE_FORMAT(cp.end_time, '%Y-%m-%d') AS end_time, egc.limit_grant_time , DATE_FORMAT(egc.grant_begin_time, '%Y-%m-%d') AS grant_begin_time , DATE_FORMAT(egc.grant_end_time, '%Y-%m-%d') AS grant_end_time , ifnull(tmp.face_value, ?) / ? AS face_value , tmp.face_value AS point, ifnull(tmp.discount, ?) / ? AS discount , tmp.scope, tmp.product_name, tmp.product_image_url , if(egc.state = ?, ?, CASE  WHEN cp.end_time IS NOT NULL AND cp.end_time < now() THEN ? WHEN egc.limit_grant_time = ? AND egc.grant_end_time < now() THEN ? WHEN tgl.put_quantity <= ( SELECT count(*) FROM coupon_service.employee_give_coupon_log WHERE employee_give_coupon_id = egc.id ) THEN ? ELSE ? END) AS state , tr.type AS redpackType, ifnull(tr.min_price, ?) / ? AS minPrice FROM coupon_service.employee_give_coupon egc INNER JOIN coupon_service.coupon_push cp ON egc.template_id = cp.template_id AND cp.source = ? AND egc.id = cp.source_id AND cp.state = ? INNER JOIN coupon_service.template tmp ON egc.template_id = tmp.id INNER JOIN coupon_service.template_grant_limit tgl ON cp.id = tgl.coupon_push_id LEFT JOIN coupon_service.template_redpack tr ON tr.template_id = tmp.id WHERE egc.tenant_app_id = ? AND egc.state = ? AND (egc.limit_grant_time = ? OR egc.grant_begin_time <= now()) AND (egc.limit_shop = ? OR EXISTS ( SELECT ? FROM coupon_service.employee_give_coupon_shop cs WHERE egc.id = cs.employee_give_id AND cs.shop_id = ? )) AND egc.limit_role IN (?) ORDER BY state ASC, egc.id DESC LIMIT ?|15|40|7||0|0|1158390|111318|76|10|
|user_service|INSERT INTO erp_integral_log (id, tenant_id, tenant_wechatapp_id, integral_erp_id, member_erp_id , note_erp_id, remark, integral, erp_create_time, create_time , update_time, busi_type, busi_id) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?) ON DUPLICATE KEY UPDATE update_time = now()|15|24|2||0|0|0|0|0|0|
|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 ?|15|31|6||0|0|5314791|510524|35|5|
|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 = ?|15|78|27||0|0|37895|8975|15|1|
|coupon_service|SELECT id, tenant_id, tenant_app_id, template_id, coupon_push_id , coupon_no, coupon_state, user_id, coupon_name, coupon_type , face_value, discount, use_threshold, balance, begin_time , end_time, wx_card_id, wx_card_no, source, source_id , business_id, create_time, update_time FROM coupon WHERE tenant_app_id = ? AND user_id = ? AND source = ? AND business_id = ?|15|19|1||0|0|7|3|0|0|
|employee|UPDATE backlog SET tenant_id = ?, tenant_app_id = ?, status = ?, scene = ?, expire_time = ?, finish_time = ? WHERE id = ?|14|23|3||0|0|14|1|0|0|
|user_service|UPDATE tenant_member_bind SET tenant_app_id = ?, user_id = ?, wx_user_id = ?, erp_member_id = ?, wx_union_id = ?, create_time = ?, update_time = ? WHERE tenant_id = ? AND id = ?|14|32|7||0|0|14|1|0|0|
|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|14|67|16||0|0|2046716|146194|14|1|
|v4_user|SELECT employee_id FROM member_butler WHERE shop_id = ? AND employee_id IN (?) AND tenant_id = ? AND tenant_app_id = ?|14|26|3||0|0|271942|43073|238382|29486|
|user_service|UPDATE tenant_member_bind SET tenant_app_id = ?, user_id = ?, wx_user_id = ?, erp_member_id = ?, create_time = ?, update_time = ?, external_user_id = ? WHERE tenant_id = ? AND id = ?|14|24|4||0|0|14|1|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 = ?|14|489|100||0|0|6708950|479828|14|1|
|tenant|SELECT sg.employee_id AS employeeId, sg._actual AS actualNum, sg._maintain AS continueNum, sg._failure AS failNum, sg._success AS dealNum , e.employee_name, e.head_img_url FROM ( SELECT sgm.employee_id, count(DISTINCT sneak_guest_id) AS _actual, sum(_maintain) AS _maintain , sum(_success) AS _success, sum(_failure) AS _failure , max(sgm.create_time) AS create_time FROM ( SELECT sgm.employee_id, sneak_guest_id , if(event_type = ?, ?, ?) AS _maintain , if(event_type = ?, ?, ?) AS _success , if(event_type = ?, ?, ?) AS _failure , sgm.create_time AS create_time FROM tenant.sneak_guest_maintain sgm JOIN tenant.sneak_guest sg ON sgm.sneak_guest_id = sg.id WHERE sgm.tenant_id = ? AND sgm.tenant_app_id = ? AND sgm.shop_id = ? AND sgm.create_time BETWEEN ? AND ? AND sgm.event_type IN (?) AND (sg.fail_type IS NULL OR sg.fail_type = ?) ) sgm WHERE 1 = 1 GROUP BY sgm.employee_id ) sg JOIN tenant.employee e ON e.id = sg.employee_id ORDER BY sg.create_time DESC LIMIT ?|14|751|102||0|0|2329668|229399|124|10|
|v4_sales|SELECT COUNT(*) AS total FROM warranty WHERE member_id IN (?) AND is_disable = ? AND tenant_id = ? AND tenant_app_id = ?|14|42|13||0|0|84778|6529|14|1|
|deliver|SELECT * FROM express_address WHERE user_id = ? AND type = ?|14|25|2||0|0|160067|11435|3|1|
|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 = ?|13|23|2||0|0|2591|352|13|1|
|user_service|SELECT count(1) 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|13|16|1||0|0|2788|537|13|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 = ?|13|51|17||0|0|3106092|858097|13|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 = ?|12|40|10||0|0|38798|4835|6|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|12|44|8||0|0|215134|29463|41263|5627|
|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 FROM erp_sales t1 WHERE t1.dept_erp_id = ? AND t1.member_erp_id IN (?) AND t1.sales_date >= DATE_FORMAT(?, '%Y-%m-%d') AND t1.is_sales = ? AND t1.sales_status = ? AND t1.tenant_id = ? AND t1.tenant_app_id = ?|11|18|3||0|0|356|66|190|51|
|v4_user|UPDATE member SET shop_id = ?, update_time = ? WHERE id = ? AND tenant_id = ? AND tenant_app_id = ?|11|31|16||15|15|11|1|0|0|
|v4_sales|SELECT ifnull(round(avg(cd.score), ?), ?) FROM comment c JOIN comment_detail cd ON cd.comment_id = c.id AND cd.subject_type = ? AND cd.tenant_id = ? AND cd.tenant_app_id = ? WHERE c.erp_dept_id = ? AND c.create_time BETWEEN ? AND ? AND c.tenant_id = ? AND c.tenant_app_id = ?|11|37|8||0|0|820222|76008|11|1|
|corpwx|SELECT id, tenant_id, template_id, corp_id, corp_name , agent_id, agent_name, agent_round_logo_url, agent_square_logo_url, origin_auth_info , auth_time, status, create_time, update_time, is_inner_app , verify_token, encoding_aes_key, agent_secret, enable_status FROM app WHERE corp_id = ? AND status = ?|11|21|3||0|0|16533|1503|0|0|
|gift_mail|SELECT id, tenant_wechatapp_id, shop_id, shop_name, product_id , create_time, update_time FROM take_shop WHERE product_id = ?|11|27|4||0|0|513623|46693|222|41|
|v4_user|SELECT ifnull(t2.id, ?) AS id, t2.shop_id, t2.mobile_no , CASE  WHEN t2.member_name IS NULL OR t2.member_name = ? THEN ifnull(t1.external_user_name, t3.nick_name) ELSE t2.member_name END AS member_name, ifnull(t2.head_img_url, t3.head_img_url) AS head_img_url , ifnull(t2.sex, ifnull(t1.sex, ?)) AS sex , t2.wx_union_id, t2.mini_open_id, t2.h5_open_id, t1.external_user_id, t2.status FROM cwx_external_user t1 LEFT JOIN member t2 ON t1.tenant_id = t2.tenant_id AND t1.external_user_id = t2.external_user_id AND t2.tenant_id = ? AND t2.tenant_app_id = ? LEFT JOIN wx_user t3 ON t2.h5_open_id = t3.open_id WHERE t1.external_user_id IN (?) AND t1.tenant_id = ?|11|13|1||0|0|154|30|53|10|
|goods|SELECT shop_id FROM goods.goods_take_shop WHERE goods_id = ? AND activity_id = ?|11|55|15||0|0|1166954|106095|137|20|
|employee|INSERT INTO backlog (id, tenant_id, tenant_app_id, user_id, employee_id , status, scene, begin_time, expire_time, md5_str , shop_id, task_amount, finish_amount) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?) ON DUPLICATE KEY UPDATE update_time = now()|10|24|5||3|2|0|0|0|0|
|warranty_service|UPDATE warranty SET warranty_data = ?, upload_frequency = ? WHERE id = ?|10|15|1||0|0|10|1|0|0|
|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 = ?|10|30|11||0|0|41694|5323|2|1|
|coupon_service|SELECT cmod.coupon_id, cmo.pay_type 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 (?)|10|88|23||0|0|944578|94458|32|10|
|v4_user|SELECT COUNT(*) AS total FROM member_butler t1 JOIN member t2 ON t1.tenant_id = t2.tenant_id AND t1.member_id = t2.id AND t2.tenant_id = ? AND t2.tenant_app_id = ? WHERE t1.shop_id = ? AND t1.employee_id = ? AND t1.tenant_id = ? AND t1.tenant_app_id = ?|10|17|2||0|0|5358|1978|10|1|
|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 = ?|10|27|6||0|0|603726|153408|10|1|
|agency|SELECT count(*) FROM agency.booking_order WHERE tenant_app_id = ? AND shop_id = ? AND status = ?|10|13|2||0|0|65707|6571|10|1|
|v4_sales|SELECT count(*) FROM v4_sales.erp_sales es LEFT JOIN v4_sales.erp_sales_ignore esi ON esi.sales_id = es.id AND esi.tenant_id = ? AND esi.tenant_app_id = ? WHERE es.member_erp_id IN (?) AND esi.id IS NULL AND es.sales_status = ? AND (es.comment_id IS NULL OR es.comment_id = ?) AND es.sales_date >= ? AND es.tenant_id = ? AND es.tenant_app_id = ?|10|15|3||0|0|690|234|10|1|
|gift_mail|SELECT count(0) 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 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 i.volume DESC, p.tag_price ASC, p.id DESC ) tmp_count|10|17|2||0|0|72620|7262|10|1|
|tenant|SELECT id, tenant_id, tenant_app_id, template_id, item_code , item_name, item_icon, item_url, type, enable , sort, create_time, update_time FROM display_items_setting WHERE tenant_app_id = ? AND type = ? ORDER BY sort ASC|10|11|1||0|0|67760|6776|140|14|
|order|SELECT count(1) AS amount FROM order_info WHERE user_id = ? AND tenant_wechatapp_id = ? AND finish_type IS NULL AND status <> ?|10|11|1||0|0|4|2|10|1|
|tenant|SELECT count(*) FROM ( SELECT s.sneak_guest_id FROM tenant.sneak_guest_maintain s JOIN tenant.sneak_guest sg ON sg.id = s.sneak_guest_id AND (sg.fail_type IS NULL OR sg.fail_type = ?) WHERE s.tenant_id = ? AND s.tenant_app_id = ? AND s.shop_id = ? AND s.create_time BETWEEN ? AND ? AND s.event_type IN (?) GROUP BY s.sneak_guest_id ) a|9|295|68||0|0|740442|229334|9|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 AS addDays, 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 FROM value_added_user WHERE sales_erp_id = ? AND sales_index = ? AND tenant_wechatapp_id = ?|9|12|1||0|0|1|1|1|1|
|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 = ? AND sg.create_shop_id = ? ORDER BY sg.id DESC ) tmp_count|9|89|35||0|0|397690|78227|9|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 = ?|9|13|2||0|0|113|33|40|11|
|v4_user|SELECT id, member_name, mobile_no, head_img_url, combine_status , combine_id FROM member WHERE (mobile_no LIKE ? OR member_name LIKE ?) AND tenant_id = ? AND tenant_app_id = ? LIMIT ?|9|122|29||0|0|2878540|319860|9|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 = ?|9|47|14||0|0|21764|5048|9|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 = ?|9|36|7||0|0|16258|4127|3426|637|
|tenant|SELECT count(*) AS amount FROM sneak_guest WHERE tenant_app_id = ? AND status = ? AND create_shop_id = ? AND maintain_employee_id = ? AND create_time <= ? AND next_maintain_date >= ? AND next_maintain_date <= ?|9|26|8||0|0|53067|12097|9|1|
|tenant|SELECT DISTINCT t1.sales_type FROM erp_sales_detail t1 LEFT JOIN erp_sales t2 ON t2.sales_erp_id = t1.sales_erp_id AND t2.tenant_id = t1.tenant_id WHERE t1.tenant_id = ? AND t1.tenant_wechatapp_id = ? AND ifnull(t1.sales_type, ?) != ? AND t2.tenant_id = t1.tenant_id AND t2.tenant_wechatapp_id = t1.tenant_wechatapp_id AND t2.member_erp_id = ? AND t2.sales_status = ? AND t2.is_sales = ?|9|17|4||0|0|334|129|22|7|
|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|9|263|68||0|0|5731687|709587|9|1|
|tenant|SELECT count(*) FROM tenant.sneak_guest_maintain s JOIN tenant.sneak_guest sg ON sg.id = s.sneak_guest_id AND (sg.fail_type IS NULL OR sg.fail_type = ?) WHERE s.tenant_id = ? AND s.tenant_app_id = ? AND s.shop_id = ? AND s.event_type IN (?) AND s.create_time BETWEEN ? AND ?|9|378|103||0|0|738466|229092|9|1|
|tenant|SELECT DISTINCT t1.category_erp_id, t1.category_name FROM erp_sales_detail t1 LEFT JOIN erp_sales t2 ON t2.sales_erp_id = t1.sales_erp_id AND t2.tenant_id = t1.tenant_id WHERE t1.tenant_id = ? AND t1.tenant_wechatapp_id = ? AND ifnull(t1.category_name, ?) != ? AND t2.tenant_id = t1.tenant_id AND t2.tenant_wechatapp_id = t1.tenant_wechatapp_id AND t2.member_erp_id = ? AND t2.sales_status = ? AND t2.is_sales = ?|9|17|4||0|0|351|133|39|11|
|v4_user|SELECT id, potential_customer_id, should_maintain_date, should_maintain_shop_id, should_maintain_employee_id , should_maintain_employee_name, oper_status, oper_shop_id, oper_employee_id, oper_employee_name , remark, is_required, tenant_id, tenant_app_id, create_time , update_time FROM potential_customer_follow WHERE potential_customer_id IN (?) AND tenant_id = ? AND tenant_app_id = ? ORDER BY potential_customer_id ASC, should_maintain_date ASC|8|10|1||0|0|1318|326|659|163|
|coupon_service|SELECT id, tenant_id, tenant_app_id, template_id, shop_id , shop_name, create_time, update_time FROM coupon_limit_shop WHERE template_id = ?|8|12|2||0|0|190603|23835|1|1|
||SELECT id, tenant_wechatapp_id, warranty_data FROM warranty_service.warranty WHERE tenant_wechatapp_id IN (?) ORDER BY id|8|4952|1406||0|0|5926727|765648|2864135|382824|
|v4_sales|SELECT count(*) FROM v4_sales.erp_sales es LEFT JOIN v4_sales.erp_sales_ignore esi ON esi.sales_id = es.id AND esi.tenant_id = ? AND esi.tenant_app_id = ? WHERE es.member_erp_id IN (?) AND esi.id IS NULL AND es.sales_status = ? AND (es.comment_id IS NULL OR es.comment_id = ?) AND es.tenant_id = ? AND es.tenant_app_id = ?|8|13|2||0|0|1456|253|8|1|
|gift_mail|SELECT count(0) FROM trade WHERE tenant_wechatapp_id = ? AND user_id = ?|8|32|12||0|0|40394|12994|8|1|
|value_added|UPDATE value_added_user SET state = ? WHERE state = ? AND tenant_id = ? AND tenant_wechatapp_id = ? AND user_id = ? AND product_barcode = ?|8|16|5||0|0|192|83|0|0|
|v4_employee|SELECT t.id AS task_id, task_type , if(task_type = ?, st.description, it.description) AS description , if(task_type = ?, st.quick_reply, it.quick_reply) AS quick_reply , task_name, member_id, member_name, member_mobile_no, member_sex , member_level, t.start_time, t.end_time , datediff(t.end_time, NULL) AS left_days, send_coupons , recv_coupons, st.coupons, t.accept_time, t.plan_arrival_shop_time, t.arrival_shop_time , t.trade_time FROM task_task t LEFT JOIN task_system_task_template st ON st.id = t.task_template_id AND st.tenant_id = ? AND st.tenant_app_id = ? LEFT JOIN task_invite_task_template it ON it.id = t.task_template_id AND it.tenant_id = ? AND it.tenant_app_id = ? WHERE t.status = ? AND task_type = ? AND task_template_id = ? AND shop_id = ? AND employee_id = ? AND (member_mobile_no = ? OR member_name LIKE concat(?, ?, ?)) AND finish_time IS NULL AND t.end_time > now() AND t.tenant_id = ? AND t.tenant_app_id = ? ORDER BY t.id DESC LIMIT ?, ?|8|104|35||0|0|6835277|1718354|71|10|
||SELECT id, sales_detail_id FROM v4_sales.warranty_detail WHERE tenant_id = ?|8|129|49||0|0|6229359|779108|6229359|779108|
||SELECT sales_no, sales_erp_id FROM v4_sales.erp_sales WHERE tenant_id = ?|8|72|15||0|0|4082497|510562|4082497|510562|
|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 = ?|8|34|17||0|0|90408|27143|8|1|
|v4_user|SELECT id, shop_id, mobile_no, member_name, head_img_url , sex, birthday, birthday_is_lunar, memorial_name, memorial_day , memorial_day_is_lunar, address, interest, wx_union_id, mini_open_id , h5_open_id, wx_card_code, recommend_id, recommend_bind_time, external_user_id , status, combine_status, combine_id, tenant_id, tenant_app_id , create_time, update_time FROM member WHERE external_user_id = ? AND status IN (?) AND tenant_id = ? AND tenant_app_id = ? LIMIT ?|8|9|1||0|0|3|1|3|1|
|gift_mail|SELECT ifnull(sum(quantity), ?) FROM gift_mail.trade WHERE tenant_wechatapp_id = ? AND user_id = ? AND product_id = ? AND trade_type = ? AND order_status IN (?) AND to_days(create_time) = to_days(now()) AND source = ?|8|34|11||0|0|80882|12994|8|1|
|v4_coupon|SELECT COUNT(*) AS total FROM v4_coupon.employee_grant_coupon egc JOIN v4_coupon.coupon_put cp ON egc.put_id = cp.id AND cp.tenant_id = ? AND cp.tenant_app_id = ? JOIN v4_coupon.coupon_put_limit cpl ON cpl.put_id = cp.id AND cpl.tenant_id = ? AND cpl.tenant_app_id = ? LEFT JOIN v4_coupon.employee_grant_record egr ON egr.employee_grant_id = egc.id AND egr.employee_id = ? AND egr.shop_id = ? AND (egr.external_user_id = ? OR egr.member_id = ?) AND egr.tenant_id = ? AND egr.tenant_app_id = ? WHERE cp.put_scene = ? AND cp.status = ? AND if(cp.take_effect_way = ?, cp.end_time > now(), ?) AND (egc.limit_grant_time = ? OR (egc.grant_begin_time <= now() AND egc.grant_end_time > now())) AND (cpl.put_quantity > get_quantity OR cpl.put_quantity = ?) AND (egc.limit_shop = ? OR EXISTS ( SELECT ? FROM v4_coupon.employee_grant_shop cs WHERE egc.id = cs.employee_grant_id AND cs.shop_id = ? AND cs.tenant_id = ? AND cs.tenant_app_id = ? )) AND limit_role IN (?) AND egc.tenant_id = ? AND egc.tenant_app_id = ?|8|12|2||0|0|67809|8883|8|1|
|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 ?|8|483|132||0|0|3833264|479206|10|2|
||SELECT sales_erp_id, product_barcode, sales_index FROM tenant.erp_sales_detail WHERE tenant_id = ?|8|196|34||0|0|14417243|1802249|14417243|1802249|
|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 (|8|21|4||0|0|62128|8855|62128|8855|
||SELECT sales_erp_id, sales_index, id, tenant_app_id FROM v4_sales.erp_sales_detail WHERE tenant_id = ?|8|308|71||0|0|13710237|1714540|13710237|1714540|
||SELECT sales_no, sales_erp_id FROM tenant.erp_sales WHERE tenant_id = ?|8|80|16||0|0|4242241|530281|4242241|530281|
|coupon_service|UPDATE coupon SET coupon_state = ?, update_time = ? WHERE id = ?|7|12|3||0|0|7|1|0|0|
|v4_sales|SELECT member_erp_id FROM v4_sales.erp_sales WHERE sales_status = ? AND sales_date < ? AND member_erp_id IN (|7|18|4||0|0|12147|3059|3612|968|
|v4_user|SELECT checkin_time, id FROM potential_customer WHERE maintain_shop_id = ? AND status IN (?) AND tenant_id = ? AND tenant_app_id = ?|7|28|7||0|0|13676|4127|2397|637|
|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 = ?|7|45|17||0|0|593270|188101|7|1|
|user_service|UPDATE tenant_member_info SET tenant_app_id = ?, user_id = ?, shop_id = ?, birthday_is_lunar = ?, address = ?, memorial_name = ?, memorial_day_is_lunar = ?, grade_id = ?, create_time = ?, update_time = ?, erp_card_no = ? WHERE tenant_id = ? AND id = ?|7|16|5||0|0|7|1|0|0|
|user_service|UPDATE tenant_member_bind SET tenant_app_id = ?, user_id = ?, wx_user_id = ?, erp_member_id = ?, create_time = ?, update_time = ? WHERE tenant_id = ? AND id = ?|7|14|3||0|0|7|1|0|0|
|activity_service|SELECT count(DISTINCT user_id) FROM user_trace WHERE tenant_app_id = ? AND activity_id = ? AND status != ?|7|9|1||0|0|16471|3515|7|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 = ?|7|120|35||0|0|513777|106290|7|1|
|tenant|SELECT t.id AS sneakGuestId, t.tenant_id, t.tenant_app_id, t.user_id, t.user_type , t.maintain_employee_id, t.create_shop_id AS shopId FROM tenant.sneak_guest t JOIN tenant.sneak_guest_maintain m ON m.tenant_app_id = ? AND t.id = m.sneak_guest_id AND m.event_type = ? WHERE t.tenant_app_id = ? AND t.status = ? AND t.create_time < ? GROUP BY t.id HAVING count(*) >= ?|7|311|62||0|0|1062843|152082|83905|12019|
|tenant|INSERT INTO erp_sales (id, tenant_id, tenant_wechatapp_id, sales_erp_id, sales_no , sales_date, member_erp_id, employee_erp_id, employee_name, dept_erp_id , amount, sales_remark, receipts, sales_status, is_sales , busi_date) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?) ON DUPLICATE KEY UPDATE sales_date = ?, member_erp_id = ?, employee_erp_id = ?, employee_name = ?, dept_erp_id = ? , amount = ?, sales_remark = ?, receipts = ?, sales_status = ?, is_sales = ? , busi_date = ?|7|14|3||0|0|0|0|0|0|
|user_service|SELECT t1.user_id AS userId, t3.open_id AS wxOpenId FROM user_service.tenant_member t1 JOIN user_service.tenant_member_bind t2 ON t1.tenant_id = t2.tenant_id AND t1.id = t2.id JOIN user_service.wx_user t3 ON t2.wx_user_id = t3.id AND t3.is_subscribe = ? WHERE t1.tenant_id = ? AND t1.tenant_app_id = ? AND t1.user_id IN (?)|6|13|3||0|0|36|8|7|2|
|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 = ?|6|7|1||0|0|574|143|1|1|
|account|SELECT ifnull(sum(amount), ?) FROM account.account_flow WHERE src_tenant_app_id = ? AND src_account_id = ? AND busi_type = ? AND oper_type = ?|6|18|6||0|0|14541|2424|6|1|
|coupon_service|SELECT count(0) FROM ( SELECT cm.id, coupon_name, coupon_pack_name AS packName, cp.coupon_type , round(t.face_value / ?, ?) AS faceValue , round(t.discount / ?, ?) AS discount , cp.begin_time, cp.end_time, t.scope , round(cp.use_threshold / ?, ?) AS useThreshold , cm.pay_type, round(cm.cash / ?, ?) AS cash , cm.point, t.product_name, cm.type, cp.take_effect_way, cp.take_start_day , cp.take_effect_day, tgl.get_quantity, tgl.get_quantity / tgl.put_quantity * ? AS total , t.face_value AS couponPoint FROM coupon_service.coupon_market cm JOIN coupon_service.coupon_push cp ON cp.tenant_app_id = ? AND cp.source_id = cm.id AND cp.source IN (?) JOIN coupon_service.template t ON t.tenant_app_id = ? AND t.id = cp.template_id JOIN coupon_service.template_grant_limit tgl ON tgl.tenant_app_id = ? AND tgl.coupon_push_id = cp.id LEFT JOIN coupon_service.coupon_market_limit_tag tag ON tag.tenant_id = ? AND tag.tenant_app_id = ? AND cm.id = tag.coupon_market_id AND tag.label_id IN (?) WHERE cm.tenant_id = ? AND cm.tenant_app_id = ? AND cm.type = ? AND cm.state = ? AND if(take_effect_way = ?, end_time > now(), 1 = 1) AND tgl.get_quantity < tgl.put_quantity AND cm.display_way = ? AND (cm.limit_type = ? OR (cm.limit_type = ? AND find_in_set(?, cm.limit_grade_ids)) OR (cm.limit_type = ? AND tag.id IS NOT NULL)) UNION ALL SELECT cm.id, NULL, coupon_pack_name AS packName, NULL, ? , ?, NULL, NULL, NULL, ? , pay_type, round(cash / ?, ?) AS cash , point, NULL, type, NULL, ? , ?, ?, ?, ? FROM coupon_service.coupon_market cm LEFT JOIN coupon_service.coupon_market_limit_tag tag ON tag.tenant_id = ? AND tag.tenant_app_id = ? AND cm.id = tag.coupon_market_id AND tag.label_id IN (?) WHERE cm.tenant_id = ? AND cm.tenant_app_id = ? AND cm.type = ? AND cm.state = ? AND display_way = ? AND (cm.limit_type = ? OR (cm.limit_type = ? AND find_in_set(?, cm.limit_grade_ids)) OR (cm.limit_type = ? AND tag.id IS NOT NULL)) ) table_count|6|7|1||0|0|1950|529|6|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 ?, ?|6|31|17||0|0|32960|12486|60|10|
|user_service|SELECT count(0) 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 NULL AND us.shop_id IS NOT NULL|6|13|6||0|0|2343|1567|6|1|
|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 = ? ) table_count|6|9|1||0|0|75|60|6|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 = ?|6|29|7||0|0|383982|64093|515|182|
|tenant|SELECT DISTINCT s.employee_id AS id, e.employee_name FROM tenant.sneak_guest_maintain s JOIN tenant.sneak_guest sg ON sg.id = s.sneak_guest_id JOIN tenant.employee e ON s.tenant_id = e.tenant_id AND s.employee_id = e.id WHERE s.tenant_id = ? AND s.tenant_app_id = ? AND sg.create_shop_id = ? AND (sg.fail_type IS NULL OR sg.fail_type = ?) AND s.event_type = ? AND s.create_time BETWEEN ? AND ?|6|7|1||0|0|20171|3785|19|6|
|tenant|select sp.tenant_id as tenantId, sp.tenant_app_id as tenantAppId, emp.employee_erp_id as employeeErpId, emp.id as employeeId, emp.employee_no as employeeNo, emp.employee_name as employeeName, emp.employee_type as employeeType, emp.head_img_url as headImgUrl, emp.sex, sp.`status`, emp.mobile_no as mobileNo, emp.corp_wx_user_id as corpWxUserId, tu.user_id as userId from employee emp join employee_shop sp on emp.id=sp.employee_id and sp.status=? left join employee_tenant_user tu on sp.tenant_app_id=tu.tenant_app_id and emp.id=tu.employee_id and tu.`status`= ? where sp.tenant_app_id = ? and emp.`status` = ? and emp.id in (|6|10|2||0|0|13493|4676|1714|568|
|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|316998|153408|6|1|
|corpwx|SELECT id, tenant_id, params_key, params_value, group_id , create_time, update_time FROM corp_mini_qrcode_params WHERE group_id = ?|6|69|22||0|0|2679382|446582|30|5|
|coupon_service|UPDATE coupon_extend SET user_name = ?, mobile_no = ?, creator_user_name = ?, creator_mobile_no = ?, writeoff_employee_id = ?, writeoff_time = ? WHERE id = ?|6|8|1||0|0|6|1|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 NULL AND es.tenant_id = ? AND es.tenant_app_id = ?|6|10|2||0|0|676540|262756|6|1|
|user_service|UPDATE tenant_member_info SET tenant_app_id = ?, user_id = ?, shop_id = ?, birthday = ?, birthday_is_lunar = ?, address = ?, memorial_name = ?, memorial_day_is_lunar = ?, grade_id = ?, create_time = ?, update_time = ?, info_is_perfect = ?, erp_card_no = ? WHERE tenant_id = ? AND id = ?|6|9|3||0|0|6|1|0|0|
|v4_coupon|SELECT * FROM v4_coupon.sales_give_coupon_record WHERE put_id = ? AND sales_id = ? AND rule_id = ? AND tenant_id = ? AND tenant_app_id = ? LIMIT ?|6|88|23||0|0|1106854|184488|0|0|
|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')|6|177|88||0|0|221847|112142|1978|649|
|position|SELECT id, tenant_id, tenant_app_id, object_type, object_id , geo_hash, latitude, longitude, create_time, update_time FROM geo_position WHERE id != ? AND tenant_id = ? AND tenant_app_id = ? AND object_type = ?|6|8|1||0|0|282|83|282|83|
|timer|INSERT INTO task_execute_log (id, task_id, task_name, task_params, success , error_msg, create_time) VALUES (?, ?, ?, ?, ? , ?, ?)|6|9|2||0|0|0|0|0|0|
|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 ?|6|8|1||0|0|2753512|510591|13|6|
|tenant|SELECT count(*) FROM employee emp JOIN employee_shop es ON emp.id = es.employee_id JOIN tenant_wechatapp_shop sp ON es.shop_id = sp.id WHERE emp.tenant_id = ? AND es.`tenant_app_id` = ? AND sp.id = ? AND es.`status` IN (?) AND emp.`status` IN (?) AND es.`status` = ? AND NOT EXISTS ( SELECT NULL FROM employee_shop_change esc WHERE emp.tenant_id = esc.tenant_id AND emp.id = esc.employee_id AND sp.id = esc.old_shop_id AND esc.status IN (?) ) AND emp.id IN (?)|5|7|1||0|0|336|92|5|1|
|v4_sales|SELECT COUNT(*) AS total FROM v4_sales.warranty w JOIN v4_sales.erp_sales es ON es.id = w.sales_id AND es.tenant_id = ? AND es.tenant_app_id = ? WHERE w.member_id IN (?) AND is_disable = ? AND w.tenant_id = ? AND w.tenant_app_id = ?|5|6|1||0|0|14|8|5|1|
|export|SELECT count(0) FROM export_log el INNER JOIN export_file ef ON el.tenant_app_id = ef.tenant_app_id AND el.batch_no = ef.batch_no AND el.md5_key = ef.md5_key AND el.export_code = ef.export_code WHERE el.tenant_app_id = ? AND el.employee_id = ? AND el.batch_no BETWEEN ? AND ?|5|14|6||0|0|271531|54314|5|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 mb.erp_member_id in (|5|14|5||0|0|5157535|1199669|2142|558|
|tenant|INSERT INTO erp_sales_detail_extend (tenant_id, id, tenant_wechatapp_id, sales_erp_id, sales_index , sales_brand, sales_craft) VALUES (?, ?, ?, ?, ? , ?, ?) ON DUPLICATE KEY UPDATE update_time = now(), sales_brand = ?, sales_craft = ?|5|7|2||0|0|0|0|0|0|
|user_service|UPDATE tenant_member_info SET member_image_flag = ?, member_image_time = now() WHERE tenant_id = ? AND tenant_app_id = ? AND user_id IN (?) AND (member_image_flag = ? OR member_image_flag IS NULL)|5|11|5||0|0|5|1|0|0|
|user_service|UPDATE tenant_member_info SET tenant_app_id = ?, user_id = ?, shop_id = ?, birthday = ?, birthday_is_lunar = ?, memorial_name = ?, memorial_day_is_lunar = ?, grade_id = ?, create_time = ?, update_time = ?, info_is_perfect = ?, erp_card_no = ? WHERE tenant_id = ? AND id = ?|5|9|2||0|0|5|1|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 NULL|5|12|4||0|0|46960|14454|23475|7227|
|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|15|8||0|0|1285744|449833|306|101|
|employee|INSERT INTO backlog_report (tenant_id, tenant_app_id, employee_id, shop_id, scene , record) VALUES (?, ?, ?, ?, ? , ?) ON DUPLICATE KEY UPDATE record = ?|5|6|1||0|0|0|0|0|0|
|user_service|SELECT count(0) 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 = ?|5|43|16||0|0|15338|4754|5|1|
|corpwx|SELECT id, tenant_id, cwx_user_id, user_id, old_user_id , union_id, name, sex, avatar, tenant_user_id , un_assign_flag, corp_user_id, wx_user_id, create_time, update_time , status FROM external_user WHERE tenant_id = ? AND user_id = ? AND status = ?|5|7|2||0|0|4|2|4|2|
|user_service|UPDATE tenant_member_bind SET tenant_app_id = ?, user_id = ?, wx_user_id = ?, erp_member_id = ?, wx_union_id = ?, create_time = ?, update_time = ?, external_user_id = ? WHERE tenant_id = ? AND id = ?|5|7|2||0|0|5|1|0|0|
|activity_service|SELECT count(*) FROM vote_player player WHERE player.vote_id = ? AND player.status > ? AND player.status IN (?)|5|13|4||0|0|37915|7583|5|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|5|12|3||0|0|51948|14092|10001|4089|
|corpwx_license|DELETE FROM cwx_sync_active_info WHERE tenant_id = ? AND user_id = ? AND tenant_id = ?|5|19|5||0|0|124774|24957|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.id 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.id IN (?) AND t1.member_id = ? AND t1.tenant_id = ? AND t1.tenant_app_id = ?|5|5|1||0|0|130|40|27|10|
|user_service|SELECT id, wx_app_id, open_id, union_id, nick_name , user_name, mobile_no, head_img_url, is_subscribe, subscribe_time , unsubscribe_time, wx_card_code, wx_card_no, sex, country , province, city, plat_open_id, create_time, update_time FROM wx_user WHERE id = ?|5|6|1||0|0|5|1|5|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|4|12|5||0|0|2347040|586965|55|14|
|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|4|13|5||0|0|74407|25442|126|54|
|coupon_service|INSERT INTO coupon (id, tenant_id, tenant_app_id, template_id, coupon_push_id , coupon_no, coupon_state, user_id, coupon_name, coupon_type , face_value, discount, use_threshold, balance, begin_time , end_time, wx_card_id, wx_card_no, source, source_id , business_id, create_time, update_time) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?)|4|6|2||0|0|0|0|0|0|
|user_service|UPDATE tenant_member_info SET tenant_app_id = ?, user_id = ?, shop_id = ?, birthday = ?, birthday_is_lunar = ?, address = ?, memorial_name = ?, memorial_day_is_lunar = ?, grade_id = ?, create_time = ?, update_time = ?, member_image_flag = ?, info_is_perfect = ?, erp_card_no = ? WHERE tenant_id = ? AND id = ?|4|9|5||0|0|4|1|0|0|
|v4_user|UPDATE member_butler SET member_id = ?, employee_id = ?, shop_id = ?, update_time = ? WHERE id = ? AND tenant_id = ? AND tenant_app_id = ?|4|4|1||0|0|4|1|0|0|
|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 ?|4|6|2||0|0|5442|1741|0|0|
|v4_sales|SELECT member_erp_id FROM v4_sales.erp_sales WHERE sales_status = ? AND sales_date < ? AND member_erp_id IN (?) AND tenant_id = ? AND tenant_app_id = ? GROUP BY member_erp_id|4|6|2||0|0|5381|2112|171|92|
|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 ?|4|22|6||0|0|28564|7141|40|10|
|v4_sales|SELECT COUNT(*) AS total FROM v4_sales.erp_sales_detail t1 LEFT JOIN v4_sales.erp_sales t3 ON t3.sales_erp_id = t1.sales_erp_id AND t3.tenant_id = ? AND t3.tenant_app_id = ? WHERE t3.member_erp_id = ? AND t3.sales_status = ? AND t3.is_sales = ? AND t1.tenant_id = ? AND t1.tenant_app_id = ?|4|9|3||0|0|260|130|4|1|
|v4_user|SELECT count(*) FROM member_change_log t1 WHERE t1.change_type IN (?) AND t1.change_time >= ? AND t1.change_time < ? AND t1.new_shop_id = ? AND t1.tenant_id = ? AND t1.tenant_app_id = ?|4|15|8||0|0|912259|697702|4|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|4|9|3||0|0|29354|7345|1|1|
|tenant|SELECT sp.tenant_id AS tenantId, sp.tenant_app_id AS tenantAppId, emp.employee_erp_id AS employeeErpId, emp.id AS employeeId, emp.employee_no AS employeeNo , emp.employee_name AS employeeName, emp.employee_type AS employeeType, emp.head_img_url AS headImgUrl, emp.sex, sp.`status` , emp.mobile_no AS mobileNo, emp.corp_wx_user_id AS corpWxUserId, tu.user_id AS userId FROM employee emp JOIN employee_shop sp ON emp.id = sp.employee_id AND sp.status = ? LEFT JOIN employee_tenant_user tu ON sp.tenant_app_id = tu.tenant_app_id AND emp.id = tu.employee_id AND tu.`status` = ? WHERE sp.tenant_app_id = ? AND emp.`status` = ? AND emp.id IN (?) GROUP BY sp.tenant_id, sp.tenant_app_id, emp.id, tu.user_id|4|4|1||0|0|1795|637|257|99|
|coupon_service|SELECT count(0) FROM coupon_service.employee_give_coupon egc INNER JOIN coupon_service.coupon_push cp ON egc.template_id = cp.template_id AND cp.source = ? AND egc.id = cp.source_id AND cp.state = ? INNER JOIN coupon_service.template tmp ON egc.template_id = tmp.id INNER JOIN coupon_service.template_grant_limit tgl ON cp.id = tgl.coupon_push_id LEFT JOIN coupon_service.template_redpack tr ON tr.template_id = tmp.id WHERE egc.tenant_app_id = ? AND egc.state = ? AND (egc.limit_grant_time = ? OR egc.grant_begin_time <= now()) AND (egc.limit_shop = ? OR EXISTS ( SELECT ? FROM coupon_service.employee_give_coupon_shop cs WHERE egc.id = cs.employee_give_id AND cs.shop_id = ? )) AND egc.limit_role IN (?)|4|9|3||0|0|246169|85441|4|1|
|v4_sales|SELECT id, sales_index, sales_erp_id, sales_type, product_barcode , product_name, cert_no, hand_size, category_erp_id, category_name , stone_weight, gold_weight, total_weight, quantity, amount_total , amount_pay, integral, remark, sales_brand, sales_craft , erp_create_time, tenant_id, tenant_app_id, create_time, update_time FROM erp_sales_detail WHERE sales_erp_id = ? AND tenant_id = ? AND tenant_app_id = ?|4|4|1||0|0|5|2|5|2|
|warranty_service|UPDATE warranty_service.warranty SET has_read = ? WHERE tenant_wechatapp_id = ? AND id = ?|4|4|1||0|0|4|1|0|0|
|v4_sales|SELECT COUNT(*) AS total FROM v4_sales.erp_sales es LEFT JOIN v4_sales.erp_sales_ignore esi ON esi.sales_id = es.id AND esi.tenant_id = ? AND esi.tenant_app_id = ? WHERE member_erp_id IN (?) AND esi.id IS NULL AND sales_status = ? AND es.tenant_id = ? AND es.tenant_app_id = ?|4|6|2||0|0|1011|281|4|1|
|corpwx|SELECT eu.id, eu.tenant_id, eu.user_id, eu.name, eu.avatar , eu.corp_user_id, eu.cwx_user_id, eu.sex, eu.un_assign_flag, eu.union_id , eub.wx_user_id FROM corpwx.external_user eu JOIN corpwx.external_user_bind eub ON eu.tenant_id = eub.tenant_id AND eu.user_id = eub.external_user_id WHERE eu.tenant_id = ? AND eu.status = ? AND eub.wx_user_id IN (?) AND eu.un_assign_flag = ?|4|10|3||0|0|40|10|0|0|
|employee|SELECT count(*) AS record FROM backlog WHERE tenant_app_id = ? AND employee_id = ? AND status = ? AND expire_time BETWEEN ? AND ? AND shop_id = ? AND scene NOT IN (?)|4|4|1||0|0|14|7|4|1|
|erp_sync|INSERT INTO retry_data (id, tenant_id, tenant_app_id, business_type, operation_type , data_id, user_id, erp_member_id, need_erp_member_id, retry_times , msg, send_time, create_time, data) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?)|4|8|2||0|0|0|0|0|0|
|v4_sales|SELECT COUNT(*) AS total FROM ( SELECT max(es.sales_no) AS sales_no, max(es.id) AS id , max(es.sales_date) AS sales_date, max(es.member_erp_id) AS memberId , max(es.sales_erp_id) AS erpSalesId, esd.product_barcode , max(esd.product_name) AS product_name, max(category_erp_id) AS category_erp_id , max(category_name) AS category_name, sum(amount_total) AS amount_total , sum(amount_pay) AS amount_pay, count(esd.id) AS quantity 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 = ? LEFT JOIN v4_sales.value_added_ignore i ON i.erp_sales_id = es.sales_erp_id AND i.product_barcode = esd.product_barcode AND i.tenant_id = ? AND i.tenant_app_id = ? WHERE es.sales_status = ? AND is_sales = ? AND i.id IS NULL AND es.dept_erp_id = ? AND es.employee_erp_id = ? AND es.tenant_id = ? AND es.tenant_app_id = ? GROUP BY esd.product_barcode ) s|4|65|29||0|0|7426|2069|4|1|
|tenant|SELECT count(*) AS amount FROM sneak_guest WHERE tenant_app_id = ? AND status = ? AND create_shop_id = ? AND create_time <= ?|4|8|2||0|0|31944|12098|4|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.employee_id = ? AND t.tenant_id = ? AND t.tenant_app_id = ?|4|6|2||0|0|3005|1769|4|1|
|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 < ?|4|15|8||0|0|53938|13486|4|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 mb.erp_member_id in ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ...|4|14|5||0|0|4107452|1199706|1214|361|
|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 AS corpWxUserId, t.dept_erp_id FROM tenant.employee t LEFT JOIN tenant.tenant_wechatapp_shop sp ON t.shop_id = sp.id WHERE 1 = 1 AND t.tenant_id = ?|4|4|1||0|0|9524|3990|4762|1995|
|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 = ? AND gs.create_time >= ? AND gs.create_time <= ? AND sg.status = ? AND ey.employee_name LIKE concat(?, ?, ?) ORDER BY sg.id DESC ) tmp_count|4|63|22||0|0|603036|150769|4|1|
|user_service|UPDATE tenant_member SET user_name = ?, update_time = ? WHERE tenant_id = ? AND id = ?|4|5|1||0|0|4|1|0|0|
|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.employee_id = ? AND t.tenant_id = ? AND t.tenant_app_id = ?|4|36|14||0|0|45922|16023|4|1|
|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 = ?|4|6|2||0|0|4568|2322|4568|2322|
|employee|UPDATE backlog_system SET status = ?, finish_time = now() WHERE tenant_app_id = ? AND scene = ?|4|47|39||0|0|5184240|1296060|0|0|
|v4_user|SELECT sales_erp_id, reception_customer_id FROM reception_customer_deal WHERE reception_customer_id IN (?) AND status = ? AND tenant_id = ? AND tenant_app_id = ?|4|5|1||0|0|4|1|4|1|
|v4_employee|SELECT id, batch_no, task_type, system_task_type, task_frequency , task_name, task_template_id, business_id, shop_id, employee_id , member_id, start_time, end_time, finish_time, send_coupons , recv_coupons, recv_coupon_time, accept_time, plan_arrival_shop_time, arrival_shop_time , trade_nos, trade_num, trade_amount, trade_time, member_name , member_mobile_no, member_latest_birthday, member_sex, member_age, member_level_id , member_level, member_sales_amount, member_sales_count, member_integral_balance, member_integral_total , status, remark, tenant_id, tenant_app_id, create_time , update_time FROM task_task WHERE task_template_id IN (?) AND business_id = ? AND member_id = ? AND tenant_id = ? AND tenant_app_id = ?|3|3|1||0|0|0|0|0|0|
|user_service|INSERT INTO tenant_member_info (tenant_id, id, tenant_app_id, user_id, shop_id , birthday, birthday_is_lunar, address, memorial_name, memorial_day , memorial_day_is_lunar, interest, grade_id, create_time, update_time , member_image_flag, member_image_time, info_is_perfect, erp_card_no) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?)|3|5|2||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 = ? AND gs.create_time >= ? AND gs.create_time <= ? AND ey.employee_name LIKE concat(?, ?, ?) ORDER BY sg.id DESC ) tmp_count|3|17|8||0|0|452204|150769|3|1|
|v4_employee|SELECT COUNT(*) FROM ( SELECT t.id AS task_id, task_type , if(task_type = ?, st.description, it.description) AS description , if(task_type = ?, st.quick_reply, it.quick_reply) AS quick_reply , task_name, member_id, member_name, member_mobile_no, member_sex , member_level, t.start_time, t.end_time , datediff(t.end_time, NULL) AS left_days, send_coupons , recv_coupons, st.coupons, t.accept_time, t.plan_arrival_shop_time, t.arrival_shop_time , t.trade_time FROM task_task t LEFT JOIN task_system_task_template st ON st.id = t.task_template_id AND st.tenant_id = ? AND st.tenant_app_id = ? LEFT JOIN task_invite_task_template it ON it.id = t.task_template_id AND it.tenant_id = ? AND it.tenant_app_id = ? WHERE t.status = ? AND task_type = ? AND task_template_id = ? AND shop_id = ? AND employee_id = ? AND finish_time IS NULL AND t.end_time > now() AND t.tenant_id = ? AND t.tenant_app_id = ? ) TOTAL|3|6|3||0|0|8441|7743|3|1|
|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.status = ?)|3|24|18||0|0|320277|106761|3|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_id = ? AND tenant_app_id = ? AND user_id = ? AND user_type = ? AND status = ?|3|3|1||0|0|0|0|0|0|
|employee|SELECT count(0) FROM employee.backlog t WHERE t.tenant_id = ? AND t.tenant_app_id = ? AND t.employee_id = ? AND t.begin_time >= ? AND t.expire_time < ? AND t.`status` != ? AND t.scene = ?|3|8|5||0|0|10048|5235|3|1|
|user_service|UPDATE tenant_member_info SET shop_id = ? WHERE tenant_id = ? AND id IN (?)|3|4|1||0|0|3|1|0|0|
||SELECT table_name, index_name, index_comment, index_type, non_unique , column_name, sub_part, collation, NULL AS expression FROM information_schema.statistics WHERE table_schema = ? AND index_schema = ? AND index_name COLLATE utf8_general_ci <> ? ORDER BY index_schema, table_name, index_name, seq_in_index|3|7|3||0|0|59746|29177|29097|14226|
|user_service|SELECT count(0) FROM ( 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.source_type = ? AND us.create_time >= ? AND us.create_time < ? AND us.from_id IS NOT NULL AND us.shop_id IS NOT NULL GROUP BY us.from_id ) table_count|3|6|3||0|0|11034|3681|3|1|
|v4_user|SELECT COUNT(*) AS total FROM member WHERE tenant_id = ? AND tenant_app_id = ?|3|6|3||0|0|117831|39277|3|1|
|v4_sales|SELECT id, sales_erp_id, sales_no, sales_date, member_erp_id , employee_erp_id, employee_name, assist_employee_erp_id, assist_employee_name, dept_erp_id , amount, sales_remark, receipts, sales_status, is_sales , busi_date, erp_create_time, recommend_id, post_time, tenant_id , tenant_app_id, create_time, update_time FROM erp_sales WHERE sales_no = ? AND tenant_id = ? AND tenant_app_id = ?|3|19|10||0|0|477656|159226|3|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|8298|2768|0|0|
|tenant|SELECT es.id, es.sales_date AS saledate, es.sales_no AS saleno, es.amount FROM tenant.erp_sales es WHERE tenant_id = ? AND tenant_wechatapp_id = ? AND member_erp_id = ? AND dept_erp_id = ? AND employee_erp_id = ? AND sales_status = ? AND is_sales = ? AND create_time > ? AND NOT EXISTS ( SELECT ? FROM tenant.sneak_guest sg JOIN tenant.sneak_guest_sales sgn ON sgn.sneak_guest_id = sg.id WHERE sg.tenant_app_id = ? AND es.id = sgn.sales_id AND user_id = ? )|3|3|1||0|0|95|90|2|2|
|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|3|5|3||0|0|130319|50589|3|1|
|coupon_service|INSERT INTO coupon_extend (id, tenant_id, tenant_app_id, coupon_id, remark , user_name, mobile_no, creator_user_id, creator_user_name, creator_mobile_no , product_name, exchange_shop, is_give, writeoff_user_id, writeoff_employee_id , writeoff_time, source_shop_id, source_user_id, source_user_type, member_source_shop , create_time, update_time) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?)|3|5|2||0|0|0|0|0|0|
|tenant|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 = ? AND gs.create_time >= ? AND gs.create_time <= ? AND sg.status = ? AND ey.employee_name LIKE concat(?, ?, ?) ORDER BY sg.id DESC LIMIT ?|3|62|22||0|0|452325|150775|9|3|
|order|SELECT ifnull(sum(if(od.status = ?, ?, ?)), ?) AS "2" , ifnull(sum(if(od.status = ?, ?, ?)), ?) AS "3" , ifnull(sum(if(od.status = ?, ?, ?)), ?) AS "4" , ifnull(sum(if(od.status = ?, ?, ?)), ?) AS "5" , 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.status = ?)|3|24|18||0|0|320277|106761|3|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|3|20|10||0|0|33825|15788|86|41|
|account|INSERT INTO account (id, tenant_id, tenant_app_id, account_type, owner_type , owner_id, balance, platform_balance, cumulation, status , create_time, update_time) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?)|3|3|1||0|0|0|0|0|0|
|user_service|select tenant_id, id, tenant_app_id, user_id, shop_id, birthday, birthday_is_lunar, address, memorial_name, memorial_day, memorial_day_is_lunar, interest, grade_id, create_time, update_time from tenant_member_info where tenant_id = ? and tenant_app_id = ? and user_id in (|3|3|1||0|0|9897|3952|9897|3952|
|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 user_id = ? AND user_type = ? AND status = ? AND create_shop_id = ? AND maintain_employee_id = ? ORDER BY id DESC|3|3|1||0|0|1|1|0|0|
|user_service|UPDATE wx_user SET wx_app_id = ?, open_id = ?, union_id = ?, nick_name = ?, user_name = ?, mobile_no = ?, is_subscribe = ?, subscribe_time = ?, unsubscribe_time = ?, wx_card_code = ?, sex = ?, country = ?, province = ?, city = ?, plat_open_id = ?, create_time = ?, update_time = ? WHERE id = ?|3|5|2||0|0|3|1|0|0|
|v4_sales|SELECT DISTINCT t1.sales_type FROM v4_sales.erp_sales_detail t1 LEFT JOIN v4_sales.erp_sales t2 ON t2.sales_erp_id = t1.sales_erp_id AND t2.tenant_id = t1.tenant_id AND t2.tenant_id = ? AND t2.tenant_app_id = ? WHERE ifnull(t1.sales_type, ?) != ? AND t2.member_erp_id = ? AND t2.sales_status = ? AND t2.is_sales = ? AND t1.tenant_id = ? AND t1.tenant_app_id = ?|3|8|3||0|0|136|136|6|6|
|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 = ? AND gs.create_time >= ? AND gs.create_time <= ? AND sg.create_shop_id = ? AND sg.status = ? ORDER BY sg.id DESC ) tmp_count|3|7|3||0|0|13950|4672|3|1|
|v4_sales|UPDATE erp_sales_extend1 SET sales_erp_id = ?, member_status = ?, first_sales = ?, tenant_id = ?, tenant_app_id = ?, create_time = ?, update_time = ? WHERE id = ? AND tenant_id = ? AND tenant_app_id = ?|3|4|1||0|0|3|1|0|0|
|v4_sales|UPDATE erp_sales SET sales_erp_id = ?, sales_no = ?, sales_date = ?, member_erp_id = ?, employee_erp_id = ?, employee_name = ?, dept_erp_id = ?, amount = ?, sales_remark = ?, receipts = ?, sales_status = ?, is_sales = ?, busi_date = ?, erp_create_time = ?, recommend_id = ?, post_time = ?, tenant_id = ?, tenant_app_id = ?, create_time = ?, update_time = ? WHERE id = ? AND tenant_id = ? AND tenant_app_id = ?|3|4|1||0|0|3|1|0|0|
|tenant|SELECT count(0) FROM employee t LEFT JOIN tenant_wechatapp_shop sp ON sp.tenant_id = t.tenant_id AND t.shop_id = sp.id LEFT JOIN tenant.erp_department ed ON ed.tenant_id = t.tenant_id AND ed.dept_erp_id = t.dept_erp_id WHERE t.tenant_id = ? AND t.status IN (?)|3|3|1||0|0|3291|1838|3|1|
|authorization_service|update user_login_token set status=? where login_token in (|3|12|7||0|0|4507|2322|0|0|
|v4_user|INSERT INTO employee_external_bind_log (id, external_user_id, corp_user_id, employee_id, dept_erp_id , oper_type, create_time, update_time, tenant_id) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?)|3|5|2||0|0|0|0|0|0|
|v4_sales|SELECT * FROM v4_sales.comment WHERE order_id = ? AND tenant_id = ? AND tenant_app_id = ? LIMIT ?|3|6|2||0|0|44644|14910|0|0|
||SELECT ordinal_position, column_name, column_type, column_default, generation_expression , table_name, column_comment, is_nullable, extra, collation_name FROM information_schema.columns WHERE table_schema = ? ORDER BY table_name, ordinal_position|3|4|1||0|0|99002|33016|49501|16508|
|v4_sales|SELECT rownum FROM ( SELECT erp_dept_id, average, @rank := @rank + ? AS rownum FROM ( SELECT erp_dept_id, round(avg(c.average_score), ?) AS average FROM v4_sales.comment c WHERE c.tenant_id = ? AND c.tenant_app_id = ? AND c.create_time BETWEEN ? AND ? GROUP BY c.erp_dept_id ) a, ( SELECT @rank := ? ) b ORDER BY average DESC ) r WHERE r.erp_dept_id = ?|3|6|2||0|0|44535|14857|2|1|
|tenant|select sp.tenant_id as tenantId, sp.tenant_app_id as tenantAppId, emp.employee_erp_id as employeeErpId, emp.id as employeeId, emp.employee_no as employeeNo, emp.employee_name as employeeName, emp.employee_type as employeeType, emp.head_img_url as headImgUrl, emp.sex, sp.`status`, emp.mobile_no as mobileNo, emp.corp_wx_user_id as corpWxUserId, tu.user_id as userId from employee emp join employee_shop sp on emp.id=sp.employee_id and sp.status=? left join employee_tenant_user tu on sp.tenant_app_id=tu.tenant_app_id and emp.id=tu.employee_id and tu.`status`= ? where sp.tenant_app_id = ? and emp.`status` = ? and emp.id in ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ...|3|3|1||0|0|4578|2544|494|242|
|v4_user|SELECT COUNT(*) AS total FROM member_butler WHERE shop_id = ? AND employee_id = ? AND tenant_id = ? AND tenant_app_id = ?|3|4|1||0|0|146228|73116|3|1|
|tenant|UPDATE erp_sales SET comment_id = ? WHERE tenant_id = ? AND id = ?|3|7|4||0|0|3|1|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_role2 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 (?)|3|7|4||0|0|191772|63930|33|16|
|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 tenant_id = ? AND login_way = ?|3|3|1||0|0|3|1|3|1|
|v4_user|INSERT INTO employee_external_bind (id, external_user_id, corp_user_id, employee_id, create_time , update_time, tenant_id) VALUES (?, ?, ?, ?, ? , ?, ?)|3|4|2||0|0|0|0|0|0|
|warranty_service|INSERT INTO warranty (id, tenant_wechatapp_id, user_id, erp_sales_id, warranty_no , is_disable, warranty_data, update_employee_id, employee_erp_id, dept_erp_id , sales_no, sales_date, style_id) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?)|3|4|1||0|0|0|0|0|0|
|v4_sales|SELECT DISTINCT t1.category_erp_id, t1.category_name FROM v4_sales.erp_sales_detail t1 LEFT JOIN v4_sales.erp_sales t2 ON t2.sales_erp_id = t1.sales_erp_id AND t2.tenant_id = t1.tenant_id AND t2.tenant_id = ? AND t2.tenant_app_id = ? WHERE ifnull(t1.category_name, ?) != ? AND t2.member_erp_id = ? AND t1.tenant_id = ? AND t1.tenant_app_id = ?|3|7|2||0|0|158|158|14|14|
|v4_employee|SELECT t.id AS task_id, task_type , if(task_type = ?, st.description, it.description) AS description , if(task_type = ?, st.quick_reply, it.quick_reply) AS quick_reply , task_name, member_id, member_name, member_mobile_no, member_sex , member_level, t.start_time, t.end_time , datediff(t.end_time, ?) AS left_days, send_coupons , recv_coupons, st.coupons, t.accept_time, t.plan_arrival_shop_time, t.arrival_shop_time , t.trade_time FROM task_task t LEFT JOIN task_system_task_template st ON st.id = t.task_template_id AND st.tenant_id = ? AND st.tenant_app_id = ? LEFT JOIN task_invite_task_template it ON it.id = t.task_template_id AND it.tenant_id = ? AND it.tenant_app_id = ? WHERE t.status = ? AND task_type = ? AND task_template_id = ? AND shop_id = ? AND employee_id = ? AND plan_arrival_shop_time >= ? AND plan_arrival_shop_time < ? AND plan_arrival_shop_time IS NOT NULL AND t.tenant_id = ? AND t.tenant_app_id = ? ORDER BY t.id DESC LIMIT ?|3|29|17||0|0|5154966|1718322|3|1|
|employee|SELECT id, tenant_id, tenant_app_id, scene, talk , create_time, update_time FROM backlog_talk WHERE tenant_id = ? AND tenant_app_id = ? AND scene = ? ORDER BY id|3|3|1||0|0|3807|1269|9|3|
|v4_employee|SELECT t.id AS task_id, task_type , if(task_type = ?, st.description, it.description) AS description , if(task_type = ?, st.quick_reply, it.quick_reply) AS quick_reply , task_name, member_id, member_name, member_mobile_no, member_sex , member_level, t.start_time, t.end_time , datediff(t.end_time, ?) AS left_days, send_coupons , recv_coupons, st.coupons, t.accept_time, t.plan_arrival_shop_time, t.arrival_shop_time , t.trade_time FROM task_task t LEFT JOIN task_system_task_template st ON st.id = t.task_template_id AND st.tenant_id = ? AND st.tenant_app_id = ? LEFT JOIN task_invite_task_template it ON it.id = t.task_template_id AND it.tenant_id = ? AND it.tenant_app_id = ? WHERE t.status = ? AND task_type = ? AND system_task_type = ? AND t.start_time <= ? AND t.end_time > ? AND shop_id = ? AND employee_id = ? AND finish_time IS NULL AND t.tenant_id = ? AND t.tenant_app_id = ? ORDER BY t.id DESC LIMIT ?|3|10|3||0|0|47040|15680|3|1|
|tenant|select sp.tenant_id as tenantId, sp.tenant_app_id as tenantAppId, emp.employee_erp_id as employeeErpId, emp.id as employeeId, emp.employee_no as employeeNo, emp.employee_name as employeeName, emp.employee_type as employeeType, emp.head_img_url as headImgUrl, emp.sex, sp.`status`, emp.mobile_no as mobileNo, emp.corp_wx_user_id as corpWxUserId, tu.user_id as userId from employee emp join employee_shop sp on emp.id=sp.employee_id and sp.status=? left join employee_tenant_user tu on sp.tenant_app_id=tu.tenant_app_id and emp.id=tu.employee_id and tu.`status`= ? where sp.tenant_app_id = ? and emp.`status` = ? and emp.id in ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ...|2|3|2||0|0|4876|3631|821|616|
|goods|SELECT * FROM goods WHERE tenant_id = ? AND style_no = ? AND status < ?|2|10|7||0|0|30880|15440|0|0|
|authorization_service|UPDATE user_login_token SET status = ? WHERE login_token IN (?)|2|2|1||0|0|62|61|0|0|
|tenant|SELECT es.id, es.sales_no, es.member_erp_id, es.sales_date, es.sales_erp_id , es.is_sales 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 = ? ORDER BY es.sales_date DESC, es.id DESC LIMIT ?|2|5|2||0|0|6384|3192|40|20|
|v4_sales|SELECT product_name, sales_type, amount_total, amount_pay, integral , quantity, remark FROM erp_sales_detail WHERE sales_erp_id = ? AND sales_type = ? AND tenant_id = ? AND tenant_app_id = ?|2|2|1||0|0|7|6|4|3|
|activity_service|SELECT count(*) FROM activity_signup_user_apply WHERE activity_id = ? AND audit_status IN (?)|2|3|2||0|0|4898|2449|2|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 = ? AND ar.role_code IN (?)|2|2|1||0|0|127831|63919|2|1|
|employee|SELECT count(*) FROM employee.backlog t WHERE t.tenant_app_id = ? AND t.shop_id = ? AND t.employee_id = ? AND t.scene = ? AND t.user_id = ? AND t.user_type = ?|2|3|2||0|0|1|1|2|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 ?|2|7|4||0|0|816167|408093|9|6|
|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|14|8||0|0|867514|434173|194|97|
|export|SELECT count(0) FROM export_log el INNER JOIN export_file ef ON el.tenant_app_id = ef.tenant_app_id AND el.batch_no = ef.batch_no AND el.md5_key = ef.md5_key AND el.export_code = ef.export_code WHERE el.tenant_app_id = ? AND el.employee_id = ? AND el.batch_no BETWEEN ? AND ? AND ef.export_code IN (?)|2|3|2||0|0|108631|54317|2|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_app_user_id = ? AND tenant_id = ? AND tenant_wx_app_id = ? AND login_way = ? AND expire_time > now() AND status = ? AND user_id = ?|2|3|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.corp_wx_user_id, t.sex , t.mobile_no AS mobileno, t.head_img_url AS headimgurl, t.dept_erp_id, t.status FROM employee t LEFT JOIN tenant_wechatapp_shop sp ON t.shop_id = sp.id WHERE t.tenant_id = ? AND t.status != ?|2|3|2||0|0|5960|2980|2782|1391|
|v4_sales|SELECT * FROM tenant.erp_sales WHERE tenant_id = ? AND sales_erp_id = ?|2|168|136||0|0|1060560|530280|2|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 ?|2|11|8||0|0|2022650|1011325|0|0|
|user_service|INSERT INTO tenant_member_bind (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) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?)|2|2|1||0|0|0|0|0|0|
|coupon_service|SELECT count(0) FROM ( SELECT c.id, c.coupon_name, c.coupon_type , if(c.coupon_type IN (?), c.face_value, round(c.face_value / ?, ?)) AS faceValue , round(c.discount / ?, ?) AS discount , c.begin_time, c.end_time, c.wx_card_id, c.wx_card_no, c.template_id , round(c.use_threshold / ?) AS useThreshold , round(c.balance / ?, ?) AS balance , t.scope, ce.product_name , CASE  WHEN c.end_time < now() AND c.coupon_state != ? THEN ? WHEN c.begin_time > now() THEN ? ELSE c.coupon_state END AS state FROM coupon_service.coupon c JOIN coupon_service.coupon_extend ce ON ce.id = c.id JOIN coupon_service.template t ON t.id = c.template_id WHERE c.tenant_app_id = ? AND c.user_id = ? AND c.end_time >= ? ) c|2|3|2||0|0|102|102|2|1|
|erp_sync|UPDATE retry_data SET tenant_id = ?, tenant_app_id = ?, business_type = ?, operation_type = ?, data_id = ?, user_id = ?, erp_member_id = ?, need_erp_member_id = ?, retry_times = ?, msg = ?, send_time = ?, create_time = ?, update_time = ?, data = ? WHERE id = ?|2|3|2||0|0|2|1|0|0|
|gift_mail|SELECT * FROM gift_mail.platform_product_desc WHERE product_id = ? LIMIT ?|2|3|1||0|0|3732|1866|2|1|
|corpwx|COMMIT ?|2|3|1||0|0|0|0|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 (?, ?, ?, ?, ? , ?, ?, ?, ?)|2|2|1||0|0|0|0|0|0|
|v4_employee|SELECT t.id AS task_id, task_type , if(task_type = ?, st.description, it.description) AS description , if(task_type = ?, st.quick_reply, it.quick_reply) AS quick_reply , task_name, member_id, member_name, member_mobile_no, member_sex , member_level, t.start_time, t.end_time , datediff(t.end_time, NULL) AS left_days, send_coupons , recv_coupons, st.coupons, t.accept_time, t.plan_arrival_shop_time, t.arrival_shop_time , t.trade_time FROM task_task t LEFT JOIN task_system_task_template st ON st.id = t.task_template_id AND st.tenant_id = ? AND st.tenant_app_id = ? LEFT JOIN task_invite_task_template it ON it.id = t.task_template_id AND it.tenant_id = ? AND it.tenant_app_id = ? WHERE t.status = ? AND task_type = ? AND task_template_id = ? AND shop_id = ? AND employee_id = ? AND (member_mobile_no = ? OR member_name LIKE concat(?, ?, ?)) AND finish_time IS NULL AND t.end_time > now() AND t.tenant_id = ? AND t.tenant_app_id = ? ORDER BY t.id DESC LIMIT ?|2|9|7||0|0|721902|360954|20|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 task_template_id = ? AND tenant_id = ? AND tenant_app_id = ?|2|8|4||0|0|5514|2757|2|1|
|employee|UPDATE backlog SET leave_flag = ? WHERE tenant_app_id = ? AND employee_id = ?|2|5|3||0|0|1826|1012|0|0|
|sms|SELECT ifnull(sum(ifnull(t2.sms_size, ?) * t1.send_count), ?) AS amount FROM sms_send t1 LEFT JOIN sms.sms_send_extend t2 ON t1.biz_id = t2.biz_id WHERE t1.tenant_app_id = ? AND t1.code = ? AND t1.create_time >= ? AND t1.create_time < ?|2|2|1||0|0|1130|566|2|1|
|v4_user|SELECT COUNT(*) AS total FROM member_import WHERE import_status = ? AND tenant_id = ?|2|21|16||0|0|78572|39286|2|1|
|v4_user|SELECT t1.shouldMaintain, t2.maintained FROM ( SELECT count(*) AS shouldMaintain FROM v4_user.potential_customer t1 JOIN v4_user.potential_customer_follow t2 ON t1.id = t2.potential_customer_id AND t2.tenant_id = ? AND t2.tenant_app_id = ? WHERE t2.should_maintain_shop_id = ? AND t2.is_required = ? AND (t1.finish_time IS NULL OR t1.finish_time >= ?) AND t2.should_maintain_date >= ? AND t2.should_maintain_date < ? AND t1.tenant_id = ? AND t1.tenant_app_id = ? ) t1, ( SELECT count(DISTINCT pcm.potential_customer_id) AS maintained FROM v4_user.potential_customer_maintain pcm WHERE pcm.maintain_shop_id = ? AND pcm.event_type IN (?) AND pcm.create_time >= ? AND pcm.create_time < ? AND pcm.tenant_id = ? AND pcm.tenant_app_id = ? ) t2|2|2|1||0|0|134|67|2|1|
|v4_sales|SELECT * FROM v4_sales.erp_sales_detail WHERE sales_erp_id = ? AND product_barcode = ? AND tenant_id = ? AND tenant_app_id = ?|2|3|1||0|0|2|1|2|1|
|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 (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))) AND id IN (?) AND user_id = ? AND tenant_wechatapp_id = ?|2|3|2||0|0|2|1|0|0|
|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 ?|2|2|1||0|0|44205|44205|0|0|
|v4_user|UPDATE wx_user SET app_type = ?, app_id = ?, open_id = ?, union_id = ?, nick_name = ?, head_img_url = ?, is_subscribe = ?, subscribe_time = ?, cancel_subscribe_time = ?, sex = ?, country = ?, province = ?, city = ?, member_id = ?, logout = ? WHERE id = ?|2|3|1||0|0|2|1|0|0|
|h5link|SELECT id, tenant_wechatapp_id, func_id, link_url, app_link_url , link_text, link_image_url, detail_id, create_time, update_time FROM h5_link WHERE tenant_wechatapp_id = ? AND link_url = ?|2|4|2||0|0|1073|537|1|1|
|sms|INSERT INTO sms_report (id, phone_number, success, biz_id, out_id , send_time, report_time, err_code, err_msg, sms_size , create_time) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?)|2|3|2||0|0|0|0|0|0|
|warranty_service|SELECT count(0) FROM warranty WHERE user_id = ? AND tenant_wechatapp_id = ? AND is_disable = ? AND erp_sales_id NOT IN (?)|2|2|1||0|0|20|14|2|1|
|corpwx_license|UPDATE active_employee SET lic_base_activated = ?, lic_base_active_code = NULL, lic_base_expire_time = NULL, lic_external_activated = ?, lic_external_active_code = NULL, lic_external_expire_time = NULL WHERE corp_wx_user_id = ? AND tenant_id = ?|2|3|1||0|0|45478|22740|0|0|
|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 ? LIMIT ?|2|2|1||0|0|0|0|0|0|
|v4_sales|INSERT INTO erp_sales (id, sales_erp_id, sales_no, sales_date, member_erp_id , employee_erp_id, employee_name, dept_erp_id, amount, sales_remark , receipts, sales_status, is_sales, busi_date, recommend_id , post_time, create_time, update_time, tenant_id, tenant_app_id) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ?)|2|4|2||0|0|0|0|0|0|
|user_service|UPDATE tenant_member_info SET tenant_app_id = ?, user_id = ?, shop_id = ?, birthday_is_lunar = ?, address = ?, memorial_name = ?, memorial_day_is_lunar = ?, grade_id = ?, create_time = ?, update_time = ?, member_image_flag = ?, info_is_perfect = ?, erp_card_no = ? WHERE tenant_id = ? AND id = ?|2|4|2||0|0|2|1|0|0|
|tenant|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 = ? AND sg.create_shop_id = ? AND sg.status = ? ORDER BY sg.id DESC LIMIT ?|2|39|25||0|0|1499718|749859|18|9|
|v4_sales|SELECT s.* , if(va.id IS NOT NULL, ?, ?) AS hasAdded FROM ( SELECT max(es.sales_no) AS sales_no, max(es.id) AS id , max(es.sales_date) AS sales_date, max(es.member_erp_id) AS memberId , max(es.sales_erp_id) AS erpSalesId, esd.product_barcode , max(esd.product_name) AS product_name, max(category_erp_id) AS category_erp_id , max(category_name) AS category_name, sum(amount_total) AS amount_total , sum(amount_pay) AS amount_pay, count(esd.id) AS quantity 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 = ? LEFT JOIN v4_sales.value_added_ignore i ON i.erp_sales_id = es.sales_erp_id AND i.product_barcode = esd.product_barcode AND i.tenant_id = ? AND i.tenant_app_id = ? WHERE es.sales_status = ? AND is_sales = ? AND i.id IS NULL AND es.dept_erp_id = ? AND es.employee_erp_id = ? AND es.tenant_id = ? AND es.tenant_app_id = ? GROUP BY esd.product_barcode ) s LEFT JOIN v4_sales.value_added va ON va.product_barcode = s.product_barcode AND va.tenant_id = ? AND va.tenant_app_id = ? ORDER BY s.sales_date DESC, s.id DESC LIMIT ?|2|46|26||0|0|4178|2089|20|10|
|timer|UPDATE task_info SET service = ?, name = ?, callback = ?, params = ?, cron = ?, delay = NULL, next_time = NULL, status = ?, create_time = ?, update_time = ? WHERE id = ?|2|2|1||0|0|2|1|0|0|
|v4_user|SELECT member_id FROM member_butler WHERE shop_id = ? AND employee_id = ? AND tenant_id = ? AND tenant_app_id = ?|2|5|3||0|0|13254|6728|13254|6728|
|goods|SELECT count(0) FROM ( SELECT gs.id, gs.tenant_id, gs.tenant_app_id, gs.category_id, gs.activity_id , gs.goods_name, gs.style_no, gs.base_sale_number, gs.limit_sale , if(gs.status = ?, gs.status, if(t.id IS NULL, ?, ?)) AS status , gs.thumbnail_img, gs.express_type, gs.take_stock_day, gs.take_remark, gs.express_fee , gs.create_time, gs.update_time, gs.sale_type, gs.take_start_time, gs.page_id , gs.pay_way, gs.advance_payment, gs.exchange_money , ifnull(sku.minPrice, ?) AS minPrice , ifnull(sku.marketPrice, ?) AS marketPrice , ifnull(sku.totalSalesVolume, ?) AS totalSalesVolume , ifnull(sku.totalQuantity, ?) AS totalQuantity , ifnull(number, ?) AS skuNumber, gs.topping FROM goods.goods gs LEFT JOIN ( SELECT id, goods_id FROM goods.goods_up_app gu WHERE gu.tenant_app_id = ? ) t ON gs.id = t.goods_id LEFT JOIN ( SELECT goods_id, min(price) AS minPrice, max(market_price) AS marketPrice , sum(sales_volume) AS totalSalesVolume, sum(quantity) AS totalQuantity , count(*) AS number FROM goods.goods_sku WHERE activity_id = ? GROUP BY tenant_id, goods_id ) sku ON sku.goods_id = gs.id WHERE gs.tenant_id = ? AND gs.status < ? ORDER BY gs.topping DESC, sku.totalSalesVolume DESC, gs.id DESC ) tmp_count|2|8|7||0|0|131337|65769|2|1|
|tenant|INSERT INTO erp_sales_extend1 (tenant_id, id, tenant_app_id, sales_erp_id, member_status , first_sales, post_time) VALUES (?, ?, ?, ?, ? , ?, ?) ON DUPLICATE KEY UPDATE member_status = ?, first_sales = ?, post_time = ?|2|2|1||0|0|0|0|0|0|
|activity_service|SELECT id, tenant_id, tenant_app_id, activity_id, sign_user_id , user_id, create_time, update_time FROM online_sign_user_sign_log WHERE tenant_app_id = ? AND user_id = ?|2|4|2||0|0|890830|445415|368|184|
|goods|SELECT count(0) FROM ( SELECT gs.id, gs.tenant_id, gs.tenant_app_id, gs.category_id, gs.activity_id , gs.goods_name, gs.style_no, gs.base_sale_number, gs.limit_sale , if(gs.status = ?, gs.status, if(t.id IS NULL, ?, ?)) AS status , gs.thumbnail_img, gs.express_type, gs.take_stock_day, gs.take_remark, gs.express_fee , gs.create_time, gs.update_time, gs.sale_type, gs.take_start_time, gs.page_id , gs.pay_way, gs.advance_payment, gs.exchange_money , ifnull(sku.minPrice, ?) AS minPrice , ifnull(sku.marketPrice, ?) AS marketPrice , ifnull(sku.totalSalesVolume, ?) AS totalSalesVolume , ifnull(sku.totalQuantity, ?) AS totalQuantity , ifnull(number, ?) AS skuNumber, gs.topping FROM goods.goods gs LEFT JOIN ( SELECT id, goods_id FROM goods.goods_up_app gu WHERE gu.tenant_app_id = ? ) t ON gs.id = t.goods_id LEFT JOIN ( SELECT goods_id, min(price) AS minPrice, max(market_price) AS marketPrice , sum(sales_volume) AS totalSalesVolume, sum(quantity) AS totalQuantity , count(*) AS number FROM goods.goods_sku WHERE activity_id = ? GROUP BY tenant_id, goods_id ) sku ON sku.goods_id = gs.id WHERE gs.tenant_id = ? AND t.id IS NULL AND gs.status != ? ORDER BY gs.topping DESC, sku.totalSalesVolume DESC, gs.id DESC ) tmp_count|2|8|7||0|0|131077|65539|2|1|
|v4_sales|SELECT * FROM v4_sales.erp_sales WHERE tenant_id = ? AND sales_no = ?|2|24|21||0|0|1020483|510250|2|1|
|coupon_service|SELECT id, tenant_id, tenant_app_id, template_id, coupon_push_id , coupon_no, coupon_state, user_id, coupon_name, coupon_type , face_value, discount, use_threshold, balance, begin_time , end_time, wx_card_id, wx_card_no, source, source_id , business_id, create_time, update_time FROM coupon WHERE tenant_id = ? AND tenant_app_id = ? AND user_id = ? AND template_id IN (?) AND coupon_state = ? AND begin_time <= ? AND end_time > ?|2|2|1||0|0|0|0|0|0|
|tenant|SELECT es.sales_date, ed.dept_name, es.employee_name, ee.mobile_no, es.sales_erp_id FROM erp_sales es LEFT JOIN erp_department ed ON es.dept_erp_id = ed.dept_erp_id AND ed.tenant_id = es.tenant_id LEFT JOIN erp_employee ee ON es.employee_erp_id = ee.employee_erp_id AND ee.tenant_id = es.tenant_id WHERE es.sales_erp_id = ? AND es.tenant_id = ? AND es.tenant_wechatapp_id = ?|2|3|1||0|0|2|1|2|1|
|v4_sales|INSERT INTO erp_sales_detail (id, sales_index, sales_erp_id, sales_type, product_barcode , product_name, cert_no, hand_size, category_erp_id, category_name , stone_weight, gold_weight, total_weight, quantity, amount_total , amount_pay, integral, remark, sales_brand, sales_craft , create_time, update_time, tenant_id, tenant_app_id) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?)|2|3|1||0|0|0|0|0|0|
|user_service|UPDATE tenant_member SET tenant_app_id = ?, user_id = ?, mobile_no = ?, user_name = ?, head_img_url = ?, sex = ?, status = ?, create_time = ?, update_time = ? WHERE tenant_id = ? AND id = ?|2|3|2||0|0|2|1|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 = ? AND sg.create_shop_id = ? AND sg.status = ? ORDER BY sg.id DESC ) tmp_count|2|5|3||0|0|20390|14565|2|1|
|v4_user|UPDATE member SET head_img_url = ?, wx_union_id = NULL, mini_open_id = NULL, h5_open_id = ?, wx_card_code = ?, external_user_id = NULL WHERE id = ? AND tenant_id = ? AND tenant_app_id = ?|2|4|2||0|0|2|1|0|0|
|tenant|SELECT count(0) FROM tenant.sneak_guest_maintain s JOIN tenant.sneak_guest sg ON sg.tenant_id = s.tenant_id AND sg.tenant_app_id = s.tenant_app_id AND sg.id = s.sneak_guest_id JOIN tenant.employee e ON e.tenant_id = s.tenant_id AND e.id = s.employee_id WHERE s.tenant_id = ? AND s.tenant_app_id = ? AND sg.create_shop_id = ? AND s.event_type = ? AND s.create_time BETWEEN ? AND ?|2|9|8||0|0|4254|2995|2|1|
|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 = ?|2|12|10||0|0|51450|25725|2|1|
|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 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 = ?|2|20|16||0|0|75622|37811|2|1|
|gift_mail|SELECT count(*) FROM gift_mail.trade WHERE tenant_wechatapp_id = ? AND trade_type = ?|2|3|1||0|0|4897|2449|2|1|
|v4_sales|SELECT erp_employee_id FROM comment WHERE erp_dept_id = ? AND create_time BETWEEN ? AND ? AND tenant_id = ? AND tenant_app_id = ? GROUP BY erp_employee_id|2|3|2||0|0|29673|14837|1|1|
|tenant|select sp.tenant_id as tenantId, sp.tenant_app_id as tenantAppId, emp.employee_erp_id as employeeErpId, emp.id as employeeId, emp.employee_no as employeeNo, emp.employee_name as employeeName, emp.employee_type as employeeType, emp.head_img_url as headImgUrl, emp.sex, sp.`status`, emp.mobile_no as mobileNo, emp.corp_wx_user_id as corpWxUserId, tu.user_id as userId from employee emp join employee_shop sp on emp.id=sp.employee_id and sp.status=? left join employee_tenant_user tu on sp.tenant_app_id=tu.tenant_app_id and emp.id=tu.employee_id and tu.`status`= ? where sp.tenant_app_id = ? and emp.`status` = ? and emp.id in ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ...|2|9|6||0|0|6931|4284|583|392|
|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 tenant_id = ? AND tenant_app_id = ?|2|2|1||0|0|601|301|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 ?|2|3|2||0|0|4448|2575|2|1|
|v4_sales|SELECT count(DISTINCT es.id) 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 = ? WHERE es.dept_erp_id = ? AND es.employee_erp_id = ? AND es.sales_status = ? AND es.is_sales = ? AND es.sales_date BETWEEN ? AND ? AND es.tenant_id = ? AND es.tenant_app_id = ?|2|10|5||0|0|2397|2027|2|1|
|employee|INSERT INTO backlog (id, tenant_id, tenant_app_id, user_id, user_type , employee_id, status, scene, begin_time, expire_time , md5_str, shop_id, member_erp_id, task_amount, finish_amount) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE task_amount = ?, finish_time = if(? > finish_amount, NULL, finish_time), status = if(? > finish_amount, ?, status), update_time = now()|2|3|2||0|0|0|0|0|0|
|goods|SELECT * FROM goods_category WHERE status = ? AND tenant_id = ? ORDER BY create_time DESC|2|2|1||0|0|8490|4252|62|38|
|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 = ?)|2|5|4||0|0|177920|88962|2|1|
|tenant|SELECT t1.id, t3.shop_name AS createShopName, t2.employee_name AS createEmployeeName, t1.create_time AS createTime, t1.intention_info AS intentionInfo FROM tenant.sneak_guest_maintain t1 JOIN tenant.employee t2 ON t1.employee_id = t2.id JOIN tenant.tenant_wechatapp_shop t3 ON t1.shop_id = t3.id WHERE t1.tenant_app_id = ? AND t1.sneak_guest_id = ? AND t1.event_type = ? ORDER BY id DESC|2|2|1||0|0|6|3|2|1|
|order|SELECT max(create_time) FROM `order`.order_operator_log WHERE tenant_wechatapp_id = ? AND order_id = ?|2|5|3||0|0|2022682|1011355|2|1|
|gift_mail|SELECT count(0) 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 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 p.product_status = ? ORDER BY i.volume ASC, p.tag_price ASC, p.id DESC ) tmp_count|2|2|1||0|0|14524|7262|2|1|
|tenant|SELECT count(0) FROM sneak_guest_maintain gm LEFT JOIN tenant_wechatapp_shop ws ON gm.shop_id = ws.id LEFT JOIN employee ey ON gm.employee_id = ey.id WHERE gm.tenant_app_id = ? AND gm.sneak_guest_id = ? AND gm.event_type IN (?)|2|2|1||0|0|2|1|2|1|
|user_service|UPDATE wx_user SET wx_app_id = ?, open_id = ?, union_id = ?, nick_name = ?, is_subscribe = ?, subscribe_time = ?, unsubscribe_time = ?, sex = ?, country = ?, province = ?, city = ?, plat_open_id = ?, create_time = ?, update_time = ? WHERE id = ?|2|3|2||0|0|2|1|0|0|
|employee|UPDATE backlog SET status = ?, finish_time = now() WHERE tenant_app_id = ? AND employee_id = ? AND status IN (?) AND shop_id = ?|2|5|3||0|0|799|430|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|2|1||0|0|112483|87964|45|38|
|corpwx_license|SELECT id, employee_id, corp_wx_user_id, lic_base_activated, lic_base_active_code , lic_base_expire_time, lic_external_activated, lic_external_active_code, lic_external_expire_time, tenant_id , create_time, update_time FROM active_employee WHERE corp_wx_user_id IN (?) AND tenant_id = ?|2|3|1||0|0|45483|22743|10|10|
|tenant|SELECT count(0) FROM ( SELECT sg.id, sneak_guest_no, sg.status, sg.user_id, sg.user_type , smg.time , if(sg.status = ?, e.employee_name, ?) AS maintainEmployeeName , smg._count AS maintainNum, sg.update_employee_id FROM tenant.sneak_guest sg JOIN tenant.employee e ON e.id = sg.maintain_employee_id JOIN ( SELECT sneak_guest_id, count(*) AS _count, min(create_time) AS time FROM tenant.sneak_guest_maintain WHERE tenant_id = ? AND tenant_app_id = ? AND shop_id = ? AND employee_id = ? AND event_type IN (?) AND create_time BETWEEN ? AND ? GROUP BY sneak_guest_id ) smg ON smg.sneak_guest_id = sg.id WHERE sg.tenant_id = ? AND sg.tenant_app_id = ? AND (sg.fail_type IS NULL OR sg.fail_type = ?) ) tmp_count|2|24|13||0|0|147702|73867|2|1|
|goods|DELETE FROM goods_img WHERE tenant_id = ? AND goods_id = ?|2|12|6||0|0|54354|27177|0|0|
|v4_sales|SELECT COUNT(*) FROM ( SELECT c.order_id, c.id AS commentId, c.create_time AS commentTime, c.member_id, c.average_score AS average , if(c.average_score < c.low_score AND 1 = 1, ?, ?) AS hasHandle , if(cls.id IS NULL, ?, ?) AS handleLowScore FROM v4_sales.comment c LEFT JOIN v4_sales.comment_low_score_handle cls ON cls.comment_id = c.id AND cls.tenant_id = ? AND cls.tenant_app_id = ? WHERE c.erp_dept_id = ? AND c.create_time BETWEEN ? AND ? AND c.average_score < c.low_score AND cls.id IS NULL AND c.tenant_id = ? AND c.tenant_app_id = ? ) TOTAL|2|2|1||0|0|29740|14904|2|1|
|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 = ? AND t1.employee_name LIKE concat(?, ?, ?) ORDER BY sg.id DESC ) tmp_count|2|13|10||0|0|809268|408762|2|1|
|corpwx|INSERT INTO external_user_bind (id, tenant_id, tenant_app_id, external_user_id, wx_user_id) VALUES (?, ?, ?, ?, ?)|1|1|1||0|0|0|0|0|0|
|payment|UPDATE pay_order SET goods_order_no = ?, fee_type = ?, user_sub_identify = ?, order_start_time = ?, order_expire_time = ?, prepay_id = ?, pay_status = ?, pay_status_desc = ?, wxappid = ?, sub_wxappid = ?, mch_id = ?, sub_mch_id = ? WHERE id = ?|1|1|1||0|0|1|1|0|0|
|order|SELECT count(*) AS amount FROM order_info od LEFT JOIN order_address oa ON od.id = oa.order_id WHERE od.tenant_wechatapp_id = ? AND od.status = ? AND od.confirm_time IS NULL|1|1|1||0|0|894|894|1|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 a.employee_id IN (?)|1|1|1||0|0|63943|63943|14|14|
|v4_user|UPDATE wx_user SET app_type = ?, app_id = ?, open_id = ?, nick_name = ?, mobile_no = ?, head_img_url = ?, is_subscribe = ?, wx_card_code = ?, sex = ?, member_id = ?, external_user_id = ?, logout = ? WHERE id = ?|1|1|1||0|0|1|1|0|0|
|v4_user|SELECT id FROM potential_customer WHERE status IN (?) AND next_maintain_time < ? AND tenant_id = ? AND tenant_app_id = ?|1|3|3||0|0|20208|20208|439|439|
|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|5|5||0|0|74180|74180|5|5|
|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|452584|452584|562|562|
|goods|SELECT * FROM goods_sku WHERE goods_id = ? AND activity_id = ? ORDER BY create_time DESC|1|1|1||0|0|21134|21134|1|1|
|v4_user|SELECT t1.id, t1.external_user_id AS externalUserId, t1.checkin_time, t1.maintain_num AS maintainNum , if(t2.event_type = ?, t1.next_maintain_time, NULL) AS nextMaintainTime , t2.event_type AS `status` , CASE t2.event_type WHEN ? THEN ? WHEN ? THEN ? ELSE ? END AS statusName, t2.create_time AS maintainTime FROM potential_customer_maintain t2 JOIN potential_customer t1 ON t1.id = t2.potential_customer_id AND t1.tenant_id = ? AND t1.tenant_app_id = ? WHERE t2.maintain_shop_id = ? AND t2.maintain_employee_id = ? AND t2.create_time >= ? AND t2.create_time < ? AND t2.event_type IN (?) AND t2.tenant_id = ? AND t2.tenant_app_id = ? ORDER BY t2.id LIMIT ?|1|9|9||0|0|280969|280969|10|10|
|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|8|8|1|1|
|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.scene = ? AND bg.leave_flag = ? ORDER BY id DESC LIMIT ?|1|2|2||0|0|213795|213795|7|7|
|user_service|UPDATE wx_user SET wx_app_id = ?, open_id = ?, union_id = ?, nick_name = ?, is_subscribe = ?, subscribe_time = ?, unsubscribe_time = ?, sex = ?, country = ?, province = ?, city = ?, create_time = ?, update_time = ? WHERE id = ?|1|1|1||0|0|1|1|0|0|
|erp_app|INSERT INTO app_status (id, tenant_id, app_name, version, pid) VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE version = ?, pid = ?, online_status_time = ?|1|1|1||0|0|0|0|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|6|6||0|0|21008|21008|400|400|
|tenant|SELECT t1.id, t1.sales_erp_id, t1.product_name, t1.product_barcode, t1.sales_type , t1.category_name, t1.gold_weight, t1.stone_weight, t1.total_weight, t1.remark , t1.amount_total AS amount_pay, t1.amount_total, t1.quantity, t2.sales_brand, t2.sales_craft , t3.sales_no, t3.sales_date, t3.employee_name, t3.sales_remark FROM erp_sales_detail t1 LEFT JOIN erp_sales_detail_extend t2 ON t2.tenant_id = t1.tenant_id AND t2.tenant_wechatapp_id = t1.tenant_wechatapp_id AND t2.sales_erp_id = t1.sales_erp_id AND t2.sales_index = t1.sales_index LEFT JOIN erp_sales t3 ON t3.tenant_id = t1.tenant_id AND t3.tenant_wechatapp_id = t1.tenant_wechatapp_id AND t3.sales_erp_id = t1.sales_erp_id WHERE t1.tenant_id = ? AND t1.tenant_wechatapp_id = ? AND t3.tenant_id = t1.tenant_id AND t3.tenant_wechatapp_id = t1.tenant_wechatapp_id AND t3.member_erp_id = ? AND t3.sales_status = ? AND t3.is_sales = ? ORDER BY t1.id DESC LIMIT ?|1|1|1||0|0|584|584|10|10|
|order|SELECT ifnull(sum(ifnull(dt.quantity, ?)), ?) AS amount FROM `order`.order_info od LEFT JOIN `order`.order_detail dt ON od.id = dt.order_id WHERE od.tenant_wechatapp_id = ? AND od.user_id = ? AND od.status > ? AND dt.product_id = ? AND activity_id = ?|1|1|1||0|0|34|34|1|1|
|message_push|insert into message_log ( id, tenant_id, tenant_app_id, user_id, scene_type, msg_id, post_data, create_time, update_time ) values (|1|1|1||0|0|0|0|0|0|
|mysql|DELETE FROM wx_gateway.wx_template_msg WHERE create_time < DATE_SUB(now(), INTERVAL ? DAY)|1|30|30||0|0|876394|876394|0|0|
|gift_mail|SELECT * FROM trade WHERE tenant_wechatapp_id = ? AND user_id = ? ORDER BY create_time DESC LIMIT ?|1|1|1||0|0|12994|12994|4|4|
|order|SELECT count(0) FROM order_info od LEFT JOIN order_detail dt ON od.id = dt.order_id LEFT JOIN order_address dd ON od.id = dd.order_id WHERE od.tenant_wechatapp_id = ? AND od.status = ? AND od.confirm_time IS NULL|1|1|1||0|0|1329|1329|1|1|
|v4_user|UPDATE member SET wx_union_id = NULL, mini_open_id = NULL, h5_open_id = ?, wx_card_code = ?, external_user_id = NULL WHERE id = ? AND tenant_id = ? AND tenant_app_id = ?|1|1|1||0|0|1|1|0|0|
|employee|SELECT tenant_id, tenant_app_id, employee_id, shop_id, scene , record FROM backlog_report WHERE tenant_app_id = ? AND employee_id = ? AND shop_id = ?|1|1|1||0|0|1|1|1|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|1|2|2||0|0|8880|8880|1|1|
|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 id = ?|1|1|1||0|0|1|1|1|1|
|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.tenant_id = ? AND t.tenant_app_id = ?|1|3|3||0|0|481158|481158|1|1|
|tenant|SELECT count(0) FROM sneak_guest WHERE tenant_app_id = ? AND create_shop_id = ? AND status = ? AND next_maintain_date >= ? AND next_maintain_date < ?|1|1|1||0|0|2160|2160|1|1|
|user_service|SELECT tm.tenant_id, tm.tenant_app_id, tm.user_id, tm.mobile_no, tm.sex , tm.user_name, tm.head_img_url, tmi.birthday, tmi.birthday_is_lunar, tmi.shop_id , tmi.memorial_day_is_lunar, tmi.memorial_day, tmi.memorial_name, tmi.interest, tmi.address 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 = ?) ORDER BY tm.id LIMIT ?|1|5|5||0|0|308105|308105|1|1|
|v4_user|INSERT INTO wx_user (id, app_type, app_id, open_id, sex) VALUES (?, ?, ?, ?, ?)|1|1|1||0|0|0|0|0|0|
|user_service|SELECT count(0) FROM ( SELECT us.shop_id AS id, count(1) AS total FROM user_source us WHERE us.tenant_id = ? AND us.tenant_wechatapp_id = ? AND us.source_type = ? AND us.from_id IS NOT NULL AND us.shop_id IS NOT NULL AND us.create_time >= ? AND us.create_time < ? GROUP BY us.shop_id ) table_count|1|3|3||0|0|3732|3732|1|1|
|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|213795|213795|6|6|
|gift_mail|SELECT * FROM gift_mail.trade_express WHERE trade_id = ? LIMIT ?|1|1|1||0|0|12039|12039|0|0|
|user_service|UPDATE user_service.wx_user SET mobile_no = ?, user_name = ? WHERE id = ?|1|1|1||0|0|1|1|0|0|
|activity_service|SELECT count(0) FROM activity_service.user_trace ut JOIN activity_service.activity tt ON ut.activity_id = tt.id JOIN activity_service.group_buy_activity gb ON ut.activity_id = gb.activity_id JOIN activity_service.activity_goods ag ON tt.id = ag.activity_id WHERE ut.tenant_app_id = ? AND ut.user_id = ? AND ut.step = ? AND tt.status = ? AND now() BETWEEN tt.start_time AND tt.end_time|1|1|1||0|0|726|726|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|3720|3720|0|0|
|user_service|EXPLAIN SELECT  `id` FROM `user_service`.`user_employee` FORCE INDEX (`PRIMARY`) WHERE `id` >= ? ORDER BY `id` LIMIT ?, ?|1|1|1||0|0|0|0|1|1|
|v4_user|UPDATE member_grade SET grade_id = ?, user_id = ?, sale_number = ?, sale_amount = ?, sale_points = ?, tenant_id = ?, tenant_app_id = ?, create_time = ?, update_time = ? WHERE id = ? AND tenant_id = ? AND tenant_app_id = ?|1|2|2||0|0|1|1|0|0|
|v4_user|UPDATE potential_customer SET intention_num = ?, latest_intention = ?, update_time = ? WHERE id = ? AND tenant_id = ? AND tenant_app_id = ?|1|2|2||0|0|1|1|0|0|
|v4_sales|SELECT * FROM v4_sales.erp_sales_detail WHERE sales_erp_id = ?|1|6|6||0|0|90274|90274|0|0|
|warranty_service|SELECT id, tenant_wechatapp_id, user_id, erp_sales_id, update_user_id , warranty_no, is_disable, create_time, update_time, v2_img_url , upload_frequency, employee_erp_id, dept_erp_id, sales_no, sales_date , update_employee_id, style_id, warranty_data FROM warranty WHERE id = ?|1|1|1||0|0|1|1|1|1|
|tenant|SELECT ee.id AS employeeId, ee.employee_erp_id AS employeeErpId, ee.employee_name AS employeeName, ee.mobile_no AS mobileNo, ee.corp_wx_user_id AS corpWxUserId , ee.head_img_url AS headImgUrl, ee.employee_no AS employeeNo, ee.employee_type AS employeeType, ee.sex AS sex FROM tenant.employee ee WHERE status = ? AND tenant_id = ?|1|4|4||0|0|1749|1749|732|732|
|user_service|INSERT INTO user_source (id, tenant_id, tenant_wechatapp_id, user_id, from_id , source_type, create_time, update_time, shop_id) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?)|1|1|1||0|0|0|0|0|0|
|tenant|SELECT DISTINCT emp.id, emp.employee_name FROM tenant.sneak_guest sg JOIN tenant.employee emp ON emp.id = sg.maintain_employee_id WHERE sg.tenant_app_id = ? AND sg.create_shop_id = ? AND sg.`status` = ? AND sg.next_maintain_date >= ? AND sg.next_maintain_date < ?|1|1|1||0|0|2176|2176|4|4|
|v4_user|UPDATE member_import mi JOIN member m ON mi.tenant_id = m.tenant_id AND mi.tenant_app_id = m.tenant_app_id AND m.mobile_no = mi.mobile_no SET mi.import_status = ?, mi.import_err_msg = ? WHERE mi.tenant_id = ? AND mi.import_status = ? AND mi.tenant_id = ?|1|17|17||0|0|40224|40224|0|0|
|goods|SELECT ifnull(min(price), ?) AS price , ifnull(max(market_price), ?) AS market_price , ifnull(sum(quantity), ?) AS quantity , ifnull(sum(sales_volume), ?) AS sale_amount , group_concat(id) AS skuIds FROM goods.goods_sku WHERE goods_id = ? AND activity_id = ? AND tenant_id = ? GROUP BY goods_id, activity_id|1|1|1||0|0|21133|21133|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 mb.erp_member_id in ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ...|1|3|3||0|0|742118|742118|240|240|
|export|SELECT od.coupon_id , CASE o.pay_type WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? ELSE ? END AS 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|7|7||0|0|35626|35626|0|0|
|position|INSERT INTO geo_position (id, tenant_id, tenant_app_id, object_type, object_id , geo_hash, latitude, longitude, create_time, update_time) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ?)|1|1|1||0|0|0|0|0|0|
|youzan|UPDATE weimob_message_push SET status = ?, error_msg = ?, update_time = ? WHERE id = ?|1|1|1||0|0|1|1|0|0|
|corpwx|INSERT INTO external_user_log (tenant_id, id, external_user_id, corp_user_id, employee_id , oper_type) VALUES (?, ?, ?, ?, ? , ?)|1|2|2||0|0|0|0|0|0|
|tenant|SELECT es.id, es.sales_no, es.member_erp_id, es.sales_date, es.sales_erp_id , es.is_sales 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 = ? ORDER BY es.sales_date DESC, es.id DESC LIMIT ?, ?|1|6|6||0|0|1207|1207|20|20|
|user_service|UPDATE tenant_member_bind SET tenant_app_id = ?, user_id = ?, wx_user_id = NULL, erp_member_id = ?, customer_user_id = NULL, wx_union_id = NULL, create_time = ?, update_time = ?, external_user_id = ? WHERE tenant_id = ? AND id = ?|1|3|3||0|0|1|1|0|0|
|employee|SELECT t1.label_task_id AS labelTaskId, count(DISTINCT employee_id) AS employeeNum, count(DISTINCT user_id) AS memberNum FROM label_task_employee t1 JOIN label_task_setting t2 ON t1.label_task_id = t2.id AND t2.disabled = ? WHERE t1.label_task_id IN (?) GROUP BY t1.label_task_id|1|2|2||0|0|539013|539013|11|11|
|employee|INSERT INTO backlog_file (id, tenant_id, tenant_app_id, backlog_id, url , status) VALUES (?, ?, ?, ?, ? , ?)|1|1|1||0|0|0|0|0|0|
|wx_gateway|SELECT id, tenant_id, tenant_app_id, wx_template_id, employee_id , busi_id, busi_type, url, push_time, category , title, content, status, retry_amount, remark , create_time, update_time, del_flag FROM wx_template_push WHERE tenant_app_id = ? AND busi_type = ? AND busi_id = ? AND category = ? AND del_flag = ? ORDER BY id DESC|1|2|2||0|0|628|628|1|1|
|authorization_service|update user_login_token SET 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_data =|1|2|2||0|0|1|1|0|0|
|v4_coupon|UPDATE v4_coupon.coupon SET coupon_status = ? WHERE tenant_id = ? AND tenant_app_id = ? AND coupon_status = ? AND end_time < now()|1|2|2||0|0|433145|433145|0|0|
||SELECT * FROM v4_sales.warranty_detail WHERE warranty_id = ?|1|8|8||0|0|1981646|1981646|1|1|
|v4_user|INSERT INTO potential_customer (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, next_maintain_time, intention_num, latest_intention, status , sex, cutomer_grade, maintain_level, create_time, update_time , tenant_id, tenant_app_id) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?)|1|1|1||0|0|0|0|0|0|
|tenant|SELECT count(0) 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|1|4|4||0|0|88549|88549|1|1|
|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|22|22||0|0|2021999|2021999|0|0|
|payment|UPDATE pay_order_msg SET response_body = ? WHERE id = ?|1|1|1||0|0|1|1|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|21|21||0|0|2022015|2022015|1140|1140|
|tenant|SELECT t1.id, t1.sales_erp_id, t1.product_name, t1.product_barcode, t1.sales_type , t1.category_name, t1.gold_weight, t1.stone_weight, t1.total_weight, t1.remark , t1.amount_total AS amount_pay, t1.amount_total, t1.quantity, t2.sales_brand, t2.sales_craft , t3.sales_no, t3.sales_date, t3.employee_name, t3.sales_remark FROM erp_sales_detail t1 LEFT JOIN erp_sales_detail_extend t2 ON t2.tenant_id = t1.tenant_id AND t2.tenant_wechatapp_id = t1.tenant_wechatapp_id AND t2.sales_erp_id = t1.sales_erp_id AND t2.sales_index = t1.sales_index LEFT JOIN erp_sales t3 ON t3.tenant_id = t1.tenant_id AND t3.tenant_wechatapp_id = t1.tenant_wechatapp_id AND t3.sales_erp_id = t1.sales_erp_id WHERE t1.tenant_id = ? AND t1.tenant_wechatapp_id = ? AND t3.tenant_id = t1.tenant_id AND t3.tenant_wechatapp_id = t1.tenant_wechatapp_id AND t3.member_erp_id = ? AND t3.sales_status = ? AND t3.is_sales = ? ORDER BY t1.id DESC LIMIT ?, ?|1|3|3||0|0|1948|1948|10|10|
|v4_employee|SELECT t.id AS task_id, task_type , if(task_type = ?, st.description, it.description) AS description , if(task_type = ?, st.quick_reply, it.quick_reply) AS quick_reply , task_name, member_id, member_name, member_mobile_no, member_sex , member_level, t.start_time, t.end_time , datediff(t.end_time, NULL) AS left_days, send_coupons , recv_coupons, st.coupons, t.accept_time, t.plan_arrival_shop_time, t.arrival_shop_time , t.trade_time FROM task_task t LEFT JOIN task_system_task_template st ON st.id = t.task_template_id AND st.tenant_id = ? AND st.tenant_app_id = ? LEFT JOIN task_invite_task_template it ON it.id = t.task_template_id AND it.tenant_id = ? AND it.tenant_app_id = ? WHERE t.status = ? AND task_type = ? AND task_template_id = ? AND shop_id = ? AND employee_id = ? AND finish_time IS NOT NULL AND t.tenant_id = ? AND t.tenant_app_id = ? ORDER BY t.id DESC LIMIT ?, ?|1|4|4||0|0|361059|361059|10|10|
|erp_sync|DELETE FROM retry_data WHERE id = ?|1|1|1||0|0|1|1|0|0|
|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 FROM erp_sales t1 WHERE t1.member_erp_id IN (?) AND t1.sales_date >= DATE_FORMAT(?, '%Y-%m-%d') AND t1.is_sales = ? AND t1.sales_status = ? AND t1.tenant_id = ? AND t1.tenant_app_id = ?|1|1|1||0|0|9|9|9|9|
|position|SELECT * FROM geo_position WHERE tenant_id = ? AND tenant_app_id = ? AND object_type = ? AND object_id = ?|1|1|1||0|0|1|1|1|1|
|user_service|UPDATE tenant_member_info SET tenant_app_id = ?, user_id = ?, shop_id = ?, birthday = ?, birthday_is_lunar = ?, address = ?, memorial_name = ?, memorial_day_is_lunar = ?, grade_id = ?, create_time = ?, update_time = ?, member_image_flag = ?, info_is_perfect = ? WHERE tenant_id = ? AND id = ?|1|1|1||0|0|1|1|0|0|
|user_service|UPDATE tenant_member_info SET tenant_app_id = ?, user_id = ?, shop_id = ?, birthday = ?, birthday_is_lunar = ?, address = ?, memorial_day_is_lunar = ?, grade_id = ?, create_time = ?, update_time = ?, member_image_flag = ?, member_image_time = ?, info_is_perfect = ?, erp_card_no = ? WHERE tenant_id = ? AND id = ?|1|1|1||0|0|1|1|0|0|
|tenant|SELECT count(*) AS amount FROM sneak_guest WHERE tenant_app_id = ? AND status = ? AND create_shop_id = ? AND maintain_employee_id = ? AND create_time >= ? AND next_maintain_date >= ? AND next_maintain_date <= ?|1|1|1||0|0|201|201|1|1|
|corpwx|INSERT INTO external_user (id, tenant_id, cwx_user_id, user_id, name , sex, avatar, tenant_user_id, un_assign_flag, corp_user_id , wx_user_id, create_time, update_time, status) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?)|1|2|2||0|0|0|0|0|0|
|tenant|SELECT DISTINCT employee_type FROM tenant.employee WHERE tenant_id = ?|1|3|3||0|0|635|635|27|27|
|v4_employee|SELECT ? AS task_type, t2.type AS system_task_type, t.task_template_id, 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 = ? GROUP BY t.task_template_id, t2.type|1|1|1||0|0|9253|9253|3|3|
|warranty_service|INSERT INTO warranty (id, tenant_wechatapp_id, user_id, erp_sales_id, warranty_no , is_disable, warranty_data, version, upload_frequency, update_employee_id , employee_erp_id, dept_erp_id, sales_no, sales_date, style_id) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ?)|1|1|1||0|0|0|0|0|0|
|goods|SELECT count(0) FROM ( SELECT gs.id, gs.tenant_id, gs.tenant_app_id, gs.category_id, gs.activity_id , gs.goods_name, gs.style_no, gs.base_sale_number, gs.limit_sale , if(gs.status = ?, gs.status, if(t.id IS NULL, ?, ?)) AS status , gs.thumbnail_img, gs.express_type, gs.take_stock_day, gs.take_remark, gs.express_fee , gs.create_time, gs.update_time, gs.sale_type, gs.take_start_time, gs.page_id , gs.pay_way, gs.advance_payment, gs.exchange_money , ifnull(sku.minPrice, ?) AS minPrice , ifnull(sku.marketPrice, ?) AS marketPrice , ifnull(sku.totalSalesVolume, ?) AS totalSalesVolume , ifnull(sku.totalQuantity, ?) AS totalQuantity , ifnull(number, ?) AS skuNumber, gs.topping FROM goods.goods gs LEFT JOIN ( SELECT id, goods_id FROM goods.goods_up_app gu WHERE gu.tenant_app_id = ? ) t ON gs.id = t.goods_id LEFT JOIN ( SELECT goods_id, min(price) AS minPrice, max(market_price) AS marketPrice , sum(sales_volume) AS totalSalesVolume, sum(quantity) AS totalQuantity , count(*) AS number FROM goods.goods_sku WHERE activity_id = ? GROUP BY tenant_id, goods_id ) sku ON sku.goods_id = gs.id WHERE gs.tenant_id = ? AND gs.goods_name LIKE concat(?, ?, ?) AND gs.status < ? ORDER BY gs.topping DESC, sku.totalSalesVolume DESC, gs.id DESC ) tmp_count|1|5|5||0|0|65370|65370|1|1|
|user_service|UPDATE tenant_member_info SET tenant_app_id = ?, user_id = ?, shop_id = ?, birthday_is_lunar = ?, memorial_name = ?, memorial_day_is_lunar = ?, grade_id = ?, create_time = ?, update_time = ?, member_image_flag = ?, member_image_time = ?, erp_card_no = ? WHERE tenant_id = ? AND id = ?|1|4|4||0|0|1|1|0|0|
|corpwx_license|SELECT corp_id, agent_id, corp_wx_user_id, max(blocked_time) AS 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|19252|19252|0|0|
|sms|SELECT id, title, type_name, content, code , create_time, update_time FROM sms_template WHERE 1 = 1 AND type_name LIKE CONCAT(?, ?, ?) UNION ALL SELECT id, title, type_name, content, code , create_time, update_time FROM sms_template_custom WHERE 1 = 1 AND `status` = ? AND is_disable = ? AND tenant_app_id = ? AND type_name LIKE CONCAT(?, ?, ?) ORDER BY create_time DESC|1|1|1||0|0|1362|1362|0|0|
|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 = ?|1|2|2||0|0|5397|5397|2698|2698|
|tenant|SELECT sg.id, sneak_guest_no, sg.status, sg.user_id, sg.user_type , smg.time , if(sg.status = ?, e.employee_name, ?) AS maintainEmployeeName , smg._count AS maintainNum, sg.update_employee_id FROM tenant.sneak_guest sg JOIN tenant.employee e ON e.id = sg.maintain_employee_id JOIN ( SELECT sneak_guest_id, count(*) AS _count, min(create_time) AS time FROM tenant.sneak_guest_maintain WHERE tenant_id = ? AND tenant_app_id = ? AND shop_id = ? AND employee_id = ? AND event_type IN (?) AND create_time BETWEEN ? AND ? GROUP BY sneak_guest_id ) smg ON smg.sneak_guest_id = sg.id WHERE sg.tenant_id = ? AND sg.tenant_app_id = ? AND (sg.fail_type IS NULL OR sg.fail_type = ?) LIMIT ?|1|3|3||0|0|73741|73741|10|10|
|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 user_id = ? ORDER BY create_time DESC|1|1|1||0|0|2|2|1|1|
||SELECT count(1) FROM v4_sales.erp_sales es JOIN v4_sales.warranty w ON w.tenant_id = ? AND w.sales_id = es.id WHERE es.tenant_id = ? AND es.sales_status = ? AND es.sales_date BETWEEN ? AND ?|1|11|11||0|0|974994|974994|1|1|
|v4_user|SELECT ifnull(t2.id, ?) AS id, t2.tenant_id, t2.tenant_app_id , t2.shop_id, t2.mobile_no , CASE  WHEN t2.member_name IS NULL OR t2.member_name = ? THEN t1.external_user_name ELSE t2.member_name END AS member_name, t2.head_img_url, ifnull(t2.sex, t1.sex) AS sex , t2.wx_union_id, t2.mini_open_id, t2.h5_open_id, t1.external_user_id FROM cwx_external_user t1 LEFT JOIN member t2 ON t1.external_user_id = t2.external_user_id AND t2.`status` IN (?) AND t2.tenant_id = ? WHERE t1.external_user_id = ? AND t1.tenant_id = ? LIMIT ?|1|1|1||0|0|1|1|1|1|
|user_service|INSERT INTO wx_user (id, wx_app_id, open_id, union_id, nick_name , user_name, mobile_no, head_img_url, is_subscribe, subscribe_time , unsubscribe_time, wx_card_code, wx_card_no, sex, country , province, city, plat_open_id, create_time, update_time) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ?)|1|3|3||0|0|0|0|0|0|
|user_service|INSERT INTO tenant_member (tenant_id, id, tenant_app_id, user_id, mobile_no , user_name, head_img_url, sex, status, create_time , update_time) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?)|1|2|2||0|0|0|0|0|0|
|v4_employee|SELECT t.id AS task_id, task_type , if(task_type = ?, st.description, it.description) AS description , if(task_type = ?, st.quick_reply, it.quick_reply) AS quick_reply , task_name, member_id, member_name, member_mobile_no, member_sex , member_level, t.start_time, t.end_time , datediff(t.end_time, NULL) AS left_days, send_coupons , recv_coupons, st.coupons, t.accept_time, t.plan_arrival_shop_time, t.arrival_shop_time , t.trade_time FROM task_task t LEFT JOIN task_system_task_template st ON st.id = t.task_template_id AND st.tenant_id = ? AND st.tenant_app_id = ? LEFT JOIN task_invite_task_template it ON it.id = t.task_template_id AND it.tenant_id = ? AND it.tenant_app_id = ? WHERE t.status = ? AND task_type = ? AND task_template_id = ? AND shop_id = ? AND employee_id = ? AND finish_time IS NOT NULL AND t.tenant_id = ? AND t.tenant_app_id = ? ORDER BY t.id DESC LIMIT ?|1|1|1||0|0|245397|245397|10|10|
|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 = ? AND gs.create_time >= ? AND gs.create_time <= ? AND sg.create_shop_id = ? AND sg.status = ? AND ey.employee_name LIKE concat(?, ?, ?) ORDER BY sg.id DESC ) tmp_count|1|3|3||0|0|4569|4569|1|1|
|coupon_service|SELECT count(0) FROM coupon_service.template t LEFT JOIN coupon_service.template_redpack r ON r.template_id = t.id LEFT JOIN coupon_service.template_activity a ON a.template_id = t.id WHERE t.state != ? AND t.tenant_app_id = ? AND (t.tenant_app_id = ?)|1|1|1||0|0|21313|21313|1|1|
|coupon_service|INSERT INTO coupon_market_order (id, tenant_id, tenant_app_id, template_id, market_id , pay_type, cash, point, quantity, user_id , order_state) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?)|1|2|2||0|0|0|0|0|0|
|employee|SELECT DATE_FORMAT(t.create_time, '%d') AS monthDay , ifnull(sum(task_amount), ?) AS shouldMarkNum , ifnull(sum(if(t.`status` = ?, finish_amount, ?)), ?) AS markLabelNum FROM backlog t WHERE t.tenant_id = ? AND t.tenant_app_id = ? AND t.employee_id IN (?) AND t.scene = ? AND t.begin_time >= ? AND t.expire_time < ? GROUP BY DATE_FORMAT(t.create_time, '%d')|1|1|1||0|0|335|335|21|21|
|user_service|update user_service.user_employee set employee_id = ?,employee_erp_id=?,create_time=now(),update_time=now() WHERE tenant_wechatapp_id = ? and user_id in ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ...|1|1|1||0|0|600|600|0|0|
|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.status = ? AND od.finish_type = ?)|1|1|1||0|0|2723|2723|1|1|
|user_service|UPDATE tenant_member_info SET tenant_app_id = ?, user_id = ?, shop_id = ?, birthday = ?, birthday_is_lunar = ?, address = ?, memorial_name = ?, memorial_day_is_lunar = ?, interest = ?, grade_id = ?, create_time = ?, update_time = ?, member_image_flag = ?, info_is_perfect = ?, erp_card_no = ? WHERE tenant_id = ? AND id = ?|1|1|1||0|0|1|1|0|0|
|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(?, ?, ?))|1|6|6||0|0|518790|518790|1|1|
||DELETE FROM tenant.sjfx_dct_erp_sales_detail WHERE create_time < ?|1|1|1||0|0|294666|294666|0|0|
|v4_employee|SELECT e.shop_id, e.employee_id, e.employee_name FROM employee e JOIN ( SELECT DISTINCT employee_id FROM task_task WHERE status = ? AND task_template_id = ? AND shop_id = ? AND tenant_id = ? AND tenant_app_id = ? ) t ON e.employee_id = t.employee_id WHERE e.shop_id = ? AND e.tenant_id = ? AND e.tenant_app_id = ?|1|1|1||0|0|3479|3479|15|15|
|corpwx|INSERT INTO external_user (id, tenant_id, cwx_user_id, user_id, sex , tenant_user_id, un_assign_flag, corp_user_id, wx_user_id, create_time , update_time, status) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?)|1|2|2||0|0|0|0|0|0|
|user_service|SELECT table_schema, table_name FROM information_schema.key_column_usage WHERE referenced_table_schema = ? AND referenced_table_name = ?|1|1|1||0|0|5270|5270|0|0|
|corpwx|DELETE FROM contact_me WHERE tenant_id = ? AND config_id = ?|1|1|1||0|0|320|320|0|0|
|v4_sales|SELECT COUNT(*) AS total FROM ( SELECT max(es.sales_no) AS sales_no, max(es.id) AS id , max(es.sales_date) AS sales_date, max(es.member_erp_id) AS memberId , max(es.sales_erp_id) AS erpSalesId, esd.product_barcode , max(esd.product_name) AS product_name, max(category_erp_id) AS category_erp_id , max(category_name) AS category_name, sum(amount_total) AS amount_total , sum(amount_pay) AS amount_pay, count(esd.id) AS quantity 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 = ? LEFT JOIN v4_sales.value_added_ignore i ON i.erp_sales_id = es.sales_erp_id AND i.product_barcode = esd.product_barcode AND i.tenant_id = ? AND i.tenant_app_id = ? WHERE es.sales_status = ? AND is_sales = ? AND i.id IS NULL AND es.dept_erp_id = ? AND es.employee_erp_id = ? AND es.tenant_id = ? AND es.tenant_app_id = ? GROUP BY esd.product_barcode ) s LEFT JOIN v4_sales.value_added va ON va.product_barcode = s.product_barcode AND va.tenant_id = ? AND va.tenant_app_id = ? LEFT 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 = ? LEFT 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 va.id IS NULL AND vat.id IS NOT NULL|1|2|2||0|0|88|88|1|1|
|account|INSERT INTO account_flow (id, src_tenant_id, src_tenant_app_id, src_account_type, src_account_id , src_account_balance, dst_tenant_id, dst_tenant_app_id, dst_account_type, dst_account_id , dst_account_balance, is_platform_account, amount, busi_type, busi_id , remark, oper_type, create_time) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?)|1|1|1||0|0|0|0|0|0|
|tenant|select sp.tenant_id as tenantId, sp.tenant_app_id as tenantAppId, emp.employee_erp_id as employeeErpId, emp.id as employeeId, emp.employee_no as employeeNo, emp.employee_name as employeeName, emp.employee_type as employeeType, emp.head_img_url as headImgUrl, emp.sex, sp.`status`, emp.mobile_no as mobileNo, emp.corp_wx_user_id as corpWxUserId, tu.user_id as userId from employee emp join employee_shop sp on emp.id=sp.employee_id and sp.status=? left join employee_tenant_user tu on sp.tenant_app_id=tu.tenant_app_id and emp.id=tu.employee_id and tu.`status`= ? where sp.tenant_app_id = ? and emp.`status` = ? and emp.id in ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ) group by sp.tenant_id,sp.tenant_app_id,em...|1|1|1||0|0|757|757|105|105|
|coupon_service|SELECT source_id, count(*) AS quantity FROM coupon_service.coupon_push WHERE source = ? AND state = ? AND source_id IN (?) GROUP BY source_id|1|1|1||0|0|31703|31703|1|1|
|v4_employee|SELECT COUNT(*) FROM ( SELECT t.id AS task_id, task_type , if(task_type = ?, st.description, it.description) AS description , if(task_type = ?, st.quick_reply, it.quick_reply) AS quick_reply , task_name, member_id, member_name, member_mobile_no, member_sex , member_level, t.start_time, t.end_time , datediff(t.end_time, NULL) AS left_days, send_coupons , recv_coupons, st.coupons, t.accept_time, t.plan_arrival_shop_time, t.arrival_shop_time , t.trade_time FROM task_task t LEFT JOIN task_system_task_template st ON st.id = t.task_template_id AND st.tenant_id = ? AND st.tenant_app_id = ? LEFT JOIN task_invite_task_template it ON it.id = t.task_template_id AND it.tenant_id = ? AND it.tenant_app_id = ? WHERE t.status = ? AND task_type = ? AND task_template_id = ? AND shop_id = ? AND employee_id = ? AND (member_mobile_no = ? OR member_name LIKE concat(?, ?, ?)) AND finish_time IS NULL AND t.end_time > now() AND t.tenant_id = ? AND t.tenant_app_id = ? ) TOTAL|1|2|2||0|0|4183|4183|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 NOT IN (?) AND tm.user_id IN (|1|1|1||0|0|1542|1542|1|1|
|user_service|SELECT id, wx_app_id, open_id, union_id, nick_name , user_name, mobile_no, head_img_url, is_subscribe, subscribe_time , unsubscribe_time, wx_card_code, wx_card_no, sex, country , province, city, plat_open_id, create_time, update_time FROM wx_user WHERE wx_app_id = ? AND open_id = ?|1|1|1||0|0|1|1|1|1|
|v4_sales|SELECT * FROM tenant.erp_sales_detail WHERE tenant_id = ? AND sales_erp_id = ?|1|1|1||0|0|2|2|2|2|
|activity_service|SELECT * FROM activity_service.sign_in_activity_log WHERE user_id = ? AND sign_in_id = ? LIMIT ?|1|2|2||0|0|38793|38793|1|1|
|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 = ? AND tt.shop_id = ? ORDER BY create_time DESC ) tmp_count|1|2|2||0|0|1098|1098|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 mb.erp_member_id in ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,...|1|1|1||0|0|898132|898132|414|414|
|mysql|DELETE FROM message_push.message_log WHERE create_time < DATE_SUB(now(), INTERVAL ? DAY)|1|80|80||0|0|3123641|3123641|0|0|
|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 mb.erp_member_id in ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , \...|1|5|5||0|0|1197574|1197574|313|313|
|tenant|SELECT count(0) FROM erp_sales_detail t1 LEFT JOIN erp_sales_detail_extend t2 ON t2.tenant_id = t1.tenant_id AND t2.tenant_wechatapp_id = t1.tenant_wechatapp_id AND t2.sales_erp_id = t1.sales_erp_id AND t2.sales_index = t1.sales_index LEFT JOIN erp_sales t3 ON t3.tenant_id = t1.tenant_id AND t3.tenant_wechatapp_id = t1.tenant_wechatapp_id AND t3.sales_erp_id = t1.sales_erp_id WHERE t1.tenant_id = ? AND t1.tenant_wechatapp_id = ? AND t1.category_erp_id = ? AND t3.tenant_id = t1.tenant_id AND t3.tenant_wechatapp_id = t1.tenant_wechatapp_id AND t3.member_erp_id = ? AND t3.sales_status = ? AND t3.is_sales = ?|1|1|1||0|0|65|65|1|1|
|authorization_service|UPDATE user_login_token SET login_code = ? WHERE id = ?|1|1|1||0|0|1|1|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|6|6||0|0|2022016|2022016|1283|1283|
|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 = ? AND sg.create_shop_id = ? AND sg.status = ? AND ey.employee_name LIKE concat(?, ?, ?) ORDER BY sg.id DESC ) tmp_count|1|1|1||0|0|9141|9141|1|1|
|v4_user|SELECT id, shop_id, mobile_no, member_name, head_img_url , sex, birthday, birthday_is_lunar, memorial_name, memorial_day , memorial_day_is_lunar, address, interest, mini_open_id, h5_open_id , wx_card_code, status, butler_employee_mobile_no, register_time, point_balance , total_sale_point, import_status, import_err_msg, tenant_id, tenant_app_id , create_time, update_time FROM member_import WHERE import_status = ? AND tenant_id = ? ORDER BY id ASC LIMIT ?|1|7|7||0|0|44286|44286|5000|5000|
|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|3|3||0|0|7151|7151|10|10|
|activity_service|SELECT id, tenant_id, tenant_wechatapp_id, activity_id, lottery_activity_id , user_id, head_img_url, user_name, mobile_no, prize_type , prize_name, prize_image_url, status, retry_num, create_time , update_time, prize_data, winning_prize FROM lottery_winner WHERE status = ? AND retry_num < ? AND create_time >= ? AND create_time < ?|1|1|1||0|0|72|72|0|0|
|v4_user|INSERT INTO member_butler (id, member_id, employee_id, shop_id, create_time , update_time, tenant_id, tenant_app_id) VALUES (?, ?, ?, ?, ? , ?, ?, ?)|1|1|1||0|0|0|0|0|0|
|user_service|UPDATE wx_user SET wx_app_id = ?, open_id = ?, nick_name = ?, is_subscribe = ?, subscribe_time = ?, unsubscribe_time = ?, sex = ?, country = ?, province = ?, city = ?, plat_open_id = ?, create_time = ?, update_time = ? WHERE id = ?|1|1|1||0|0|1|1|0|0|
|wx_gateway|UPDATE wx_token SET failed_times = ?, failed_reason = ?, appid = ?, refresh_token = ?, access_token = ?, access_token_expire = ?, jsapi_ticket = ?, jsapi_ticket_expire = ?, coupon_api_ticket = ?, coupon_api_ticket_expire = ?, refresh_type = ?, create_time = ?, update_time = ? WHERE id = ?|1|1|1||0|0|1|1|0|0|
|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.tenant_id = ? AND p.product_type = ? AND (ps.id IS NOT NULL OR p.tenant_wechatapp_id = ?)|1|8|8||0|0|52799|52799|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, '%Y-%m-%d %H:%i:%s') 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 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 = ? ORDER BY tm.id ASC|1|15|15||0|0|188101|188101|5|5|
|v4_user|UPDATE potential_customer_follow SET oper_shop_id = ?, oper_employee_id = ?, oper_employee_name = ?, oper_status = ? WHERE potential_customer_id = ? AND oper_status = ? AND should_maintain_date >= ? AND tenant_id = ? AND tenant_app_id = ? ORDER BY should_maintain_date ASC LIMIT ?|1|1|1||0|0|4|4|0|0|
|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 user_id = ? AND user_type = ? AND status = ? ORDER BY id DESC|1|1|1||0|0|0|0|0|0|
|coupon_service|SELECT count(0) FROM ( SELECT cm.id, coupon_name, coupon_pack_name AS packName, cp.coupon_type , round(t.face_value / ?, ?) AS faceValue , round(t.discount / ?, ?) AS discount , cp.begin_time, cp.end_time, t.scope , round(cp.use_threshold / ?, ?) AS useThreshold , cm.pay_type, round(cm.cash / ?, ?) AS cash , cm.point, t.product_name, cm.type, cp.take_effect_way, cp.take_start_day , cp.take_effect_day, tgl.get_quantity, tgl.get_quantity / tgl.put_quantity * ? AS total , t.face_value AS couponPoint FROM coupon_service.coupon_market cm JOIN coupon_service.coupon_push cp ON cp.tenant_app_id = ? AND cp.source_id = cm.id AND cp.source IN (?) JOIN coupon_service.template t ON t.tenant_app_id = ? AND t.id = cp.template_id JOIN coupon_service.template_grant_limit tgl ON tgl.tenant_app_id = ? AND tgl.coupon_push_id = cp.id WHERE cm.tenant_id = ? AND cm.tenant_app_id = ? AND cm.type = ? AND cm.state = ? AND if(take_effect_way = ?, end_time > now(), 1 = 1) AND tgl.get_quantity < tgl.put_quantity AND cm.display_way = ? AND (cm.limit_type = ? OR (cm.limit_type = ? AND find_in_set(?, cm.limit_grade_ids))) UNION ALL SELECT cm.id, NULL, coupon_pack_name AS packName, NULL, ? , ?, NULL, NULL, NULL, ? , pay_type, round(cash / ?, ?) AS cash , point, NULL, type, NULL, ? , ?, ?, ?, ? FROM coupon_service.coupon_market cm WHERE cm.tenant_id = ? AND cm.tenant_app_id = ? AND cm.type = ? AND cm.state = ? AND display_way = ? AND (cm.limit_type = ? OR (cm.limit_type = ? AND find_in_set(?, cm.limit_grade_ids))) ) table_count|1|1|1||0|0|158|158|1|1|
|goods|SELECT count(0) FROM ( SELECT gs.id, gs.category_id, gs.goods_name, gs.style_no, gs.status , gs.thumbnail_img, gs.express_type, gs.take_stock_day, gs.take_remark, gs.express_fee , ifnull(gs.base_sale_number, ?) + ifnull(t1.sales_volume, ?) AS total_sales_volume , ifnull(ifnull(t2.quantity, t3.quantity), ?) AS total_quantity , ifnull(ifnull(t2.price, t3.price), ?) AS min_price , gs.create_time, gs.exchange_money, ifnull(t2.number, ?) AS skuNumber , ifnull(t3.number, ?) AS activitySkuNumber FROM goods.goods gs LEFT JOIN goods.goods_category cg ON gs.category_id = cg.id INNER JOIN goods.goods_up_app t ON gs.id = t.goods_id AND t.tenant_app_id = ? LEFT JOIN ( SELECT tenant_app_id, goods_id, sum(sales_volume) AS sales_volume FROM goods.goods_sku GROUP BY tenant_app_id, goods_id ) t1 ON t.tenant_app_id = t1.tenant_app_id AND t.goods_id = t1.goods_id LEFT JOIN ( SELECT tenant_app_id, goods_id, sum(quantity) AS quantity , min(price) AS price, count(*) AS number FROM goods.goods_sku WHERE activity_id = ? GROUP BY tenant_app_id, goods_id ) t2 ON t.tenant_app_id = t2.tenant_app_id AND t.goods_id = t2.goods_id LEFT JOIN ( SELECT tenant_app_id, goods_id, sum(quantity) AS quantity , min(price) AS price, count(*) AS number FROM goods.goods_sku WHERE activity_id > ? GROUP BY tenant_app_id, goods_id ) t3 ON t.tenant_app_id = t3.tenant_app_id AND t.goods_id = t3.goods_id WHERE 1 = 1 AND (cg.id = ? OR cg.parent_id = ?) AND gs.topping = ? ) tmp|1|5|5||0|0|127047|127047|1|1|
|v4_user|INSERT INTO member_source (id, member_id, source_type, source_id, client_type , registry_shop_id, create_time, update_time, tenant_id, tenant_app_id) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ?)|1|1|1||0|0|0|0|0|0|
|oa_gateway|SELECT id, user_type, tenant_id, corp_id, corp_user_id , erp_emp_id, user_head_img, real_name, sex, user_name , password, status, create_time, update_time FROM login_user WHERE user_name = ? AND password = ? AND status = ?|1|3|3||0|0|16898|16898|0|0|
|v4_sales|SELECT sum(amount_total) 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 IN (?) AND es.tenant_id = ? AND es.tenant_app_id = ?|1|20|20||0|0|29022|29022|1|1|
|v4_sales|SELECT t1.id, t1.sales_erp_id, t1.product_name, t1.product_barcode, t1.sales_type , t1.category_name, t1.gold_weight, t1.stone_weight, t1.total_weight, t1.remark , t1.amount_total AS amount_pay, t1.amount_total, t1.quantity, t3.sales_no, t3.sales_date , t3.employee_name, t3.sales_remark FROM v4_sales.erp_sales_detail t1 LEFT JOIN v4_sales.erp_sales t3 ON t3.sales_erp_id = t1.sales_erp_id AND t3.tenant_id = ? AND t3.tenant_app_id = ? WHERE t3.member_erp_id = ? AND t3.sales_status = ? AND t3.is_sales = ? AND t1.tenant_id = ? AND t1.tenant_app_id = ? ORDER BY t1.id DESC LIMIT ?, ?|1|1|1||0|0|282|282|10|10|
|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|1008|1008||0|0|10869262|10869262|769|769|
|user_service|UPDATE tenant_member_info SET tenant_app_id = ?, user_id = ?, shop_id = ?, birthday_is_lunar = ?, memorial_name = ?, memorial_day_is_lunar = ?, grade_id = ?, create_time = ?, update_time = ?, member_image_flag = ?, info_is_perfect = ?, erp_card_no = ? WHERE tenant_id = ? AND id = ?|1|1|1||0|0|1|1|0|0|
|v4_employee|SELECT COUNT(*) FROM ( SELECT t.id AS task_id, task_type , if(task_type = ?, st.description, it.description) AS description , if(task_type = ?, st.quick_reply, it.quick_reply) AS quick_reply , task_name, member_id, member_name, member_mobile_no, member_sex , member_level, t.start_time, t.end_time , datediff(t.end_time, NULL) AS left_days, send_coupons , recv_coupons, st.coupons, t.accept_time, t.plan_arrival_shop_time, t.arrival_shop_time , t.trade_time FROM task_task t LEFT JOIN task_system_task_template st ON st.id = t.task_template_id AND st.tenant_id = ? AND st.tenant_app_id = ? LEFT JOIN task_invite_task_template it ON it.id = t.task_template_id AND it.tenant_id = ? AND it.tenant_app_id = ? WHERE t.status = ? AND shop_id = ? AND employee_id = ? AND t.tenant_id = ? AND t.tenant_app_id = ? ) TOTAL|1|1|1||0|0|714|714|1|1|
|tenant|UPDATE employee SET head_img_url = ? WHERE id = ?|1|1|1||0|0|1|1|0|0|
|user_service|UPDATE wx_user SET wx_app_id = ?, open_id = ?, union_id = ?, nick_name = ?, user_name = ?, mobile_no = ?, is_subscribe = ?, subscribe_time = ?, wx_card_code = ?, sex = ?, country = ?, province = ?, city = ?, create_time = ?, update_time = ? WHERE id = ?|1|1|1||0|0|1|1|0|0|
|v4_sales|SELECT * FROM v4_sales.warranty_detail WHERE tenant_id = ? AND sales_detail_id = ?|1|6|6||0|0|778532|778532|0|0|
|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 ?|1|3|3||0|0|149995|149995|2|2|
|account|SELECT id, tenant_id, tenant_app_id, account_type, owner_type , owner_id, balance, cumulation, status FROM account WHERE owner_type = ? AND balance < ? AND account_type = ?|1|1|1||0|0|647|647|190|190|
|user_service|update user_service.user_employee set employee_id = ?,employee_erp_id=?,create_time=now(),update_time=now() WHERE tenant_wechatapp_id = ? and user_id in ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,...|1|1|1||0|0|538|538|0|0|
|employee|SELECT count(0) FROM employee.backlog bg WHERE bg.tenant_app_id = ? AND bg.scene NOT IN (?) AND bg.shop_id = ? AND bg.leave_flag = ?|1|1|1||0|0|4088|4088|1|1|
|user_service|UPDATE wx_user SET wx_app_id = ?, open_id = ?, nick_name = ?, is_subscribe = ?, subscribe_time = ?, unsubscribe_time = ?, sex = ?, country = ?, province = ?, city = ?, create_time = ?, update_time = ? WHERE id = ?|1|2|2||0|0|1|1|0|0|
|user_service|UPDATE tenant_member SET head_img_url = ?, update_time = ? WHERE tenant_id = ? AND id = ?|1|1|1||0|0|1|1|0|0|
|v4_sales|SELECT id, sales_id, status, tenant_id, tenant_app_id , create_time, update_time FROM comment_not_remind_sales WHERE status = ?|1|2|2||0|0|68421|68421|200|200|
|coupon_service|SELECT id, tenant_id, tenant_app_id, coupon_id, remark , user_name, mobile_no, creator_user_id, creator_user_name, creator_mobile_no , product_name, exchange_shop, is_give, writeoff_user_id, writeoff_employee_id , writeoff_time, source_shop_id, source_user_id, source_user_type, member_source_shop , create_time, update_time FROM coupon_extend WHERE id = ?|1|1|1||0|0|1|1|1|1|
|v4_sales|SELECT es.sales_erp_id, es.sales_no, es.sales_date, count(esd.id) AS busiQuantity , sum(amount_total) AS amountTotal 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 esd.tenant_id = ? AND esd.tenant_app_id = ? WHERE sales_status = ? AND es.is_sales AND member_erp_id IN (?) AND es.tenant_id = ? AND es.tenant_app_id = ? GROUP BY es.sales_erp_id, es.sales_no, es.sales_date|1|1|1||0|0|4|4|1|1|
|employee|SELECT ifnull(sum(finish_amount), ?) AS addedNum FROM backlog t WHERE t.tenant_id = ? AND t.tenant_app_id = ? AND t.shop_id = ? AND t.scene = ? AND t.begin_time >= ? AND t.expire_time < ?|1|1|1||0|0|108|108|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|2|2||0|0|0|0|0|0|
|user_service|UPDATE user_service.tenant_member_info t1 JOIN user_service.user_employee t2 ON t1.tenant_id = t2.tenant_id AND t1.tenant_app_id = t2.tenant_wechatapp_id AND t1.user_id = t2.user_id SET t1.shop_id = ?, t2.shop_id = ? WHERE t1.tenant_id = ? AND t1.tenant_app_id = ? AND t2.employee_id = ? AND t1.shop_id = ?|1|5|5||0|0|5398|5398|0|0|
|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.activity_id AS activityId, od.tenant_id AS tenantId, od.user_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 = ?|1|2|2||0|0|246023|246023|483|483|
|employee|SELECT count(DISTINCT t.user_id) AS shouldMarkNum , count(DISTINCT if(t.`status` = ?, t.user_id, NULL)) AS markLabelNum FROM backlog t WHERE t.tenant_id = ? AND t.tenant_app_id = ? AND t.employee_id IN (?) AND t.scene = ? AND t.begin_time >= ? AND t.expire_time < ?|1|1|1||0|0|293|293|1|1|
|user_service|UPDATE tenant_member_info SET tenant_app_id = ?, user_id = ?, shop_id = ?, birthday = ?, birthday_is_lunar = ?, memorial_name = ?, memorial_day = ?, memorial_day_is_lunar = ?, grade_id = ?, create_time = ?, update_time = ?, member_image_flag = ?, member_image_time = ?, info_is_perfect = ?, erp_card_no = ? WHERE tenant_id = ? AND id = ?|1|1|1||0|0|1|1|0|0|
|corpwx|SELECT id, tenant_id, template_id, corp_id, corp_name , agent_id, agent_name, agent_round_logo_url, agent_square_logo_url, origin_auth_info , auth_time, status, create_time, update_time, is_inner_app , verify_token, encoding_aes_key, agent_secret, enable_status FROM app WHERE corp_id = ? AND agent_id = ?|1|1|1||0|0|1503|1503|1|1|
|tenant|SELECT count(*) FROM tenant.erp_sales t WHERE t.tenant_id = ? AND t.tenant_wechatapp_id = ? AND t.member_erp_id = ? AND t.is_sales = ?|1|22|22||0|0|3206|3206|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_id in ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ...|1|1|1||0|0|80|80|80|80|
|v4_user|SELECT COUNT(*) AS total FROM member_change_log WHERE member_id = ? AND tenant_id = ? AND tenant_app_id = ?|1|1|1||0|0|19|19|1|1|
|tenant|SELECT count(0) FROM employee t LEFT JOIN tenant_wechatapp_shop sp ON t.shop_id = sp.id WHERE t.tenant_id = ? AND t.status IN (?) AND EXISTS ( SELECT NULL FROM employee_shop es WHERE t.id = es.employee_id AND es.tenant_app_id = ? AND es.status IN (?) )|1|2|2||0|0|1614|1614|1|1|
|tenant|SELECT count(*) FROM `coupon_service`.`coupon_market_order`|1|2|2||0|0|583242|583242|1|1|
|v4_user|UPDATE member SET shop_id = ?, mobile_no = ?, member_name = ?, head_img_url = ?, sex = ?, birthday = ?, birthday_is_lunar = ?, memorial_day_is_lunar = ?, h5_open_id = ?, wx_card_code = ?, recommend_id = ?, external_user_id = ?, status = ?, combine_status = ?, combine_id = ?, tenant_id = ?, tenant_app_id = ?, create_time = ?, update_time = ? WHERE id = ? AND tenant_id = ? AND tenant_app_id = ?|1|1|1||0|0|2|2|0|0|
|tenant|SELECT count(0) FROM employee t LEFT JOIN tenant_wechatapp_shop sp ON t.shop_id = sp.id WHERE t.tenant_id = ? AND t.status IN (?)|1|3|3||0|0|854|854|1|1|
|warranty_service|SELECT count(*) FROM warranty WHERE user_id = ? AND tenant_wechatapp_id = ? AND is_disable = ? AND erp_sales_id NOT IN (?)|1|1|1||0|0|6|6|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.user_name AS userName, od.update_time AS updateTime, od.child_status AS childStatus , od.finish_type AS finishType, od.receive_time AS receiveTime, od.user_id AS userId, od.mobile_no AS buyMobileNo, od.edit_fee_flag AS editFeeFlag , dt.spec AS 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 ?|1|2|2||0|0|153408|153408|2|2|
|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.c|1|1|1||0|0|9107|9107|24|24|
|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 wx_user_id IN (?)|1|2|2||0|0|2|2|2|2|
|v4_user|SELECT COUNT(*) AS total FROM potential_customer WHERE checkin_shop_id = ? AND checkin_employee_id = ? AND checkin_time >= ? AND checkin_time < ? AND tenant_id = ? AND tenant_app_id = ?|1|2|2||0|0|143|143|1|1|
|coupon_service|SELECT egc.id, tmp.coupon_name, tmp.coupon_type, tmp.remark, cp.take_effect_way , cp.take_start_day, cp.take_effect_day, DATE_FORMAT(cp.begin_time, '%Y-%m-%d') AS begin_time , DATE_FORMAT(cp.end_time, '%Y-%m-%d') AS end_time, egc.limit_grant_time , DATE_FORMAT(egc.grant_begin_time, '%Y-%m-%d') AS grant_begin_time , DATE_FORMAT(egc.grant_end_time, '%Y-%m-%d') AS grant_end_time , ifnull(tmp.face_value, ?) / ? AS face_value , tmp.face_value AS point, ifnull(tmp.discount, ?) / ? AS discount , tmp.scope, tmp.product_name, tmp.product_image_url , if(egc.state = ?, ?, CASE  WHEN cp.end_time IS NOT NULL AND cp.end_time < now() THEN ? WHEN egc.limit_grant_time = ? AND egc.grant_end_time < now() THEN ? WHEN tgl.put_quantity <= ( SELECT count(*) FROM coupon_service.employee_give_coupon_log WHERE employee_give_coupon_id = egc.id ) THEN ? ELSE ? END) AS state , tr.type AS redpackType, ifnull(tr.min_price, ?) / ? AS minPrice FROM coupon_service.employee_give_coupon egc INNER JOIN coupon_service.coupon_push cp ON egc.template_id = cp.template_id AND cp.source = ? AND egc.id = cp.source_id AND cp.state = ? INNER JOIN coupon_service.template tmp ON egc.template_id = tmp.id INNER JOIN coupon_service.template_grant_limit tgl ON cp.id = tgl.coupon_push_id LEFT JOIN coupon_service.template_redpack tr ON tr.template_id = tmp.id WHERE egc.tenant_app_id = ? AND egc.state = ? AND (egc.limit_grant_time = ? OR egc.grant_begin_time <= now()) AND (egc.limit_shop = ? OR EXISTS ( SELECT ? FROM coupon_service.employee_give_coupon_shop cs WHERE egc.id = cs.employee_give_id AND cs.shop_id = ? )) AND egc.limit_role IN (?) ORDER BY state ASC, egc.id DESC LIMIT ?, ?|1|1|1||0|0|53741|53741|10|10|
|user_service|SELECT count(1) 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 NULL AND us.shop_id IS NOT NULL|1|3|3||0|0|3657|3657|1|1|
|v4_user|INSERT INTO member (id, shop_id, mobile_no, member_name, sex , birthday, birthday_is_lunar, memorial_day_is_lunar, status, combine_status , combine_id, create_time, update_time, tenant_id, tenant_app_id) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ?)|1|19|19||18|18|0|0|0|0|
|corpwx|INSERT INTO mini_app_msg (id, tenant_id, to_user, to_party, to_tag , msg_type, msg_scene, msg_id, msg_content, status , err_msg, template_id) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?)|1|1|1||0|0|0|0|0|0|
|order|SELECT ifnull(sum(if(od.status = ? AND od.finish_type = ?, ?, ?)), ?) AS "11" , 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.status = ? AND od.finish_type = ?)|1|1|1||0|0|2723|2723|1|1|
|goods|DELETE FROM goods_take_shop WHERE goods_id = ? AND tenant_app_id = ? AND activity_id = ?|1|5|5||0|0|106082|106082|0|0|
|tenant|select sp.tenant_id as tenantId, sp.tenant_app_id as tenantAppId, emp.employee_erp_id as employeeErpId, emp.id as employeeId, emp.employee_no as employeeNo, emp.employee_name as employeeName, emp.employee_type as employeeType, emp.head_img_url as headImgUrl, emp.sex, sp.`status`, emp.mobile_no as mobileNo, emp.corp_wx_user_id as corpWxUserId, tu.user_id as userId from employee emp join employee_shop sp on emp.id=sp.employee_id and sp.status=? left join employee_tenant_user tu on sp.tenant_app_id=tu.tenant_app_id and emp.id=tu.employee_id and tu.`status`= ? where sp.tenant_app_id = ? and emp.`status` = ? and emp.id in ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?\...|1|1|1||0|0|1012|1012|164|164|
|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|2500|2500|500|500|
|user_service|UPDATE wx_user SET wx_app_id = ?, open_id = ?, union_id = ?, nick_name = ?, is_subscribe = ?, subscribe_time = ?, sex = ?, country = ?, province = ?, city = ?, create_time = ?, update_time = ? WHERE id = ?|1|1|1||0|0|1|1|0|0|
|v4_user|SELECT id, grade_id, grade_name, user_id, sale_number , sale_amount, sale_points, tenant_id, tenant_app_id, create_time , update_time FROM member_grade WHERE user_id = ? AND tenant_id = ? AND tenant_app_id = ?|1|1|1||0|0|1|1|1|1|
|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|1|1|1||0|0|1076|1076|269|269|
