|数据库名称|SQL语句|总执行次数|总执行时间(秒)|最大执行时长|平均执行时间|锁定总时长|最大锁定时长|解析总行数|解析最大行数|返回总行数|返回最大行数|
| - | - | - | - | - | - | - | - | - | - | - | - |
|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 ) , :1 ) ) as price , ifnull ( t.quantity , :2 ) quantity , pt.partner_name vendorname , 0.0 distance , c.categroy_name categroy_name , pp.partner_id from product p inner join category c on c.id = p.category_id left outer join self_product sp on p.id = sp.product_id left outer join partner_product pp on p.id = pp.product_id left outer join partner pt on pt.id = pp.partner_id left outer join ( select product_id , sum ( quantity ) quantity from gift_mail.inventory group by product_id ) t on p.id = t.product_id where ( ( p.is_disable is null or p.is_disable = :3 ) ) ) as p where ( p.tenant_id = :4 and p.product_type = :5 )|166|240|2||0|0|3139674|18949|166|1|
|gift_mail|select * from ( select p.* , sp.take_type , ifnull ( pp.integral_price , ifnull ( ( select min ( inventory.price ) from inventory where inventory.product_id = p.id ) , :1 ) ) as price , ifnull ( t.quantity , :2 ) quantity , pt.partner_name vendorname , 0.0 distance , c.categroy_name categroy_name , pp.partner_id from product p inner join category c on c.id = p.category_id left outer join self_product sp on p.id = sp.product_id left outer join partner_product pp on p.id = pp.product_id left outer join partner pt on pt.id = pp.partner_id left outer join ( select product_id , sum ( quantity ) quantity from gift_mail.inventory group by product_id ) t on p.id = t.product_id where ( ( p.is_disable is null or p.is_disable = :3 ) ) ) as p where ( p.tenant_id = :4 and p.product_type = :5 ) order by p.id desc limit :6|129|184|2||0|0|2443111|18969|2351|20|
|user_service|select count ( * ) from tenant_user t1 left join user_employee t3 on t1.user_id = t3.user_id and t1.tenant_app_id = t3.tenant_wechatapp_id where t3.id is null and t1.mobile_no is not null and t1.mobile_no != :1 and t1.shop_id = :2 and t1.tenant_app_id = :3|84|455|15||0|0|9328157|177786|83|1|
|platform|select count ( 1 ) from `salesdetaillog` where `vendorid` = :1 and `noteid` = :2|46|93|3||0|0|1298604|33777|46|1|
|platform|select `tasktype` , `tasktime` , `taskstatus` , `bid` , `vendorid` , `uid` , `completetime` , `remark` , `createtime` , `id` from `taskassignment` where tasktype = :1 and vendorid = :2 and date_format ( tasktime , :3 ) >= curdate ( ) and ( taskstatus = :4 or taskstatus = :5 )|38|75|4||0|0|28851490|759260|15|9|
|platform|select count ( 1 ) from coupondetail cd where getuid = :1 and ( couponstate = :2 or couponstate = :3 ) and date_format ( expirytime , :4 ) >= curdate ( )|34|77|3||0|0|10955616|322224|34|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 from user_login_token where ( tenant_id = :1 and account_id = :2 and status = :3 )|30|47|3||0|0|6709202|371334|61|3|
|platform|select `typefullname` , `methodname` , `arguments` , `partition` , `offset` , `createtime` , `updatetime` , `retried` , `errormsg` , `id` from `pushlog` where `typefullname` = :1 and `methodname` = :2 and `arguments` = :3|28|51|2||0|0|6976739|254311|1|1|
|value_added|select id , template_name as templatename , added_percent_per_day as addedpercentperday , add_days as adddays , keeping_days as keepingdays , devalue_percent_per_day as devaluepercentperday , exchange_days as exchangedays , is_disable as isdisable , effective_days as effectivedays , ifnull ( usenumber , 0 ) as usenumber , generator_method as generatormethod , remark as remark from value_added_template left join ( select template_id , count ( * ) usenumber from value_added_user where tenant_wechatapp_id = :1 group by template_id ) value_added_user on value_added_template.id = value_added_user.template_id where tenant_wechatapp_id = :2 and id = :3|27|40|3||0|0|1851046|76611|27|1|
|platform|select count ( 1 ) from `integrallog` where `vendorid` = :1 and `changefrom` = :2 and `changeid` = :3|22|39|2||0|0|570706|32425|22|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 from user_login_token where employee_id = :1 and tenant_id = :2 and tenant_wx_app_id = :3 and shop_id = :4 and login_way = :5 and status = :6|21|53|7||0|0|1620327|140396|21|2|
|user_service|select count ( 0 ) from ( select t1.user_id as userid , t2.head_img_url as headimgurl , t2.nick_name as nickname , t1.mobile_no as mobileno , t1.is_subscribe as subscribe , t1.sex , t1.tenant_union_id as tenantunionid , date_format ( t1.bind_time , '%y-%m-%d%h:%i:%s' ) as registertime , t1.id as tenantuserid from tenant_user t1 join `user` t2 on t1.user_id = t2.id left join user_employee t3 on t1.user_id = t3.user_id and t1.tenant_id = t3.tenant_id and t1.tenant_app_id = t3.tenant_wechatapp_id where t3.id is null and t1.mobile_no is not null and t1.mobile_no != :1 and t1.shop_id = :2 and t1.tenant_id = :3 and t1.tenant_app_id = :4 ) table_count|20|36|3||0|0|2944569|184943|20|1|
|user_service|select ue.employee_id as employeeid , count ( * ) as quantity from user_service.user_employee ue join user_service.tenant_user tu on ue.tenant_wechatapp_id = tu.tenant_app_id and ue.user_id = tu.user_id where employee_id in ( :1 ) and ue.tenant_wechatapp_id = :2 and tu.shop_id = :3 group by ue.employee_id|13|21|3||0|0|1016636|106071|13|1|
|warranty_service|select *from warranty_service.warranty where tenant_wechatapp_id = :1 and upload_frequency <= :2 and version = :3 and warranty_img_url is null|10|25|7||0|0|369992|90348|0|0|
|tenant|select id , sales_no , sales_date , member_erp_id , sales_erp_id , is_sales from erp_sales where sales_no like concat ( :1 , :2 , :3 ) and sales_status = :4 and tenant_id = :5 and tenant_wechatapp_id = :6 order by sales_date desc limit :7|10|25|4||0|0|2631790|478538|2|1|
|erp_sync|select * from erp_sync.retry_data where ( need_erp_member_id = :1 or ( need_erp_member_id = :2 and erp_member_id is not null ) ) and retry_times > :3 order by id asc|10|17|2||0|0|1152932|115324|181|19|
|facepass_sync|select id , tenant_id , tenant_wechatapp_id , shop_id , status , create_time , update_time , receive_data , response_data from customer_face_sync_message where status = :1 and create_time < date_add ( now ( ) , interval :2 minute ) order by id asc limit :3|9|14|2||0|0|346212|40427|0|0|
|authorization_service|update user_login_token set status = :1 , update_time = now ( ) where employee_id = :2 and tenant_id = :3 and tenant_wx_app_id = :4 and shop_id = :5 and login_way = :6 and status = :7|9|11|1||0|0|805039|140409|0|0|
|wx_gateway|select * from wx_user where user_id = :1 and open_id not like :2 limit :3|8|35|7||0|0|10161164|1764608|8|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 from user_login_token where ( tenant_id = :1 and account_id = :2 and status = :3 and tenant_wx_app_id = :4 )|8|16|6||0|0|2475586|341838|3|1|
|platform|select `noteid` , `vendorid` , `detailindex` , `productname` , `productbarcode` , `category` , `salestype` , `quantity` , `amount` , `integral` , `productdesc` , `slid` , `paidamount` , `id` from `salesdetaillog` where `noteid` = :1 and `vendorid` = :2|8|17|3||0|0|197878|33736|13|4|
|employee|update backlog set leave_flag = :1 where tenant_app_id = :2 and employee_id = :3|7|31|7||0|0|957306|185855|0|0|
|employee|select * from backlog where tenant_app_id = :1 and employee_id = :2 and status in ( :3 , :4 ) and shop_id = :5 and scene = :6 and expire_time >= :7 order by create_time desc limit :8|7|19|3||0|0|1110419|185855|23|7|
|payment|select original_task_id from job_status_trace_log where task_id = :1 and state = :2|6|9|2||0|0|63531|10590|63531|10590|
|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 ) , :1 ) ) as price , ifnull ( t.quantity , :2 ) quantity , pt.partner_name vendorname , 0.0 distance , c.categroy_name categroy_name , pp.partner_id from product p inner join category c on c.id = p.category_id left outer join self_product sp on p.id = sp.product_id left outer join partner_product pp on p.id = pp.product_id left outer join partner pt on pt.id = pp.partner_id left outer join ( select product_id , sum ( quantity ) quantity from gift_mail.inventory group by product_id ) t on p.id = t.product_id where ( ( p.is_disable is null or p.is_disable = :3 ) ) ) as p where ( p.tenant_id = :4 and p.categroy_name like :5 and p.product_type = :6 )|6|8|1||0|0|113355|18920|6|1|
|user_service|select count ( * ) from tenant_user where tenant_app_id = :1 and shop_id = :2 and mobile_no is not null and mobile_no != :3|6|18|8||0|0|386909|177587|6|1|
|order|select max ( create_time ) from `order`.order_operator_log where tenant_wechatapp_id = :1 and order_id = :2|6|6|1||0|0|1802528|300457|6|1|
|platform|update vendormember vm inner join ( select sum ( integral ) as integral , sum ( if ( integral > 0 , integral , 0 ) ) as hisintegral from integrallog where vendorid = :1 and memberid = :2 and isdeleted = :3 ) s on :4 = :5 set vm.integral = ifnull ( s.integral , :6 ) , vm.hisintegral = ifnull ( s.hisintegral , :7 ) , vm.updatetime = now ( ) where vendorid = :8 and memberid = :9|5|6|1||0|0|102|33|0|0|
|user_service|select count ( 0 ) from `user` where user_name like concat ( :1 , :2 , :3 ) or mobile_no = :4 or nick_name like concat ( :5 , :6 , :7 )|5|48|15||0|0|17672636|3615711|3|1|
|user_service|select count ( * ) from user_service.user_employee ue join user_service.tenant_user tu on tu.user_id = ue.user_id and tu.tenant_app_id = ue.tenant_wechatapp_id where ue.employee_id = :1 and ue.tenant_wechatapp_id = :2 and tu.shop_id = :3|4|6|3||0|0|48500|16348|4|1|
|user_service|select * from user_employee where employee_erp_id = :1 and tenant_id = :2 and date_format ( update_time , :3 ) = date_format ( now ( ) , :4 )|4|4|1||0|0|5893430|1473597|163|135|
|gift_mail|select * from ( select p.* , sp.take_type , ifnull ( pp.integral_price , ifnull ( ( select min ( inventory.price ) from inventory where inventory.product_id = p.id ) , :1 ) ) as price , ifnull ( t.quantity , :2 ) quantity , pt.partner_name vendorname , 0.0 distance , c.categroy_name categroy_name , pp.partner_id from product p inner join category c on c.id = p.category_id left outer join self_product sp on p.id = sp.product_id left outer join partner_product pp on p.id = pp.product_id left outer join partner pt on pt.id = pp.partner_id left outer join ( select product_id , sum ( quantity ) quantity from gift_mail.inventory group by product_id ) t on p.id = t.product_id where ( ( p.is_disable is null or p.is_disable = :3 ) ) ) as p where ( p.tenant_id = :4 and p.product_type = :5 ) order by p.id desc limit :6 , :7|3|4|1||0|0|56851|18953|35|13|
|platform|select vm.* from vendormember vm join member m on vm.id = m.vendormemberid and vm.vendorid = m.vendorid where m.employeeid = :1 and vm.vendorid = :2 and ( ( birthdaytype = :3 and month ( birthday ) = month ( date_sub ( curdate ( ) , interval :4 day ) ) and day ( birthday ) = day ( date_sub ( curdate ( ) , interval :5 day ) ) ) or ( birthdaytype = :6 and month ( birthday ) = month ( date_sub ( :7 , interval :8 day ) ) and day ( birthday ) = day ( date_sub ( :9 , interval :10 day ) ) ) )|3|8|4||0|0|97710|62538|46|43|
|user_service|select id , plat_unionid , plat_openid , user_name , mobile_no , nick_name , sex , head_img_url , country , province , city , status , create_time , update_time , is_subscribe , subscribe_time from `user` where user_name like concat ( :1 , :2 , :3 ) or mobile_no = :4 or nick_name like concat ( :5 , :6 , :7 ) limit :8|3|10|3||0|0|10847120|3615711|3|1|
|user_service|select scene_id , count ( * ) as quantity , scene_type from user_service.user_source where scene_type = :1 and scene_id in ( :2 ) and tenant_wechatapp_id = :3 group by scene_id|3|10|3||0|0|117777|39260|0|0|
|payment|select id , tenant_id , tenant_app_id , goods_order_source , goods_order_no , goods_name , goods_amount , fee_type , request_ip , user_id , user_identify , user_sub_identify , pay_way , trade_type , order_start_time , order_expire_time , prepay_id , transaction_id , pay_amount , pay_finish_time , pay_status , pay_status_desc , error_msg , wxappid , sub_wxappid , mch_id , sub_mch_id , callback_tag , callback_result , create_time , update_time from pay_order where callback_result in ( :1 , :2 ) and pay_status in ( :3 , :4 ) order by id asc limit :5|3|6|3||0|0|268365|89455|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 ) , :1 ) ) as price , ifnull ( t.quantity , :2 ) quantity , pt.partner_name vendorname , 0.0 distance , c.categroy_name categroy_name , pp.partner_id from product p inner join category c on c.id = p.category_id left outer join self_product sp on p.id = sp.product_id left outer join partner_product pp on p.id = pp.product_id left outer join partner pt on pt.id = pp.partner_id left outer join ( select product_id , sum ( quantity ) quantity from gift_mail.inventory group by product_id ) t on p.id = t.product_id where ( ( p.is_disable is null or p.is_disable = :3 ) ) ) as p where ( p.product_status = :4 and p.tenant_id = :5 and p.categroy_name like :6 and p.product_type = :7 )|3|4|1||0|0|56680|18906|3|1|
|user_service|insert into erp_member_info ( id , tenant_id , tenant_wechatapp_id , erp_member_id , mobile_no , user_name , sex , birthday , birthday_is_lunar , home_address , memorialday , memorialday_name , memorialday_is_lunar , interested , amount , create_time , update_time ) values ( null , :1 , :2 , :3 , :4 , :5 , :6 , :7 , :8 , :9 , :10 , :11 , :12 , :13 , 0.00 , :14 , :15 ) on duplicate key update erp_member_id = :16 , mobile_no = :17 , user_name = :18 , sex = :19 , birthday = :20 , birthday_is_lunar = :21 , home_address = :22 , memorialday = :23 , memorialday_name = :24 , memorialday_is_lunar = :25 , interested = :26 , amount = 0.00 , update_time = :27|3|21|7||0|0|0|0|0|0|
|user_service|insert into erp_member ( id , tenant_id , tenant_wechatapp_id , member_erp_id , employee_erp_id , grade_erp_id , card_no , dept_erp_id , mobile_no , consumption_integral , user_name , status ) values ( null , :1 , :2 , :3 , :4 , :5 , :6 , :7 , :8 , 0.00 , :9 , null ) on duplicate key update member_erp_id = :10 , employee_erp_id = :11 , grade_erp_id = :12 , card_no = :13 , dept_erp_id = :14 , mobile_no = :15 , consumption_integral = 0.00 , user_name = :16 , create_time = create_time|3|8|4||0|0|0|0|0|0|
|erp_sync|select * from retry_data where tenant_app_id = :1 and user_id = :2|2|4|2||0|0|16577|10078|2|2|
|comment_service|select *from comment_service.comment_reward where comment_id = :1 limit :2|2|2|1||0|0|153737|76869|2|1|
|activity_service|select count ( 0 ) from activity_service.user_trace ut left join activity_service.activity at on ut.activity_id = at.id where ut.step = :1 and ut.status = :2 and ut.activity_id = :3|2|20|12||0|0|2209950|1104977|2|1|
|authorization_service|update user_login_token set status = :1 where user_id = :2 and tenant_id = :3 and tenant_wx_app_id = :4 and login_way = :5|2|3|1||0|0|941|729|0|0|
|user_service|select count ( 0 ) from user_employee ue join tenant_user tu on ue.user_id = tu.user_id and tu.tenant_id = :1 and tu.tenant_app_id = :2 join user u on tu.user_id = u.id where ue.employee_id = :3 and ue.tenant_id = :4 and ue.tenant_wechatapp_id = :5 and tu.shop_id = :6|2|2|1||0|0|111765|101485|2|1|
||select tmp.* from corpwx.external_user tmp left join ( select ce.tenant_id , ce.tenant_user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :1 group by tenant_id , tenant_user_id having count ( * ) > :2 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :3 group by ce.tenant_id , ce.tenant_user_id ) t1 on tmp.tenant_id = t1.tenant_id and tmp.tenant_user_id = t1.tenant_user_id left join ( select ce.tenant_id , ce.user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :4 group by tenant_id , tenant_user_id having count ( * ) > :5 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :6 group by ce.tenant_id , ce.user_id ) t2 on tmp.tenant_id = t2.tenant_id and tmp.user_id = t2.user_id where t1.amount != t2.amount and tmp.user_id not in ( :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 , :15 , :16 , :17 , :18 , :19 ) order by tmp.user_id|1|1|1||0|0|935094|935094|133|133|
||select tmp.* from corpwx.external_user tmp left join ( select ce.tenant_id , ce.tenant_user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :1 group by tenant_id , tenant_user_id having count ( * ) > :2 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :3 group by ce.tenant_id , ce.tenant_user_id ) t1 on tmp.tenant_id = t1.tenant_id and tmp.tenant_user_id = t1.tenant_user_id left join ( select ce.tenant_id , ce.user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :4 group by tenant_id , tenant_user_id having count ( * ) > :5 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :6 group by ce.tenant_id , ce.user_id ) t2 on tmp.tenant_id = t2.tenant_id and tmp.user_id = t2.user_id where t1.amount != t2.amount and tmp.user_id not in ( :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 , :15 , :16 , :17 , :18 ) order by tmp.user_id|1|1|1||0|0|935064|935064|135|135|
|mysql|insert into erp_sync.sync_record_20190924 select * from erp_sync.sync_record where create_time < date_sub ( now ( ) , interval :1 day )|1|9|9||0|0|495412|495412|0|0|
||select * from authorization_service.user_login_token where employee_id = :1 order by create_time desc|1|1|1||0|0|4778914|4778914|473|473|
|warranty_service|select count ( 0 ) from warranty_service.warranty where tenant_wechatapp_id = :1 and is_disable = false and dept_erp_id = :2 and employee_erp_id = :3 and sales_date >= :4 and sales_date <= :5 and employee_erp_id in ( :6 , :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 , :15 , :16 , :17 , :18 , :19 )|1|6|6||0|0|36833|36833|1|1|
|platform|select count ( 1 ) from coupondetail where vendorid = :1 and coupontype = :2 and couponstate = :3 and to_days ( :4 ) :5 to_days ( createtime ) = :6|1|2|2||0|0|322224|322224|1|1|
|order|select id , tenant_id , tenant_wechatapp_id , order_id , user_id , user_name , shop_id , shop_name , operator_type , src_status , dst_status , full_message , remark , create_time , update_time , src_child_status , dst_child_status from order_operator_log where tenant_wechatapp_id = :1 and order_id = :2 and dst_status = :3 order by create_time desc|1|1|1||0|0|300468|300468|1|1|
||select tmp.* from corpwx.external_user tmp left join ( select ce.tenant_id , ce.tenant_user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :1 group by tenant_id , tenant_user_id having count ( * ) > :2 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :3 group by ce.tenant_id , ce.tenant_user_id ) t1 on tmp.tenant_id = t1.tenant_id and tmp.tenant_user_id = t1.tenant_user_id left join ( select ce.tenant_id , ce.user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :4 group by tenant_id , tenant_user_id having count ( * ) > :5 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :6 group by ce.tenant_id , ce.user_id ) t2 on tmp.tenant_id = t2.tenant_id and tmp.user_id = t2.user_id where t1.amount != t2.amount order by tmp.user_id|1|1|1||0|0|935303|935303|178|178|
||select tmp.* from corpwx.external_user tmp left join ( select ce.tenant_id , ce.tenant_user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :1 group by tenant_id , tenant_user_id having count ( * ) > :2 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :3 group by ce.tenant_id , ce.tenant_user_id ) t1 on tmp.tenant_id = t1.tenant_id and tmp.tenant_user_id = t1.tenant_user_id left join ( select ce.tenant_id , ce.user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :4 group by tenant_id , tenant_user_id having count ( * ) > :5 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :6 group by ce.tenant_id , ce.user_id ) t2 on tmp.tenant_id = t2.tenant_id and tmp.user_id = t2.user_id where t1.amount != t2.amount and tmp.user_id not in ( :7 , :8 , :9 , :10 , :11 , :12 , :13 ) order by tmp.user_id|1|1|1||0|0|935064|935064|145|145|
|corpwx|update external_user set tenant_user_id = :1 where ( tenant_id = :2 and user_id = :3 )|1|1|1||0|0|132751|132751|0|0|
||select tmp.* from corpwx.external_user tmp left join ( select ce.tenant_id , ce.tenant_user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :1 group by tenant_id , tenant_user_id having count ( * ) > :2 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :3 group by ce.tenant_id , ce.tenant_user_id ) t1 on tmp.tenant_id = t1.tenant_id and tmp.tenant_user_id = t1.tenant_user_id left join ( select ce.tenant_id , ce.user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :4 group by tenant_id , tenant_user_id having count ( * ) > :5 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :6 group by ce.tenant_id , ce.user_id ) t2 on tmp.tenant_id = t2.tenant_id and tmp.user_id = t2.user_id where t1.amount != t2.amount|1|1|1||0|0|802202|802202|178|178|
||select tmp.* from corpwx.external_user tmp left join ( select ce.tenant_id , ce.tenant_user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :1 group by tenant_id , tenant_user_id having count ( * ) > :2 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :3 group by ce.tenant_id , ce.tenant_user_id ) t1 on tmp.tenant_id = t1.tenant_id and tmp.tenant_user_id = t1.tenant_user_id left join ( select ce.tenant_id , ce.user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :4 group by tenant_id , tenant_user_id having count ( * ) > :5 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :6 group by ce.tenant_id , ce.user_id ) t2 on tmp.tenant_id = t2.tenant_id and tmp.user_id = t2.user_id where t1.amount != t2.amount and tmp.user_id not in ( :7 , :8 , :9 , :10 , :11 , :12 ) order by tmp.user_id|1|1|1||0|0|935058|935058|147|147|
||select tmp.* from corpwx.external_user tmp left join ( select ce.tenant_id , ce.tenant_user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :1 group by tenant_id , tenant_user_id having count ( * ) > :2 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :3 group by ce.tenant_id , ce.tenant_user_id ) t1 on tmp.tenant_id = t1.tenant_id and tmp.tenant_user_id = t1.tenant_user_id left join ( select ce.tenant_id , ce.user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :4 group by tenant_id , tenant_user_id having count ( * ) > :5 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :6 group by ce.tenant_id , ce.user_id ) t2 on tmp.tenant_id = t2.tenant_id and tmp.user_id = t2.user_id where t1.amount != t2.amount and tmp.user_id not in ( :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 ) order by tmp.user_id|1|1|1||0|0|935076|935076|143|143|
|value_added|-- 增值达到最大天数 select 'value_added_limit_contact' as limitdaytype , tenant_wechatapp_id as tenantappid , user_id as userid , 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 where tenant_wechatapp_id = :1 and state = :2 and t.start_add_time >= date_add ( date_format ( :3 , :4 ) , interval :5 * ( add_days-1 ) day ) and t.start_add_time < date_add ( date_format ( :6 , :7 ) , interval ( :8 * ( add_days-1 ) :9 :10 ) day ) group by tenant_wechatapp_id , user_id|1|1|1||0|0|17760|17760|23|23|
||select tmp.* from corpwx.external_user tmp left join ( select ce.tenant_id , ce.tenant_user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :1 group by tenant_id , tenant_user_id having count ( * ) > :2 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :3 group by ce.tenant_id , ce.tenant_user_id ) t1 on tmp.tenant_id = t1.tenant_id and tmp.tenant_user_id = t1.tenant_user_id left join ( select ce.tenant_id , ce.user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :4 group by tenant_id , tenant_user_id having count ( * ) > :5 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :6 group by ce.tenant_id , ce.user_id ) t2 on tmp.tenant_id = t2.tenant_id and tmp.user_id = t2.user_id where t1.amount != t2.amount and tmp.user_id not in ( :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 , :15 ) order by tmp.user_id|1|2|2||0|0|935072|935072|141|141|
||select tmp.* from corpwx.external_user tmp left join ( select ce.tenant_id , ce.tenant_user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :1 group by tenant_id , tenant_user_id having count ( * ) > :2 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :3 group by ce.tenant_id , ce.tenant_user_id ) t1 on tmp.tenant_id = t1.tenant_id and tmp.tenant_user_id = t1.tenant_user_id left join ( select ce.tenant_id , ce.user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :4 group by tenant_id , tenant_user_id having count ( * ) > :5 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :6 group by ce.tenant_id , ce.user_id ) t2 on tmp.tenant_id = t2.tenant_id and tmp.user_id = t2.user_id where t1.amount != t2.amount and tmp.user_id not in ( :7 , :8 , :9 , :10 ) order by tmp.user_id|1|1|1||0|0|935060|935060|155|155|
||select tmp.* from corpwx.external_user tmp left join ( select ce.tenant_id , ce.tenant_user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :1 group by tenant_id , tenant_user_id having count ( * ) > :2 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :3 group by ce.tenant_id , ce.tenant_user_id ) t1 on tmp.tenant_id = t1.tenant_id and tmp.tenant_user_id = t1.tenant_user_id left join ( select ce.tenant_id , ce.user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :4 group by tenant_id , tenant_user_id having count ( * ) > :5 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :6 group by ce.tenant_id , ce.user_id ) t2 on tmp.tenant_id = t2.tenant_id and tmp.user_id = t2.user_id where t1.amount != t2.amount and tmp.user_id not in ( :7 , :8 , :9 , :10 , :11 ) order by tmp.user_id|1|1|1||0|0|935080|935080|153|153|
|value_added|-- 根据添加时间得出当前增值金额 update value_added_user set amount_added = if ( :1 > ( ( ( added_percent_per_day / :2 ) * if ( :3 >= timestampdiff ( day , date_format ( start_add_time , :4 ) , now ( ) ) :5 :6 :7 add_days , timestampdiff ( day , date_format ( start_add_time , :8 ) , now ( ) ) :9 :10 , add_days ) ) :11 ( ( devalue_percent_per_day / :12 ) * if ( :13 >= timestampdiff ( day , date_format ( start_add_time , :14 ) , now ( ) ) :15 :16 :17 add_days :18 keeping_days , :19 , timestampdiff ( day , date_format ( start_add_time , :20 ) , now ( ) ) :21 :22 :23 add_days :24 keeping_days ) ) ) * amount_pay , :25 , ( ( ( added_percent_per_day / :26 ) * if ( :27 >= timestampdiff ( day , date_format ( start_add_time , :28 ) , now ( ) ) :29 :30 :31 add_days , timestampdiff ( day , date_format ( start_add_time , :32 ) , now ( ) ) :33 :34 , add_days ) ) :35 ( ( devalue_percent_per_day / :36 ) * if ( :37 >= timestampdiff ( day , date_format ( start_add_time , :38 ) , now ( ) ) :39 :40 :41 add_days :42 keeping_days , :43 , timestampdiff ( day , date_format ( start_add_time , :44 ) , now ( ) ) :45 :46 :47 add_days :48 keeping_days ) ) ) * amount_pay ) , update_time = now ( ) where state = :49 and update_time <= curdate ( ) and ( start_add_time >= date_add ( curdate ( ) , interval :50 ( add_days :51 keeping_days :52 :53 ) day ) or ( amount_added > :54 and start_add_time < date_add ( curdate ( ) , interval :55 ( add_days :56 keeping_days :57 :58 ) day ) ) ) -- 判断条件 在增值时间内 增值金大于0 状态正常|1|2|2||0|0|320503|320503|0|0|
||load data local infile 'import_data/1011783944238096384_20200416103717_1_member.csv' replace into table user_service.erp_member_info character set utf8mb4 fields terminated by :1 lines starting by :2 ( tenant_id , tenant_wechatapp_id , erp_member_id , @employee_erp_id , @grade_erp_id , @card_no , @dept_erp_id , mobile_no , @consumption_integral , user_name , sex , birthday , birthday_is_lunar , home_address , memorialday , memorialday_name , memorialday_is_lunar , interested , amount , erp_create_time , @status ) set update_time = now ( )|1|6|6||0|0|0|0|0|0|
|employee|select count ( 0 ) from backlog where tenant_app_id = :1 and employee_id = :2 and status in ( :3 , :4 ) and shop_id = :5 and scene = :6 and expire_time >= :7|1|1|1||0|0|2618|2618|1|1|
|warranty_service|select count ( 0 ) from warranty_service.warranty where tenant_wechatapp_id = :1 and is_disable = false and dept_erp_id = :2 and employee_erp_id = :3 and sales_date >= :4 and sales_date <= :5 and employee_erp_id in ( :6 , :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 )|1|1|1||0|0|2058|2058|1|1|
|platform|select count ( 1 ) from `smssent` where vendorid = :1 and success = true and date_sub ( date ( :2 ) , interval :3 day ) = date_format ( senttime , :4 )|1|3|3||0|0|66068|66068|1|1|
|platform|select `vendorid` , `memberid` , `salesdate` , `noteid` , `noteno` , `empid` , `empname` , `amounttotal` , `quantitytotal` , `integraltotal` , `salesstoreid` , `staffattitude` , `professionallevel` , `appearance` , `storeimage` , `productdisplay` , `salescomment` , `commenttime` , `replycontent` , `replytime` , `replyuser` , `tipfee` , `tipmorderid` , `tippayno` , `tippaytime` , `status` , `aftersalesremark` , `uid` , `eid` , `sid` , `id` from `saleslog` where vendorid = :1 and tipfee > :2 and tippayno is not null and date_sub ( date ( :3 ) , interval :4 day ) = date_format ( tippaytime , :5 )|1|6|6||0|0|120774|120774|0|0|
||select tmp.* from corpwx.external_user tmp left join ( select ce.tenant_id , ce.tenant_user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :1 group by tenant_id , tenant_user_id having count ( * ) > :2 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :3 group by ce.tenant_id , ce.tenant_user_id ) t1 on tmp.tenant_id = t1.tenant_id and tmp.tenant_user_id = t1.tenant_user_id left join ( select ce.tenant_id , ce.user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :4 group by tenant_id , tenant_user_id having count ( * ) > :5 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :6 group by ce.tenant_id , ce.user_id ) t2 on tmp.tenant_id = t2.tenant_id and tmp.user_id = t2.user_id where t1.amount != t2.amount and tmp.user_id not in ( :7 , :8 , :9 ) order by tmp.user_id|1|1|1||0|0|935068|935068|171|171|
|employee|select * from backlog where tenant_app_id = :1 and employee_id = :2 and status in ( :3 , :4 ) and shop_id = :5 and scene in ( :6 , :7 ) and expire_time >= :8 order by create_time desc limit :9|1|2|2||0|0|185855|185855|1|1|
||select * from erp_sync.sync_record where tenant_id = :1|1|10|10||0|0|497532|497532|299|299|
|mysql|delete from wx_gateway.wx_template_msg where create_time < date_sub ( now ( ) , interval :1 day )|1|22|22||0|0|864666|864666|0|0|
|platform|select ifnull ( eid , 0 ) as eid , ifnull ( shopid , 0 ) as sid , vendorid , count ( 1 ) as quantity from productcerts where vendorid = :1 and to_days ( :2 ) :3 to_days ( createtime ) = :4 group by eid , shopid , vendorid|1|1|1||0|0|28984|28984|0|0|
||select tmp.* from corpwx.external_user tmp left join ( select ce.tenant_id , ce.tenant_user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :1 group by tenant_id , tenant_user_id having count ( * ) > :2 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :3 group by ce.tenant_id , ce.tenant_user_id ) t1 on tmp.tenant_id = t1.tenant_id and tmp.tenant_user_id = t1.tenant_user_id left join ( select ce.tenant_id , ce.user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :4 group by tenant_id , tenant_user_id having count ( * ) > :5 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :6 group by ce.tenant_id , ce.user_id ) t2 on tmp.tenant_id = t2.tenant_id and tmp.user_id = t2.user_id where t1.amount != t2.amount and tmp.user_id not in ( :7 ) order by tmp.user_id|1|1|1||0|0|935065|935065|176|176|
|account|select id , tenant_id , tenant_wechatapp_id , account_type , user_id , mch_billno , send_name , mch_id , sub_mch_id , wxappid , msgappid , re_openid , total_amount , total_num , wishing , client_ip , act_name , remark , scene_id , risk_info , consume_mch_id , send_time , order_status , failure_reason , biz_id , biz_type , biz_tag , send_listid , need_callback , create_time , update_time , user_name , mobile_no , receive_time , refund_amount , refund_time from wx_redpacket_send_order where order_status in ( :1 , :2 ) order by id desc|1|1|1||0|0|39864|39864|5|5|
||select tmp.* from corpwx.external_user tmp left join ( select ce.tenant_id , ce.tenant_user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :1 group by tenant_id , tenant_user_id having count ( * ) > :2 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :3 group by ce.tenant_id , ce.tenant_user_id ) t1 on tmp.tenant_id = t1.tenant_id and tmp.tenant_user_id = t1.tenant_user_id left join ( select ce.tenant_id , ce.user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :4 group by tenant_id , tenant_user_id having count ( * ) > :5 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :6 group by ce.tenant_id , ce.user_id ) t2 on tmp.tenant_id = t2.tenant_id and tmp.user_id = t2.user_id where t1.amount != t2.amount and tmp.user_id not in ( :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 , :15 , :16 ) order by tmp.user_id|1|1|1||0|0|935072|935072|139|139|
||load data local infile 'import_data/1011783944238096384_20200416103717_1_member.csv' replace into table user_service.erp_member character set utf8mb4 fields terminated by :1 lines starting by :2 ( tenant_id , tenant_wechatapp_id , member_erp_id , employee_erp_id , grade_erp_id , card_no , dept_erp_id , mobile_no , consumption_integral , user_name , @sex , @birthday , @birthday_is_lunar , @home_address , @memorialday , @memorialday_name , @memorialday_is_lunar , @interested , @amount , erp_create_time , status ) set update_time = now ( )|1|7|7||0|0|0|0|0|0|
|user_service|select ue.employee_id as employeeid , count ( * ) as quantity from user_service.user_employee ue join user_service.tenant_user tu on ue.tenant_wechatapp_id = tu.tenant_app_id and ue.user_id = tu.user_id where employee_id in ( :1 , :2 , :3 , :4 , :5 , :6 , :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 , :15 , :16 ) and ue.tenant_wechatapp_id = :17 and tu.shop_id = :18 group by ue.employee_id|1|2|2||0|0|102839|102839|11|11|
||select tmp.* from corpwx.external_user tmp left join ( select ce.tenant_id , ce.tenant_user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :1 group by tenant_id , tenant_user_id having count ( * ) > :2 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :3 group by ce.tenant_id , ce.tenant_user_id ) t1 on tmp.tenant_id = t1.tenant_id and tmp.tenant_user_id = t1.tenant_user_id left join ( select ce.tenant_id , ce.user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :4 group by tenant_id , tenant_user_id having count ( * ) > :5 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :6 group by ce.tenant_id , ce.user_id ) t2 on tmp.tenant_id = t2.tenant_id and tmp.user_id = t2.user_id where t1.amount != t2.amount and tmp.user_id not in ( :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 , :15 , :16 , :17 ) order by tmp.user_id|1|1|1||0|0|935070|935070|137|137|
||select tmp.* from corpwx.external_user tmp left join ( select ce.tenant_id , ce.tenant_user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :1 group by tenant_id , tenant_user_id having count ( * ) > :2 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :3 group by ce.tenant_id , ce.tenant_user_id ) t1 on tmp.tenant_id = t1.tenant_id and tmp.tenant_user_id = t1.tenant_user_id left join ( select ce.tenant_id , ce.user_id , count ( * ) amount from ( select tenant_id , tenant_user_id , count ( * ) amount from corpwx.external_user where tenant_user_id > :4 group by tenant_id , tenant_user_id having count ( * ) > :5 ) t inner join corpwx.external_user ce on t.tenant_id = ce.tenant_id and t.tenant_user_id = ce.tenant_user_id where ce.tenant_user_id > :6 group by ce.tenant_id , ce.user_id ) t2 on tmp.tenant_id = t2.tenant_id and tmp.user_id = t2.user_id where t1.amount != t2.amount and tmp.user_id not in ( :7 , :8 ) order by tmp.user_id|1|1|1||0|0|935067|935067|174|174|
|message_push|delete from message_log where create_time < :1|1|16|16||0|0|179211|179211|0|0|
|facepass_sync|select id , tenant_id , tenant_wechatapp_id , shop_id , status , retries , success_time , send_fail_msg , create_time , update_time , send_data from customer_face_register_message where status in ( :1 , :2 ) and retries < :3 limit :4|1|1|1||0|0|15814|15814|0|0|
|coupon_service|select * from coupon_user where datediff ( date_format ( end_time , :1 ) , date_format ( now ( ) , :2 ) ) = :3 and coupon_state in ( :4 )|1|12|12||0|0|792948|792948|768|768|
