|数据库名称|SQL语句|总执行次数|总执行时间(秒)|最大执行时长|平均执行时间|锁定总时长|最大锁定时长|解析总行数|解析最大行数|返回总行数|返回最大行数|
| - | - | - | - | - | - | - | - | - | - | - | - |
|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 ?|260|582|5||0|0|3666391|37994|259|1|
|v4_sales|SELECT COUNT(*) AS total FROM v4_sales.erp_sales es JOIN v4_sales.warranty_can_added wca ON wca.sales_id = es.id AND wca.tenant_id = ? AND wca.tenant_app_id = ? LEFT JOIN v4_sales.warranty w ON w.sales_id = es.id AND w.tenant_id = ? AND w.tenant_app_id = ? WHERE is_sales = ? AND sales_status = ? AND es.employee_erp_id = ? AND es.dept_erp_id = ? AND if(wca.source = ?, es.sales_date >= ?, date_format(wca.create_time, '%Y-%m-%d') >= ?) AND w.id IS NULL AND es.tenant_id = ? AND es.tenant_app_id = ?|122|202|4||0|0|591660|21008|122|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 = ?|89|155|10||0|0|754540|142234|89|1|
|user_service|SELECT tu.user_id, tm.shop_id, mb.erp_member_id AS memberErpId, tu.mobile_no, tu.user_name , ue.employee_id, tm.grade_id FROM user_service.tenant_member tu INNER JOIN user_service.tenant_member_info tm ON tu.tenant_id = tm.tenant_id AND tu.id = tm.id INNER JOIN user_service.tenant_member_bind mb ON tu.tenant_id = mb.tenant_id AND tu.id = mb.id LEFT JOIN user_service.user_employee ue ON tu.tenant_app_id = ue.tenant_wechatapp_id AND tu.user_id = ue.user_id WHERE tu.tenant_id = ? AND tu.tenant_app_id = ? AND tu.status = ? AND mb.erp_member_id IN (?)|86|205|12||0|0|32982464|1327141|4684|225|
|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|81|119|3||0|0|131998|2022|59755|923|
|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|61|83|4||0|0|237179|6608|88|4|
|v4_user|SELECT COUNT(*) AS total FROM member WHERE tenant_id = ? AND tenant_app_id = ?|53|94|5||0|0|14686278|277113|53|1|
|v4_sales|SELECT ifnull(sum(integral), ?) AS points FROM v4_sales.erp_sales es JOIN v4_sales.erp_sales_detail esd ON esd.sales_erp_id = es.sales_erp_id AND esd.tenant_id = ? AND esd.tenant_app_id = ? WHERE es.member_erp_id IN (?) AND es.sales_status = ? AND es.is_sales = ? AND esd.sales_type = ? AND es.tenant_id = ? AND es.tenant_app_id = ?|52|143|6||0|0|1189950|34575|52|1|
|youzan|SELECT id, merchant_id, merchant_shop_id, sync_type, api_name , api_request, api_response, status, error_msg, retry_num , create_time, update_time FROM weimob_platform_sync_log WHERE status = ? AND sync_type IN (?) AND retry_num < ?|49|147|8||0|0|5638467|115073|0|0|
|tenant|SELECT count(0) FROM erp_sales es WHERE es.tenant_id = ? AND es.tenant_wechatapp_id = ? AND es.sales_date >= ? AND es.employee_erp_id = ? AND es.sales_status = ?|48|68|3||0|0|164090|5198|48|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 = ?|33|56|3||0|0|389188|14034|33|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|32|65|2||0|0|233470|7851|14|1|
|gift_mail|SELECT count(*) FROM gift_mail.trade t LEFT JOIN gift_mail.trade_take tt ON tt.trade_id = t.id WHERE t.tenant_id = ? AND t.tenant_wechatapp_id = ? AND t.trade_type = ? AND t.order_status = ? AND t.take_type = ? AND tt.shop_id = ?|24|31|1||0|0|164936|8082|24|1|
|gift_mail|SELECT count(*) FROM gift_mail.trade t LEFT JOIN gift_mail.trade_take tt ON tt.trade_id = t.id WHERE t.tenant_id = ? AND t.tenant_wechatapp_id = ? AND t.trade_type IN (?) AND t.order_status = ? AND t.take_type = ? AND tt.shop_id = ?|23|30|1||0|0|138564|7776|23|1|
|corpwx|UPDATE external_user SET un_assign_flag = ? WHERE tenant_id = ? AND status = ? AND un_assign_flag = ?|23|81|7||0|0|706896|73874|0|0|
|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 ?|22|55|5||0|0|6663781|565782|5|1|
|v4_sales|SELECT round(avg(cd.score), ?) FROM comment c JOIN comment_detail cd ON cd.comment_id = c.id AND cd.tenant_id = ? AND cd.tenant_app_id = ? WHERE c.erp_dept_id = ? AND c.erp_employee_id = ? AND c.create_time BETWEEN ? AND ? AND c.tenant_id = ? AND c.tenant_app_id = ?|20|24|1||0|0|3592825|180175|20|1|
|youzan|SELECT id, merchant_shop_id, api_name, api_request, api_response , status, error_msg, retry_num, sync_type, create_time , update_time FROM youzan_platform_sync_log WHERE status = ? AND retry_num < ? AND create_time > ?|19|38|4||0|0|3335507|175553|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 = ? OR external_user_id = ?) AND status IN (?) AND tenant_id = ? AND tenant_app_id = ?|17|37|3||0|0|132995|7844|4|1|
|v4_sales|SELECT id, comment_id, subject_id, subject_type, subject , score, labels, content, tenant_id, tenant_app_id , create_time, update_time FROM comment_detail WHERE comment_id = ? AND tenant_id = ? AND tenant_app_id = ?|16|23|2||0|0|2868850|180070|80|5|
|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|14|19|2||0|0|23855|2393|14|1|
|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|12|17|4||0|0|66862|17080|75|12|
|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 ?|12|22|3||0|0|556556|54281|12|1|
|warranty_service|SELECT count(*) FROM warranty WHERE user_id = ? AND tenant_wechatapp_id = ? AND is_disable = ?|11|69|14||0|0|142382|29067|11|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|11|16|4||0|0|68615|17236|1377|264|
|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 = ?|9|29|4||0|0|231973|37993|9|1|
|user_service|select tu.user_id,tm.shop_id,mb.erp_member_id memberErpId,tu.mobile_no,tu.user_name,ue.employee_id,tm.grade_id from user_service.tenant_member tu inner join user_service.tenant_member_info tm on tu.tenant_id = tm.tenant_id and tu.id = tm.id inner join user_service.tenant_member_bind mb on tu.tenant_id = mb.tenant_id and tu.id = mb.id left join user_service.user_employee ue on tu.tenant_app_id = ue.tenant_wechatapp_id and tu.user_id = ue.user_id where tu.tenant_id=? and tu.tenant_app_id = ? and tu.status=? and mb.erp_member_id in|9|45|18||0|0|10333758|1891146|2957|529|
|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 < ?|9|13|1||0|0|2025128|225117|9|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 ?|8|10|1||0|0|97316|16222|80|10|
|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|15|3||0|0|113049|26702|8|1|
|coupon_service|SELECT cet.id, cet.coupon_id, cet.user_id, cet.coupon_type, cet.expire_time , if(cet.expire_time < now() AND cet.status = ?, ?, cet.status) AS status FROM coupon_service.coupon_expire_task cet JOIN coupon_service.coupon_extend ce ON ce.tenant_id = ? AND ce.tenant_app_id = ? AND ce.coupon_id = cet.coupon_id WHERE cet.tenant_id = ? AND cet.tenant_app_id = ? AND cet.employee_id = ? AND cet.shop_id = ?|8|11|2||0|0|14712|4362|7356|2181|
|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 = ?|7|11|3||0|0|26450|4702|7|1|
|user_service|SELECT * FROM user_service.user_employee WHERE employee_erp_id = ? AND tenant_id = ? AND tenant_wechatapp_id = ? AND date_format(update_time, '%Y-%m-%d %H') = date_format(now(), '%Y-%m-%d %H')|7|124|25||0|0|1644803|312903|427|417|
|employee|SELECT count(*) FROM label_task_employee t1 JOIN label_task_setting t2 ON t1.label_task_id = t2.id AND t2.disabled = ? WHERE t1.tenant_app_id = ? AND t1.shop_id = ? AND t1.visit_status > ? AND t1.finish_time >= DATE_SUB(CURRENT_DATE, INTERVAL ? DAY) AND t1.finish_time < CURRENT_DATE|7|11|2||0|0|156178|44920|7|1|
|v4_employee|SELECT sum(ifnull(member_integral_balance <= ?, ?)) AS `integral_balance|小于等于50分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|51-100分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|101-200分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|201-300分` , sum(ifnull(member_integral_balance >= ?, ?)) AS `integral_balance|大于等于301分` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|0次` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|1次` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|2次` , sum(ifnull(member_sales_count BETWEEN ? AND ?, ?)) AS `consume_num|3-5次` , sum(ifnull(member_sales_count >= ?, ?)) AS `consume_num|6次以上` , sum(ifnull(shop_id = ?, ?)) AS `shop|市场中心` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙大悦城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙锦华万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙凯德二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙青羊万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙万象城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|广汉老庙一店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙泸县二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟万象汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金宝瑞雅店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州�|6|73|26||0|0|16298880|2716480|6|1|
|authorization_service|update user_login_token set status=? where login_token in|6|13|3||0|0|13998|3525|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.shop_id = ?|6|6|1||0|0|389147|64879|123|41|
|v4_sales|SELECT t1.sales_erp_id AS salesErpId, t1.sales_no AS salesNo, DATE_FORMAT(t1.sales_date, '%Y-%m-%d') AS salesDate , t1.member_erp_id AS memberId, t1.employee_erp_id AS employeeErpId, t1.employee_name AS employeeName, t1.assist_employee_erp_id AS assistEmployeeErpId, t1.assist_employee_name AS assistEmployeeName , t1.dept_erp_id AS deptErpId, t1.amount, t1.post_time AS postTime FROM erp_sales t1 WHERE t1.employee_erp_id = ? AND t1.post_time >= ? AND t1.post_time <= ? AND t1.is_sales = ? AND t1.sales_status = ? AND t1.tenant_id = ? AND t1.tenant_app_id = ?|6|7|1||0|0|26619|6672|13|4|
|v4_employee|SELECT sum(ifnull(shop_id = ?, ?)) AS `shop|市场中心` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙大悦城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙锦华万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙凯德二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙青羊万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙万象城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|广汉老庙一店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙泸县二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟万象汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金宝瑞雅店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金城北店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金金街店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金纳溪二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金时代店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州周大生泸县店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州周大生重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州周大生总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|攀枝花金伯利总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|攀枝花老庙万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|攀枝花六福万达店` , sum(if|6|77|28||0|0|16298880|2716480|6|1|
|v4_user|SELECT id, member_id, external_user_id, serial_number, checkin_shop_id , checkin_employee_id, checkin_employee_name, checkin_time, maintain_shop_id, maintain_employee_id , maintain_employee_name, first_maintain_time, last_maintain_time, next_maintain_time, maintain_num , intention_num, latest_intention, status, finish_time, finish_shop_id , deal_employee_id, deal_employee_name, deal_sale_amount, fail_employee_id, fail_employee_name , fail_reason, remark, sex, cutomer_grade, maintain_level , tenant_id, tenant_app_id, create_time, update_time FROM potential_customer WHERE member_id = ? AND status IN (?) AND maintain_shop_id = ? AND tenant_id = ? AND tenant_app_id = ?|5|6|1||0|0|10220|2052|1|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 = ?|5|7|2||0|0|12464|3525|12464|3525|
|value_added|SELECT ? AS limitDayType, t.tenant_wechatapp_id AS tenantAppId, t.user_id AS userId, min(ue.employee_erp_id) AS employee_erp_id , ue.dept_erp_id, GROUP_CONCAT(t.product_barcode ORDER BY product_barcode ASC) AS productCode, GROUP_CONCAT(t.product_name ORDER BY product_barcode ASC) AS productName FROM value_added_user t INNER JOIN value_added_user_extend ue ON t.id = ue.id WHERE t.tenant_wechatapp_id = ? AND t.state = ? AND t.start_add_time >= date_add(DATE_FORMAT(?, '%Y-%m-%d'), INTERVAL ? * (t.add_days - ?) DAY) AND t.start_add_time < date_add(DATE_FORMAT(?, '%Y-%m-%d'), INTERVAL ? * (t.add_days - ?) + ? DAY) GROUP BY t.tenant_wechatapp_id, t.user_id, ue.dept_erp_id|5|18|12||0|0|1338385|465024|383|144|
|v4_sales|SELECT COUNT(*) AS total FROM value_added_record WHERE value_added_id = ? AND tenant_id = ? AND tenant_app_id = ?|4|23|6||0|0|8224176|2056044|4|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|4|15|5||0|0|85254|29231|24|8|
|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|4|4|1||0|0|31422|8234|15711|4117|
|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 = ?|4|14|7||0|0|711272|323009|4|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 = ?|4|6|1||0|0|438744|165804|4|1|
|v4_sales|SELECT es.id AS salesId, es.sales_no, es.sales_date, es.member_erp_id AS memberId, w.warranty_no FROM v4_sales.erp_sales es LEFT JOIN v4_sales.warranty w ON w.sales_id = es.id AND w.tenant_id = ? AND w.tenant_app_id = ? WHERE is_sales = ? AND sales_status = ? AND (es.sales_no LIKE concat(?, ?) OR es.member_erp_id = ?) AND w.id IS NULL AND es.tenant_id = ? AND es.tenant_app_id = ? ORDER BY es.sales_date DESC, es.id DESC LIMIT ?|4|6|1||0|0|1852436|603189|7|3|
|v4_coupon|UPDATE v4_coupon.coupon SET coupon_status = ? WHERE tenant_id = ? AND tenant_app_id = ? AND coupon_status = ? AND end_time < now()|4|7|3||0|0|854746|817414|0|0|
|order|SELECT count(1) AS total , ifnull(sum(if(od.status > ?, od.payment_fee, ?)), ?) AS paymentFee , ifnull(sum(if(od.status > ?, od.offline_payment_fee, ?)), ?) AS offlinePaymentFee , ifnull(sum(if(od.status > ?, od.payment_fee + od.offline_payment_fee, ?)), ?) AS payTotalFee FROM order_info od LEFT JOIN order_detail dt ON od.id = dt.order_id LEFT JOIN order_address ad ON od.id = ad.order_id WHERE od.tenant_id = ? AND od.tenant_wechatapp_id = ?|4|6|1||0|0|438744|165804|4|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|4||0|0|2257364|574386|41|17|
|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|3|5|2||0|0|38766|26540|10|7|
|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 = ?|3|5|2||0|0|192914|72929|3|1|
|employee|UPDATE backlog_system SET status = ?, finish_time = now() WHERE tenant_app_id = ? AND scene = ?|3|26|23||0|0|1606056|1381976|0|0|
|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 = ?)|3|3|1||0|0|9178|3060|3|1|
|tenant|SELECT count(*) AS amount FROM sneak_guest WHERE tenant_app_id = ? AND status = ? AND create_shop_id = ? AND create_time <= ?|3|3|1||0|0|12348|4117|3|1|
|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 = ?|3|3|1||0|0|27945|9797|0|0|
|coupon_service|SELECT * FROM coupon_service.coupon_can_give WHERE coupon_id = ? LIMIT ?|3|3|1||0|0|934517|316294|3|1|
|v4_employee|SELECT sum(ifnull(shop_id = ?, ?)) AS `shop|达州老庙1店` , sum(ifnull(shop_id = ?, ?)) AS `shop|达州老庙2店` , sum(ifnull(shop_id = ?, ?)) AS `shop|达州老庙3店` , sum(ifnull(shop_id = ?, ?)) AS `shop|达州老庙4店` , sum(ifnull(shop_id = ?, ?)) AS `shop|达州老庙5店` , sum(ifnull(shop_id = ?, ?)) AS `shop|德阳老庙1店` , sum(ifnull(member_sales_amount <= ?, ?)) AS `amount_total_consume|2000元以下` , sum(ifnull(member_sales_amount BETWEEN ? AND ?, ?)) AS `amount_total_consume|2001-10000元` , sum(ifnull(member_sales_amount BETWEEN ? AND ?, ?)) AS `amount_total_consume|10001-50000元` , sum(ifnull(member_sales_amount BETWEEN ? AND ?, ?)) AS `amount_total_consume|50001-99999元` , sum(ifnull(member_sales_amount >= ?, ?)) AS `amount_total_consume|100000元以上` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|0次` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|1次` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|2次` , sum(ifnull(member_sales_count BETWEEN ? AND ?, ?)) AS `consume_num|3-5次` , sum(ifnull(member_sales_count >= ?, ?)) AS `consume_num|6次以上` , sum(ifnull(member_integral_balance <= ?, ?)) AS `integral_balance|2000分以下` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|2001-10000分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|10001-30000分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|30001-50000分` , sum(ifnull(member_integral_balance >= ?, ?)) AS `integral_balance|50001分以上` , sum(ifnull(member_level_id = ?, ?)) AS `member_level|宠粉会籍` , sum(ifnull(member_level_id = ?, ?)) AS `member_level|白银会籍` , sum(ifnull(member_level_id = ?, ?)) AS `member_level|黄金会籍` , sum(ifnull(member_level_id = ?, ?)) AS `member_level|钻石会籍` , sum(ifnull(member_level_id = ?, ?)) AS `member_level|彩宝会籍` , sum(ifnull(member_level_id = ?, ?)) AS `member_level|翡翠会籍` , sum(ifnull(member_age <= ?, ?)) AS `age|25岁�|3|24|21||0|0|8149440|2716480|3|1|
|coupon_service|SELECT count(0) FROM coupon_service.coupon cu JOIN coupon_service.coupon_extend ce ON ce.tenant_id = ? AND ce.tenant_app_id = ? AND ce.id = cu.id JOIN ( SELECT coupon_id FROM coupon_service.coupon_write_off_log wol WHERE wol.tenant_id = ? AND wol.tenant_app_id = ? AND wol.state = ? AND wol.create_time >= ? AND wol.create_time <= ? GROUP BY coupon_id ) w ON w.coupon_id = cu.id WHERE cu.tenant_id = ? AND cu.tenant_app_id = ? AND (cu.coupon_state = ? OR (cu.coupon_state = ? AND ce.writeoff_time IS NOT NULL)) AND cu.source = ?|3|9|6||0|0|49797|22712|3|1|
|user_service|SELECT count(0) FROM user_service.tenant_member t1 JOIN user_service.tenant_member_info t2 ON t1.tenant_id = t2.tenant_id AND t1.id = t2.id AND t2.tenant_app_id = ? AND t2.shop_id = ? WHERE t1.tenant_id = ? AND t1.tenant_app_id = ?|3|7|4||0|0|159254|66586|3|1|
|user_service|SELECT count(*) FROM user_service.user_employee ue WHERE ue.tenant_id = ? AND ue.employee_id = ? AND ue.tenant_wechatapp_id = ? AND ue.shop_id = ?|2|2|1||0|0|6755|3652|2|1|
|coupon_service|SELECT t.id FROM coupon_service.template t LEFT JOIN coupon_service.coupon_scope s ON s.tenant_id = t.tenant_id AND s.tenant_app_id = t.tenant_app_id AND s.template_id = t.id WHERE t.coupon_type = ? AND t.tenant_id = ? AND t.tenant_app_id = ? AND (t.scope = ? OR (s.scope = ? AND s.product_id = ?) OR (s.scope = ? AND s.classify_id = ?))|2|2|1||0|0|43448|21727|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 = ? OR external_user_id = ?) AND status IN (?) AND maintain_shop_id = ? AND tenant_id = ? AND tenant_app_id = ?|2|2|1||0|0|4070|2035|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|2|2|1||0|0|27150|15550|13575|7775|
|gift_mail|SELECT count(0) FROM gift_mail.trade t LEFT JOIN gift_mail.product p ON p.id = t.product_id LEFT JOIN gift_mail.trade_take tt ON tt.trade_id = t.id WHERE t.tenant_wechatapp_id = ? AND t.trade_type = ? AND t.order_status = ?|2|3|2||0|0|34280|17140|2|1|
|v4_employee|SELECT sum(ifnull(member_integral_balance <= ?, ?)) AS `integral_balance|小于等于50分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|51-100分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|101-200分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|201-300分` , sum(ifnull(member_integral_balance >= ?, ?)) AS `integral_balance|大于等于301分` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|0次` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|1次` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|2次` , sum(ifnull(member_sales_count BETWEEN ? AND ?, ?)) AS `consume_num|3-5次` , sum(ifnull(member_sales_count >= ?, ?)) AS `consume_num|6次以上` , sum(ifnull(shop_id = ?, ?)) AS `shop|市场中心` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙大悦城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙锦华万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙凯德二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙青羊万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙万象城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|广汉老庙一店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙泸县二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟万象汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金宝瑞雅店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州�|2|29|18||0|0|5432960|2716480|2|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 NOT NULL AND es.tenant_id = ? AND es.tenant_app_id = ?|2|6|3||0|0|458239|367765|2|1|
|v4_employee|SELECT sum(ifnull(shop_id = ?, ?)) AS `shop|市场中心` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙大悦城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙锦华万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙凯德二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙青羊万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙万象城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|广汉老庙一店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙泸县二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟万象汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金宝瑞雅店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金城北店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金金街店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金纳溪二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金时代店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州周大生泸县店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州周大生重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州周大生总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|攀枝花金伯利总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|攀枝花老庙万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|攀枝花六福万达店` , sum(if|2|3|1||0|0|5432960|2716480|2|1|
|gift_mail|SELECT count(*) FROM gift_mail.trade t WHERE t.tenant_wechatapp_id = ? AND t.trade_type = ? AND t.order_status = ?|2|3|2||0|0|18210|9106|2|1|
|v4_coupon|SELECT tenant_id, tenant_app_id, member_id, count(1) AS total FROM v4_coupon.coupon WHERE DATEDIFF(DATE_FORMAT(end_time, '%Y-%m-%d'), DATE_FORMAT(now(), '%Y-%m-%d')) = ? AND coupon_status IN (?) GROUP BY tenant_id, tenant_app_id, member_id|2|19|11||0|0|1637690|819672|595|301|
|v4_employee|SELECT sum(ifnull(member_integral_balance <= ?, ?)) AS `integral_balance|小于等于50分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|51-100分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|101-200分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|201-300分` , sum(ifnull(member_integral_balance >= ?, ?)) AS `integral_balance|大于等于301分` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|0次` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|1次` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|2次` , sum(ifnull(member_sales_count BETWEEN ? AND ?, ?)) AS `consume_num|3-5次` , sum(ifnull(member_sales_count >= ?, ?)) AS `consume_num|6次以上` , sum(ifnull(shop_id = ?, ?)) AS `shop|市场中心` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙大悦城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙锦华万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙凯德二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙青羊万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙万象城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|广汉老庙一店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙泸县二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟万象汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金宝瑞雅店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州�|2|42|22||0|0|5432960|2716480|2|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.employee_id = ? AND t.tenant_id = ? AND t.tenant_app_id = ?|2|7|4||0|0|270950|135541|2|1|
|v4_sales|SELECT es.id AS salesId, es.sales_no, es.sales_date, es.member_erp_id AS memberId, w.warranty_no FROM v4_sales.erp_sales es LEFT JOIN v4_sales.warranty w ON w.sales_id = es.id AND w.tenant_id = ? AND w.tenant_app_id = ? WHERE is_sales = ? AND sales_status = ? AND (es.sales_no LIKE concat(?, ?) OR es.member_erp_id = ?) AND w.id IS NOT NULL AND es.tenant_id = ? AND es.tenant_app_id = ? ORDER BY es.sales_date DESC, es.id DESC LIMIT ?|2|3|2||0|0|970675|602910|5|3|
|gift_mail|SELECT count(0) FROM ( SELECT t.*, tt.can_take_date, tt.shop_id, tt.shop_name, tt.take_shop_name , tt.take_employee_name, ta.recipients, ta.user_tel , CONCAT(ta.area, ta.address) AS address , if(t.trade_type = ?, pl.id, it.barcode) AS barcode , if(t.trade_type = ?, pl.default_image_url, p.default_image_url) AS defaultImageUrl FROM trade t LEFT JOIN trade_take tt ON t.tenant_wechatapp_id = tt.tenant_wechatapp_id AND t.id = tt.trade_id LEFT JOIN trade_addr ta ON t.tenant_wechatapp_id = ta.tenant_wechatapp_id AND t.id = ta.trade_id LEFT JOIN product p ON p.id = t.product_id LEFT JOIN platform_product pl ON pl.id = t.product_id LEFT JOIN inventory it ON it.product_id = t.product_id AND it.specification = t.specification LEFT JOIN trade_express te ON te.tenant_wechatapp_id = t.tenant_wechatapp_id AND te.trade_id = t.id WHERE t.tenant_wechatapp_id = ? AND t.trade_type = ? ORDER BY create_time DESC ) tmp_count|2|2|1||0|0|95025|54425|2|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 dt.product_name LIKE concat(?, ?, ?)|2|7|4||0|0|90398|45199|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 = ?|1|1|1||0|0|4095|4095|1|1|
|mysql|DELETE FROM wx_gateway.wx_template_msg WHERE create_time < DATE_SUB(now(), INTERVAL ? DAY)|1|34|34||0|0|945011|945011|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 ?, ?|1|1|1||0|0|15136|15136|10|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|1|1|1||0|0|11071|11071|1|1|
|v4_coupon|SELECT COUNT(*) AS total FROM ( SELECT DISTINCT c.id, c.activity_name, c.push_time, c.tag_id, c.butler_call_member FROM v4_coupon.tag_push_coupon c JOIN v4_coupon.tag_push_coupon_log l ON l.tag_push_coupon_id = c.id AND l.push_coupon_state = ? AND l.tenant_id = ? AND l.tenant_app_id = ? WHERE c.push_state = ? AND c.butler_visible = ? AND l.shop_id = ? AND l.employee_id = ? AND c.push_time >= ? AND c.tenant_id = ? AND c.tenant_app_id = ? ORDER BY c.push_time DESC ) c|1|1|1||0|0|282245|282245|1|1|
|v4_user|SELECT td2.added, td1.dealed, td1.failed, td3.maintain FROM ( SELECT count(DISTINCT CASE  WHEN t.event_type = ? THEN t.potential_customer_id ELSE NULL END) AS dealed , count(DISTINCT CASE  WHEN t.event_type = ? THEN t.potential_customer_id ELSE NULL END) AS failed FROM potential_customer_maintain t WHERE t.create_time >= ? AND t.create_time <= ? AND t.event_type IN (?) AND t.tenant_app_id = ? ) td1, ( SELECT count(DISTINCT t1.potential_customer_id) AS added FROM potential_customer_maintain t1 LEFT JOIN potential_customer_maintain t2 ON t1.potential_customer_id = t2.potential_customer_id AND t2.create_time >= ? AND t2.create_time <= ? AND t2.event_type IN (?) AND t2.tenant_app_id = ? WHERE t1.create_time >= ? AND t1.create_time <= ? AND t1.event_type = ? AND t2.id IS NULL AND t1.tenant_app_id = ? ) td2, ( SELECT count(DISTINCT t1.potential_customer_id) AS maintain FROM potential_customer_maintain t1 LEFT JOIN potential_customer_maintain t2 ON t1.potential_customer_id = t2.potential_customer_id AND t2.create_time >= ? AND t2.create_time <= ? AND t2.event_type IN (?) AND t2.tenant_app_id = ? WHERE t1.create_time >= ? AND t1.create_time <= ? AND t1.event_type = ? AND t2.id IS NULL AND t1.tenant_app_id = ? ) td3|1|3|3||0|0|32247|32247|1|1|
||DELETE FROM tenant.sjfx_dct_erp_sales WHERE create_time < ?|1|1|1||0|0|441475|441475|0|0|
|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 ?|1|1|1||0|0|327000|327000|1|1|
|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 = ?|1|2|2||0|0|16951|16951|1|1|
|sms|SELECT count(0) FROM ( SELECT a.phone_numbers AS phoneNo , CONCAT(?, a.sign_name, ?, CASE  WHEN b.content IS NOT NULL THEN b.content WHEN stc.content IS NOT NULL THEN stc.content ELSE a.template_param END) AS content , a.template_code, a.out_id AS outId, a.template_param, a.create_time AS sendTime, a.create_time AS recevieTime , a.code AS state , ifnull(ifnull(e.sms_size, ?) * if(a.code = ?, a.send_count, ?), ?) AS send_count , a.message, a.source_type FROM sms_send a LEFT JOIN sms.sms_send_extend e ON a.biz_id = e.biz_id LEFT JOIN sms_template b ON a.template_code = b.code LEFT JOIN sms_template_custom stc ON a.tenant_app_id = stc.tenant_app_id AND a.template_code = stc.code AND stc.status = ? WHERE a.tenant_id = ? AND a.tenant_app_id = ? AND a.create_time >= ? AND a.create_time < ? ORDER BY a.create_time DESC ) tmp_count|1|3|3||0|0|7730|7730|1|1|
|v4_user|SELECT pc.id, pc.member_id, pc.external_user_id, pc.maintain_num, pc.intention_num , pc.checkin_time, pc.checkin_employee_name AS checkinEmployee, pc.maintain_employee_id, pc.maintain_employee_name AS maintainEmployee, pc.maintain_shop_id , pc.last_maintain_time, pc.cutomer_grade AS cutomerGrade , CASE  WHEN pc.`status` = ? THEN pc.finish_time ELSE NULL END AS dealTime, pc.`status`, pc.fail_employee_name AS failEmployee, pc.finish_time AS finishTime FROM potential_customer pc WHERE EXISTS ( SELECT ? FROM potential_customer_maintain t1 WHERE pc.id = t1.potential_customer_id AND t1.create_time >= ? AND t1.create_time <= ? AND t1.maintain_employee_id = ? AND t1.event_type IN (?) AND t1.tenant_app_id = ? ) AND pc.tenant_app_id = ? ORDER BY pc.id DESC LIMIT ?|1|8|8||0|0|263133|263133|1|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|1|1|1||0|0|4038030|4038030|1|1|
|v4_user|SELECT checkin_time, id FROM potential_customer WHERE maintain_shop_id = ? AND status IN (?) AND tenant_id = ? AND tenant_app_id = ?|1|1|1||0|0|2032|2032|63|63|
|tenant|SELECT id, tenant_id, tenant_app_id, user_id, status , group_label, maintain_level, remark, create_time, create_shop_id , create_employee_id, update_time, update_shop_id, update_employee_id, sales_amount , next_maintain_date, maintain_employee_id, sneak_guest_no, last_maintain_date, finish_date , fail_type, oid, user_type FROM sneak_guest WHERE tenant_app_id = ? AND status = ? AND create_time < ?|1|1|1||0|0|3467|3467|5|5|
|v4_user|SELECT id FROM potential_customer WHERE status IN (?) AND next_maintain_time < ? AND tenant_id = ? AND tenant_app_id = ?|1|4|4||0|0|7829|7829|402|402|
|sms|SELECT t1.tenant_id, t1.tenant_app_id , 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 <= ? GROUP BY t1.tenant_id, t1.tenant_app_id|1|3|3||0|0|38054|38054|1|1|
|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 < ?|1|6|6||0|0|12987|12987|1|1|
|v4_employee|SELECT sum(ifnull(shop_id = ?, ?)) AS `shop|市场中心` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙大悦城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙锦华万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙凯德二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙青羊万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙万象城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|广汉老庙一店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙泸县二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟万象汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金宝瑞雅店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金城北店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金金街店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金纳溪二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金时代店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州周大生泸县店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州周大生重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州周大生总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|攀枝花金伯利总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|攀枝花老庙万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|攀枝花六福万达店` , sum(if|1|1|1||0|0|2716480|2716480|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|20|20||0|0|2098418|2098418|0|0|
|v4_employee|SELECT tmb.tenant_id, tmb.erp_member_id FROM user_service.tenant_member_bind tmb JOIN ( SELECT l.tenant_id, l.user_id FROM user_service.user_employee_alloc_log l WHERE l.tenant_id = ? AND l.alloc_date_time < ? AND l.alloc_date_time >= ? AND remark = ? AND l.tenant_wechatapp_id IN (?) GROUP BY l.tenant_id, l.user_id ) l ON tmb.tenant_id = l.tenant_id AND tmb.user_id = l.user_id WHERE tmb.tenant_id = ?|1|35|35||0|0|90300871|90300871|170|170|
|user_service|SELECT count(0) FROM user_service.tenant_member tm JOIN user_service.tenant_member_info tmi ON tmi.tenant_id = ? AND tmi.tenant_app_id = ? AND tm.id = tmi.id WHERE tm.tenant_id = ? AND tm.tenant_app_id = ? AND (tm.user_name LIKE concat(?, ?, ?) OR tm.mobile_no = ?)|1|1|1||0|0|91478|91478|1|1|
|v4_employee|SELECT COUNT(*) AS total FROM task_task WHERE (task_type = ? AND shop_id = ? AND system_task_type = ? OR (member_name LIKE ? OR member_mobile_no = ?) AND start_time >= ? AND start_time < ? AND finish_time IS NULL) AND tenant_id = ? AND tenant_app_id = ?|1|1|1||0|0|82270|82270|1|1|
|v4_employee|SELECT count(*) FROM user_service.user_employee_alloc_log l WHERE l.tenant_id = ? AND l.alloc_date_time < ? AND l.alloc_date_time >= ? AND remark = ? AND l.tenant_wechatapp_id IN (?) ORDER BY id DESC|1|3|3||0|0|109373|109373|1|1|
|coupon_service|SELECT tenant_id, tenant_app_id, employee_id, count(DISTINCT user_id) AS count FROM coupon_service.coupon_expire_task WHERE tenant_id = ? AND tenant_app_id = ? AND status = ? AND expire_time > now() AND expire_time BETWEEN ? AND ? GROUP BY tenant_id, tenant_app_id, employee_id|1|1|1||0|0|23701|23701|1|1|
|v4_employee|SELECT COUNT(*) AS total FROM task_task WHERE (task_type = ? AND shop_id = ? AND system_task_type = ? OR (member_name LIKE ? OR member_mobile_no = ?) AND start_time >= ? AND start_time < ?) AND tenant_id = ? AND tenant_app_id = ?|1|1|1||0|0|82270|82270|1|1|
|v4_user|SELECT td0.shop_id AS shopId, ifnull(td2.added, ?) AS added , ifnull(td1.dealed, ?) AS dealed , ifnull(td1.failed, ?) AS failed , ifnull(td3.maintain, ?) AS maintain FROM ( SELECT DISTINCT t.maintain_shop_id AS shop_id FROM potential_customer_maintain t WHERE t.create_time >= ? AND t.create_time <= ? AND t.event_type IN (?) AND t.tenant_app_id = ? ) td0 LEFT JOIN ( SELECT t.maintain_shop_id AS shop_id , count(DISTINCT CASE  WHEN t.event_type = ? THEN t.potential_customer_id ELSE NULL END) AS dealed , count(DISTINCT CASE  WHEN t.event_type = ? THEN t.potential_customer_id ELSE NULL END) AS failed FROM potential_customer_maintain t WHERE t.create_time >= ? AND t.create_time <= ? AND t.event_type IN (?) AND t.tenant_app_id = ? GROUP BY t.maintain_shop_id ) td1 ON td0.shop_id = td1.shop_id LEFT JOIN ( SELECT t1.maintain_shop_id AS shop_id, count(DISTINCT t1.potential_customer_id) AS added FROM potential_customer_maintain t1 LEFT JOIN potential_customer_maintain t2 ON t1.potential_customer_id = t2.potential_customer_id AND t2.create_time >= ? AND t2.create_time <= ? AND t2.event_type IN (?) AND t2.tenant_app_id = ? WHERE t1.create_time >= ? AND t1.create_time <= ? AND t1.event_type = ? AND t2.id IS NULL AND t1.tenant_app_id = ? GROUP BY t1.maintain_shop_id ) td2 ON td0.shop_id = td2.shop_id LEFT JOIN ( SELECT t1.maintain_shop_id AS shop_id, count(DISTINCT t1.potential_customer_id) AS maintain FROM potential_customer_maintain t1 LEFT JOIN potential_customer_maintain t2 ON t1.potential_customer_id = t2.potential_customer_id AND t2.create_time >= ? AND t2.create_time <= ? AND t2.event_type IN (?) AND t2.tenant_app_id = ? WHERE t1.create_time >= ? AND t1.create_time <= ? AND t1.event_type = ? AND t2.id IS NULL AND t1.tenant_app_id = ? GROUP BY t1.maintain_shop_id ) td3 ON td0.shop_id = td3.shop_id|1|3|3||0|0|45906|45906|9|9|
|v4_user|SELECT maintain_employee_id, id FROM potential_customer WHERE maintain_shop_id = ? AND status IN (?) AND tenant_id = ? AND tenant_app_id = ?|1|1|1||0|0|2032|2032|63|63|
|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|464535|464535|38|38|
|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 = ?)|1|1|1||0|0|477440|477440|1|1|
|order|SELECT max(create_time) FROM `order`.order_operator_log WHERE tenant_wechatapp_id = ? AND order_id = ?|1|4|4||0|0|1060384|1060384|1|1|
|user_service|SELECT tm.user_id AS id, tm.user_name AS userName, tm.head_img_url AS headImgUrl, tm.user_name AS nickName, tm.mobile_no AS mobile , tm.sex FROM user_service.tenant_member tm WHERE tm.tenant_id = ? AND tm.tenant_app_id = ? AND (tm.user_name LIKE CONCAT(?, ?, ?) OR tm.mobile_no = ?) ORDER BY tm.id DESC LIMIT ?|1|1|1||0|0|395282|395282|1|1|
|v4_employee|SELECT tmb.tenant_id, tmb.erp_member_id FROM user_service.tenant_member_bind tmb JOIN ( SELECT l.tenant_id, l.user_id FROM user_service.user_employee_alloc_log l WHERE l.tenant_id = ? AND l.alloc_date_time < ? AND l.alloc_date_time >= ? AND remark = ? AND l.tenant_wechatapp_id IN (?) GROUP BY l.tenant_id, l.user_id ) l ON tmb.tenant_id = l.tenant_id AND tmb.user_id = l.user_id|1|17|17||0|0|29399629|29399629|55|55|
|v4_sales|SELECT t1.sales_erp_id AS salesErpId, t1.sales_no AS salesNo, DATE_FORMAT(t1.sales_date, '%Y-%m-%d') AS salesDate , t1.member_erp_id AS memberId, t1.employee_erp_id AS employeeErpId, t1.employee_name AS employeeName, t1.assist_employee_erp_id AS assistEmployeeErpId, t1.assist_employee_name AS assistEmployeeName , t1.dept_erp_id AS deptErpId, t1.amount, t1.post_time AS postTime FROM erp_sales t1 WHERE t1.dept_erp_id = ? AND t1.member_erp_id IN (?) AND t1.post_time >= ? AND t1.is_sales = ? AND t1.sales_status = ? AND t1.tenant_id = ? AND t1.tenant_app_id = ?|1|1|1||0|0|1124|1124|210|210|
|v4_employee|SELECT count(*) FROM tenant.erp_sales WHERE tenant_id = ?|1|4|4||0|0|2310286|2310286|1|1|
|tenant|SELECT esd.id, esd.sales_erp_id, es.employee_name, esd.product_barcode, es.sales_no , es.member_erp_id, esd.category_name, es.sales_date, esd.category_erp_id, esd.product_name , esd.cert_no, esd.amount_pay, esd.sales_index , ifnull(ee.not_add_value_plan, ?) AS not_add_value_plan FROM erp_sales_detail esd JOIN erp_sales es ON es.tenant_id = esd.tenant_id AND es.tenant_wechatapp_id = esd.tenant_wechatapp_id AND es.sales_erp_id = esd.sales_erp_id LEFT JOIN erp_sales_extend ee ON ee.tenant_id = es.tenant_id AND es.tenant_wechatapp_id = ee.tenant_wechatapp_id AND es.sales_erp_id = ee.sales_erp_id AND esd.sales_index = ee.sales_index WHERE esd.tenant_id = ? AND es.sales_status = ? AND es.tenant_wechatapp_id = ? AND esd.product_barcode = ? ORDER BY es.sales_date DESC|1|1|1||0|0|3398|3398|511|511|
|order|SELECT count(1) AS total , ifnull(sum(if(od.status > ?, od.payment_fee, ?)), ?) AS paymentFee , ifnull(sum(if(od.status > ?, od.offline_payment_fee, ?)), ?) AS offlinePaymentFee , ifnull(sum(if(od.status > ?, od.payment_fee + od.offline_payment_fee, ?)), ?) AS payTotalFee FROM order_info od LEFT JOIN order_detail dt ON od.id = dt.order_id LEFT JOIN order_address ad ON od.id = ad.order_id WHERE od.tenant_id = ? AND od.tenant_wechatapp_id = ? AND dt.product_name LIKE concat(?, ?, ?)|1|4|4||0|0|45199|45199|1|1|
|tenant|SELECT count(*) FROM sneak_guest WHERE tenant_app_id = ? AND status = ? AND create_shop_id = ? AND maintain_employee_id = ?|1|1|1||0|0|738|738|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|1|1||0|0|7086|7086|10|10|
|mysql|DELETE FROM message_push.message_log WHERE create_time < DATE_SUB(now(), INTERVAL ? DAY)|1|80|80||0|0|2888581|2888581|0|0|
||DELETE FROM tenant.sjfx_dct_erp_sales_detail WHERE create_time < ?|1|2|2||0|0|1049375|1049375|0|0|
|v4_employee|SELECT sum(ifnull(shop_id = ?, ?)) AS `shop|市场中心` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙大悦城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙锦华万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙凯德二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙青羊万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙万象城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|广汉老庙一店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙泸县二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟万象汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金宝瑞雅店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金城北店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金金街店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金纳溪二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金时代店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州周大生泸县店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州周大生重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州周大生总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|攀枝花金伯利总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|攀枝花老庙万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|攀枝花六福万达店` , sum(if|1|1|1||0|0|2716480|2716480|1|1|
|value_added|SELECT ID, tenant_wechatapp_id AS tenantWechatappId, user_id AS userId, template_id AS templateId, sales_erp_id AS saleserpid , product_name AS productName, shop_name AS shopName, product_barcode AS productBarcode, amount_total AS amountTotal, amount_pay AS amountPay , amount_added AS amountAdded, state AS state, add_days, added_percent_per_day AS addedPercentPerDay, devalue_percent_per_day AS devaluePercentPerDay , keeping_days AS keepingDays, exchange_days AS exchangeDays, coupon_user_id AS couponUserId, sales_index AS salesIndex, start_add_time AS createtime , DATE_ADD(start_add_time, INTERVAL add_days - ? DAY) , DATE_ADD(start_add_time, INTERVAL add_days + keeping_days - ? DAY) FROM value_added_user WHERE state = ? AND start_add_time = date_add(CURDATE(), INTERVAL ? * (add_days + keeping_days - ?) DAY)|1|2|2||0|0|2098418|2098418|949|949|
|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|3|3||0|0|8533|8533|352|352|
|corpwx_license|DELETE FROM cwx_sync_active_info WHERE tenant_id = ? AND user_id = ? AND tenant_id = ?|1|1|1||0|0|27640|27640|0|0|
|order|SELECT count(1) AS total , ifnull(sum(if(od.status > ?, od.payment_fee, ?)), ?) AS paymentFee , ifnull(sum(if(od.status > ?, od.offline_payment_fee, ?)), ?) AS offlinePaymentFee , ifnull(sum(if(od.status > ?, od.payment_fee + od.offline_payment_fee, ?)), ?) AS payTotalFee FROM order_info od LEFT JOIN order_detail dt ON od.id = dt.order_id LEFT JOIN order_address ad ON od.id = ad.order_id WHERE od.tenant_id = ? AND od.tenant_wechatapp_id = ? AND od.order_no LIKE concat(?, ?, ?)|1|2|2||0|0|55271|55271|1|1|
||DELETE FROM tenant.sjfx_dct_erp_sales_detail_extend WHERE create_time < ?|1|1|1||0|0|638160|638160|0|0|
|v4_employee|SELECT sum(ifnull(member_integral_balance <= ?, ?)) AS `integral_balance|2000分以下` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|2001-10000分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|10001-30000分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|30001-50000分` , sum(ifnull(member_integral_balance >= ?, ?)) AS `integral_balance|50001分以上` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|0次` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|1次` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|2次` , sum(ifnull(member_sales_count BETWEEN ? AND ?, ?)) AS `consume_num|3-5次` , sum(ifnull(member_sales_count >= ?, ?)) AS `consume_num|6次以上` , sum(ifnull(shop_id = ?, ?)) AS `shop|达州老庙1店` , sum(ifnull(shop_id = ?, ?)) AS `shop|达州老庙2店` , sum(ifnull(shop_id = ?, ?)) AS `shop|达州老庙3店` , sum(ifnull(shop_id = ?, ?)) AS `shop|达州老庙4店` , sum(ifnull(shop_id = ?, ?)) AS `shop|达州老庙5店` , sum(ifnull(shop_id = ?, ?)) AS `shop|德阳老庙1店` , sum(ifnull(member_level_id = ?, ?)) AS `member_level|宠粉会籍` , sum(ifnull(member_level_id = ?, ?)) AS `member_level|白银会籍` , sum(ifnull(member_level_id = ?, ?)) AS `member_level|黄金会籍` , sum(ifnull(member_level_id = ?, ?)) AS `member_level|钻石会籍` , sum(ifnull(member_level_id = ?, ?)) AS `member_level|彩宝会籍` , sum(ifnull(member_level_id = ?, ?)) AS `member_level|翡翠会籍` , sum(ifnull(member_sales_amount <= ?, ?)) AS `amount_total_consume|2000元以下` , sum(ifnull(member_sales_amount BETWEEN ? AND ?, ?)) AS `amount_total_consume|2001-10000元` , sum(ifnull(member_sales_amount BETWEEN ? AND ?, ?)) AS `amount_total_consume|10001-50000元` , sum(ifnull(member_sales_amount BETWEEN ? AND ?, ?)) AS `amount_total_consume|50001-99999元` , sum(ifnull(member_sales_amount >= ?, ?)) AS `amount_total_consume|100000元以上` , sum(ifnull(member_sex = ?, ?)) AS `sex|男` , |1|11|11||0|0|2716480|2716480|1|1|
|v4_employee|SELECT COUNT(*) AS total FROM task_task WHERE (task_type = ? AND shop_id = ? AND employee_id = ? AND system_task_type = ? OR (member_name LIKE ? OR member_mobile_no = ?) AND start_time >= ? AND start_time < ?) AND tenant_id = ? AND tenant_app_id = ?|1|1|1||0|0|47519|47519|1|1|
|tenant|SELECT es.sales_erp_id FROM tenant.erp_sales es JOIN tenant.erp_sales_detail esd ON esd.tenant_id = ? AND esd.tenant_wechatapp_id = ? AND esd.sales_erp_id = es.sales_erp_id WHERE es.tenant_id = ? AND es.tenant_wechatapp_id = ? AND member_erp_id = ? AND es.sales_status = ? AND es.is_sales = ? AND (esd.product_barcode = ? OR esd.product_name LIKE concat(?, ?, ?))|1|6|6||0|0|66609|66609|0|0|
|v4_employee|SELECT count(*) FROM user_service.user_employee_alloc_log l WHERE l.tenant_id = ? AND l.alloc_date_time < ? AND l.alloc_date_time >= ? AND remark = ? ORDER BY id DESC|1|30|30||0|0|4475812|4475812|0|0|
|gift_mail|SELECT count(*) FROM gift_mail.trade WHERE tenant_wechatapp_id = ? AND trade_type = ?|1|2|2||0|0|4019|4019|1|1|
||SELECT sales_erp_id FROM tenant.erp_sales es WHERE es.tenant_id = ? AND es.create_time >= ? AND is_sales = ? AND sales_status = ?|1|1|1||0|0|33368|33368|29068|29068|
|order|SELECT od.id, od.order_no AS orderNo, od.status, od.take_type AS takeType, od.create_time AS createTime , od.remark, od.total_fee AS totalFee, od.freight_fee AS freightFee, od.discount_fee AS discountFee, od.take_id AS takeId , od.payment_fee AS paymentFee, dt.product_id AS productId, dt.price, dt.quantity, dt.sku_id AS skuId , dt.art_no AS artNo, dt.image_url AS imageUrl, dt.product_name AS productName, dt.take_remark AS takeRemark, dt.take_day AS takeDay , od.product_fee AS productFee, od.finish_type AS finishType, od.send_time AS sendTime, od.receive_time AS receiveTime, od.finish_time AS finishTime , od.child_status AS childStatus, od.send_good_remark AS sendGoodRemark, od.service_flag AS serviceFlag, od.coupon_id AS couponId, od.tenant_wechatapp_id AS tenantAppId , od.tenant_id AS tenantId, od.pay_id AS payId, od.user_id AS userId, od.user_name AS userName, od.mobile_no AS buyMobileNo , od.activity_id, od.offline_payment_fee, od.activity_type, dt.spec, od.take_shop_id , od.take_shop_name, od.take_employee_user_id, od.take_employee_user_name FROM order_info od LEFT JOIN order_detail dt ON od.id = dt.order_id WHERE od.status = ? AND od.receive_time <= ?|1|3|3||0|0|255946|255946|71|71|
|coupon_service|SELECT count(0) FROM coupon_service.coupon cu JOIN coupon_service.coupon_extend ce ON ce.tenant_id = ? AND ce.tenant_app_id = ? AND ce.id = cu.id JOIN ( SELECT coupon_id FROM coupon_service.coupon_write_off_log wol WHERE wol.tenant_id = ? AND wol.tenant_app_id = ? AND wol.state = ? AND wol.create_time >= ? AND wol.create_time <= ? GROUP BY coupon_id ) w ON w.coupon_id = cu.id WHERE cu.tenant_id = ? AND cu.tenant_app_id = ? AND cu.coupon_name LIKE CONCAT(CONCAT(?, ?), ?) AND (cu.coupon_state = ? OR (cu.coupon_state = ? AND ce.writeoff_time IS NOT NULL)) AND cu.source = ?|1|2|2||0|0|16489|16489|1|1|
|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|113|113||0|0|11503940|11503940|24785|24785|
|v4_sales|SELECT * FROM v4_sales.value_added_record WHERE value_added_id = ? AND date_format(create_time, '%Y-%m-%d') = ? AND tenant_id = ? AND tenant_app_id = ?|1|5|5||0|0|2053074|2053074|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.tenant_id FROM order_info od LEFT JOIN order_detail dt ON od.id = dt.order_id LEFT JOIN order_address ad ON od.id = ad.order_id WHERE od.status = ? AND od.send_time <= ? AND od.take_type = ?|1|3|3||0|0|255875|255875|0|0|
|value_added|SELECT ID, tenant_wechatapp_id AS tenantWechatappId, user_id AS userId, template_id AS templateId, sales_erp_id AS saleserpid , product_name AS productName, shop_name AS shopName, product_barcode AS productBarcode, amount_total AS amountTotal, amount_pay AS amountPay , amount_added AS amountAdded, state AS state, add_days, added_percent_per_day AS addedPercentPerDay, devalue_percent_per_day AS devaluePercentPerDay , keeping_days AS keepingDays, exchange_days AS exchangeDays, coupon_user_id AS couponUserId, sales_index AS salesIndex, start_add_time AS createtime , DATE_ADD(start_add_time, INTERVAL add_days - ? DAY) , DATE_ADD(start_add_time, INTERVAL add_days + keeping_days - ? DAY) FROM value_added_user WHERE keeping_days > ? AND state = ? AND start_add_time = date_add(CURDATE(), INTERVAL ? * (add_days - ?) DAY)|1|12|12||0|0|2098418|2098418|956|956|
|v4_user|SELECT COUNT(*) AS total FROM potential_customer pc WHERE EXISTS ( SELECT ? FROM potential_customer_maintain t1 WHERE pc.id = t1.potential_customer_id AND t1.create_time >= ? AND t1.create_time <= ? AND t1.maintain_employee_id = ? AND t1.event_type IN (?) AND t1.tenant_app_id = ? ) AND pc.tenant_app_id = ?|1|12|12||0|0|194013|194013|1|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.order_no LIKE concat(?, ?, ?)|1|2|2||0|0|55271|55271|1|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 = ?|1|1|1||0|0|3788|3788|1|1|
|v4_employee|SELECT sum(ifnull(member_integral_balance <= ?, ?)) AS `integral_balance|小于等于50分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|51-100分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|101-200分` , sum(ifnull(member_integral_balance BETWEEN ? AND ?, ?)) AS `integral_balance|201-300分` , sum(ifnull(member_integral_balance >= ?, ?)) AS `integral_balance|大于等于301分` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|0次` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|1次` , sum(ifnull(member_sales_count = ?, ?)) AS `consume_num|2次` , sum(ifnull(member_sales_count BETWEEN ? AND ?, ?)) AS `consume_num|3-5次` , sum(ifnull(member_sales_count >= ?, ?)) AS `consume_num|6次以上` , sum(ifnull(shop_id = ?, ?)) AS `shop|市场中心` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙大悦城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙锦华万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙凯德二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙青羊万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|成都老庙万象城店` , sum(ifnull(shop_id = ?, ?)) AS `shop|广汉老庙一店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州金伯利总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙欢乐汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙泸县二店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙万达店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州老庙总店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟万象汇店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州谢瑞麟重百店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州中金宝瑞雅店` , sum(ifnull(shop_id = ?, ?)) AS `shop|泸州�|1|22|22||0|0|2716480|2716480|1|1|
|value_added|SELECT count(0) FROM ( SELECT t1.id, t2.sales_no AS salesNo, DATE_FORMAT(t2.sales_date, '%Y-%m-%d') AS salesDate , DATE_FORMAT(t1.start_add_time, '%Y-%m-%d') AS valueAddDate, t2.dept_erp_id AS shopId , t1.shop_name AS shopName, t2.employee_erp_id AS userId, t2.employee_name AS userName, t1.product_name AS productName, t1.amount_pay AS amountPay , t1.id AS valueAddNo, t1.amount_added AS valueAddAmount, t1.state , if(t1.state = ?, t1.coupon_user_id, NULL) AS valueAddCoupon , t1.user_id AS memberUserId , CASE  WHEN start_add_time > ? THEN ? WHEN DATE_ADD(start_add_time, INTERVAL add_days DAY) > ? AND state = ? THEN ? WHEN DATE_ADD(start_add_time, INTERVAL add_days + keeping_days DAY) > ? AND DATE_ADD(start_add_time, INTERVAL add_days DAY) < ? AND state = ? THEN ? WHEN DATE_ADD(start_add_time, INTERVAL add_days + keeping_days DAY) < ? AND amount_added > ? AND state = ? THEN ? ELSE ? END AS addedStatus FROM value_added.value_added_user t1 JOIN value_added.`value_added_user_extend` t2 ON t1.id = t2.id WHERE t1.tenant_wechatapp_id = ? AND t2.dept_erp_id = ? AND t2.employee_erp_id IN (?) AND t2.employee_erp_id = ? AND t2.sales_date >= ? AND t2.sales_date < ? AND t1.state != ? ) tmp_count|1|2|2||0|0|16388|16388|1|1|
|value_added|SELECT t1.id, t2.sales_no AS salesNo, DATE_FORMAT(t2.sales_date, '%Y-%m-%d') AS salesDate , DATE_FORMAT(t1.start_add_time, '%Y-%m-%d') AS valueAddDate, t2.dept_erp_id AS shopId , t1.shop_name AS shopName, t2.employee_erp_id AS userId, t2.employee_name AS userName, t1.product_name AS productName, t1.amount_pay AS amountPay , t1.id AS valueAddNo, t1.amount_added AS valueAddAmount, t1.state , if(t1.state = ?, t1.coupon_user_id, NULL) AS valueAddCoupon , t1.user_id AS memberUserId , CASE  WHEN start_add_time > ? THEN ? WHEN DATE_ADD(start_add_time, INTERVAL add_days DAY) > ? AND state = ? THEN ? WHEN DATE_ADD(start_add_time, INTERVAL add_days + keeping_days DAY) > ? AND DATE_ADD(start_add_time, INTERVAL add_days DAY) < ? AND state = ? THEN ? WHEN DATE_ADD(start_add_time, INTERVAL add_days + keeping_days DAY) < ? AND amount_added > ? AND state = ? THEN ? ELSE ? END AS addedStatus FROM value_added.value_added_user t1 JOIN value_added.`value_added_user_extend` t2 ON t1.id = t2.id WHERE t1.tenant_wechatapp_id = ? AND t2.dept_erp_id = ? AND t2.employee_erp_id IN (?) AND t2.employee_erp_id = ? AND t2.sales_date >= ? AND t2.sales_date < ? AND t1.state != ? LIMIT ?|1|2|2||0|0|16795|16795|1|1|
