|数据库名称|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 )|113|198|2||0|0|2290046|20347|113|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|98|170|2||0|0|1987917|20367|1545|20|
|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 )|49|80|2||0|0|37529519|765915|8|4|
|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|49|62|2||0|0|5616384|127842|0|0|
|platform|select count ( 1 ) from `salesdetaillog` where `vendorid` = :1 and `noteid` = :2|43|90|3||0|0|1311673|38715|43|1|
|user_service|select ue.employee_id as employeeid , count ( * ) as quantity from user_service.user_employee ue join user_service.tenant_member_info tmi on ue.tenant_id = tmi.tenant_id and ue.tenant_wechatapp_id = tmi.tenant_app_id and ue.user_id = tmi.user_id where employee_id in ( :1 ) and ue.tenant_id = :2 and ue.tenant_wechatapp_id = :3 and tmi.shop_id = :4 group by ue.employee_id|33|38|1||0|0|9285787|367311|33|1|
|platform|select count ( 1 ) from coupondetail cd where getuid = :1 and ( couponstate = :2 or couponstate = :3 ) and date_format ( expirytime , :4 ) >= curdate ( )|32|62|2||0|0|10311488|322234|32|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 = :1 and account_id = :2 and status = :3 )|30|102|10||0|0|5391353|400304|63|5|
|platform|select count ( 1 ) from `integrallog` where `vendorid` = :1 and `changefrom` = :2 and `changeid` = :3|23|35|2||0|0|544962|34325|23|1|
|platform|select `typefullname` , `methodname` , `arguments` , `partition` , `offset` , `createtime` , `updatetime` , `retried` , `errormsg` , `id` from `pushlog` where `typefullname` = :1 and `methodname` = :2 and `arguments` = :3|22|31|2||0|0|5661485|257359|0|0|
|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|20|27|1||0|0|1388248|83329|20|1|
|authorization_service|select id , user_id , tenant_id , tenant_wx_app_id , account_id , login_way , login_code , login_token , roles , status , expire_time , create_time , update_time , login_ip , login_time , login_data , employee_id , shop_id , platform_user_id , wx_user_id , wx_app_user_id from user_login_token where employee_id = :1 and tenant_id = :2 and tenant_wx_app_id = :3 and shop_id = :4 and login_way = :5 and status = :6|17|46|8||0|0|1164686|127718|17|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|16|45|9||0|0|528402|90713|0|0|
|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|14|21|2||0|0|591474|46728|2|1|
|order|select od.id from order_info od left join order_detail dt on od.id = dt.order_id where od.status = :1 and dt.sku_id = :2 and od.user_id = :3|12|15|2||0|0|984106|82573|0|0|
|user_service|select count ( 0 ) from ( select ue.user_id as id , tm.user_name as username , tm.head_img_url as headimgurl , tm.user_name as nickname , tm.mobile_no as mobile , tm.sex , if ( ifnull ( wu.is_subscribe , 0 ) = 0 , false , true ) as hassubscribe from user_service.user_employee ue join user_service.tenant_member tm on tm.tenant_id = ue.tenant_id and tm.tenant_app_id = ue.tenant_wechatapp_id and tm.user_id = ue.user_id join user_service.tenant_member_info tmi on tmi.tenant_id = tm.tenant_id and tmi.id = tm.id join user_service.tenant_member_bind tmb on tmb.tenant_id = ue.tenant_id and tmb.tenant_app_id = ue.tenant_wechatapp_id and tmb.user_id = ue.user_id left join user_service.wx_user wu on wu.id = tmb.wx_user_id where ue.employee_id = :1 and ue.tenant_id = :2 and ue.tenant_wechatapp_id = :3 and tmi.shop_id = :4 and ue.user_id not in ( :5 , :6 , :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 , :15 , :16 , :17 , :18 , :19 , :20 , :21|11|17|2||0|0|2957114|272589|11|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 inner 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 = :1 and tu.tenant_app_id = :2 and mb.erp_member_id in ( :3 , :4 , :5 , :6 , :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 , :15 , :16 , :17 , :18 , :19 , :20 , :21 , :22 , :23 , :24 , :25 , :26 , :27 , :28 , :29 , :30 , :31 , :32 , :33 , :34 , :35 , :36 , :37 , :38 , :39 , :40 , :41 , :42 , :43 , :44 , :45 , :46 , :47 , :48 , :49|11|21|4||0|0|4773555|609685|1000|280|
|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|29|4||0|0|1368337|299184|6|1|
|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|10|20|3||0|0|2237123|225554|33|7|
|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|9|15|2||0|0|1054964|117249|116|32|
|user_service|select count ( 0 ) from ( select ue.user_id as id , tm.user_name as username , tm.head_img_url as headimgurl , tm.user_name as nickname , tm.mobile_no as mobile , tm.sex , if ( ifnull ( wu.is_subscribe , 0 ) = 0 , false , true ) as hassubscribe from user_service.user_employee ue join user_service.tenant_member tm on tm.tenant_id = ue.tenant_id and tm.tenant_app_id = ue.tenant_wechatapp_id and tm.user_id = ue.user_id join user_service.tenant_member_info tmi on tmi.tenant_id = tm.tenant_id and tmi.id = tm.id join user_service.tenant_member_bind tmb on tmb.tenant_id = ue.tenant_id and tmb.tenant_app_id = ue.tenant_wechatapp_id and tmb.user_id = ue.user_id left join user_service.wx_user wu on wu.id = tmb.wx_user_id where ue.employee_id = :1 and ue.tenant_id = :2 and ue.tenant_wechatapp_id = :3 and tmi.shop_id = :4 order by tm.id desc ) tmp_count|8|10|1||0|0|1851172|279445|8|1|
|user_service|select count ( 0 ) from user_service.user_employee ue join user_service.tenant_member tm on tm.tenant_id = ue.tenant_id and tm.tenant_app_id = ue.tenant_wechatapp_id and tm.user_id = ue.user_id join user_service.tenant_member_info tmi on tmi.tenant_id = tm.tenant_id and tmi.id = tm.id where ue.employee_id = :1 and ue.tenant_id = :2 and ue.tenant_wechatapp_id = :3 and tmi.shop_id = :4|7|9|2||0|0|2537527|399870|7|1|
|order|select max ( create_time ) from `order`.order_operator_log where tenant_wechatapp_id = :1 and order_id = :2|7|7|1||0|0|2242697|320444|7|1|
|corpwx|update external_user set wx_user_id = :1 where ( tenant_id = :2 and user_id = :3 )|7|7|1||0|0|1466586|210126|0|0|
|platform|select `noteid` , `vendorid` , `detailindex` , `productname` , `productbarcode` , `category` , `salestype` , `quantity` , `amount` , `integral` , `productdesc` , `slid` , `paidamount` , `id` from `salesdetaillog` where `noteid` = :1 and `vendorid` = :2|6|10|2||0|0|185652|38716|17|4|
|user_service|select count ( * ) from user_service.user_employee ue join user_service.tenant_member_info tu on ue.tenant_wechatapp_id = tu.tenant_app_id and ue.user_id = tu.user_id where ue.tenant_id = :1 and ue.tenant_wechatapp_id = :2 and ue.employee_id = :3 and tu.shop_id = :4|6|45|14||0|0|37574615|6264554|6|1|
|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|3||0|0|99881|62526|35|31|
|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|3|9|3||0|0|658245|225554|10|5|
|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.tenant_member_bind tmb on tm.tenant_id = tmb.tenant_id and tm.id = tmb.id left join user_service.wx_user wu on tmb.wx_user_id = wu.id where tm.tenant_id = :1 and tm.tenant_app_id = :2 and tm.user_id not in ( :3 , :4 , :5 )|3|13|6||0|0|449242|202542|3|1|
|user_service|select count ( * ) from user_service.tenant_member tm left join user_service.user_employee t3 on tm.tenant_id = t3.tenant_id and tm.user_id = t3.user_id and tm.tenant_app_id = t3.tenant_wechatapp_id join user_service.tenant_member_info tmi on tm.tenant_id = tmi.tenant_id and tm.id = tmi.id where t3.id is null and tmi.shop_id = :1 and tmi.tenant_app_id = :2 and tmi.tenant_id = :3|2|2|1||0|0|657857|341812|2|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|2|2|1||0|0|34|32|0|0|
|employee|update backlog set leave_flag = :1 where tenant_app_id = :2 and employee_id = :3|2|8|5||1|1|306368|153184|0|0|
|tenant|select es.id , es.sales_no , es.sales_date , es.dept_erp_id , shop.shop_name as dept_name , es.employee_name , es.member_erp_id , es.comment_id from tenant.erp_sales es left join tenant.tenant_wechatapp_shop shop on shop.tenant_wechatapp_id = es.tenant_wechatapp_id and shop.dept_erp_id = es.dept_erp_id join tenant.employee e on e.tenant_id = es.tenant_id and e.employee_erp_id = es.employee_erp_id join tenant.employee_shop esh on esh.tenant_app_id = es.tenant_wechatapp_id and esh.employee_id = e.id and esh.dept_erp_id = es.dept_erp_id where es.tenant_wechatapp_id = :1 and es.dept_erp_id = :2 and es.comment_id is not null and es.comment_id != :3 and esh.status in ( :4 , :5 ) limit :6|2|3|2||0|0|1546414|1045814|200|100|
|corpwx|update external_user set un_assign_flag = :1 where ( tenant_id = :2 and corp_user_id = :3 and user_id = :4 )|2|2|1||0|0|418584|209292|0|0|
|user_service|select count ( * ) from user_service.wx_user wx where wx_app_id = :1 and is_subscribe = :2 and not exists ( select null from user_service.tenant_member_bind mb where mb.tenant_id = :3 and mb.tenant_app_id = :4 and mb.wx_user_id = wx.id )|2|16|11||0|0|254357|181375|2|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 inner 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 = :1 and tu.tenant_app_id = :2 and mb.erp_member_id in ( :3 , :4 , :5 , :6 , :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 , :15 )|2|4|3||0|0|224758|135965|26|13|
|comment_service|select c.* , cr.busi_id , cr.give_prize , cr.give_type from comment_service.comment c left join comment_service.comment_reward cr on cr.comment_id = c.id where c.id in ( :1 , :2 , :3 , :4 , :5 , :6 , :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 , :15 , :16 , :17 , :18 , :19 , :20 , :21 , :22 , :23 , :24 , :25 , :26 , :27 , :28 , :29 , :30 , :31 , :32 , :33 , :34 , :35 , :36 , :37 , :38 , :39 , :40 , :41 , :42 , :43|2|3|1||0|0|170958|85479|200|100|
||select * from erp_sync.sync_record where tenant_id = :1 and tenant_app_id = :2 and user_id = :3|2|2|1||0|0|16169|8089|4|4|
|order|select id from order_operator_log where tenant_wechatapp_id = :1 and order_id = :2 and ( src_child_status = :3 and dst_child_status = :4 ) order by create_time desc limit :5|2|2|1||0|0|640802|320422|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 in ( :6 , :7 ) and expire_time >= :8|2|2|1||0|0|9156|5434|2|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 inner 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 = :1 and tu.tenant_app_id = :2 and mb.erp_member_id in ( :3 , :4 , :5 , :6 , :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 , :15 , :16 , :17 , :18 , :19 , :20 , :21 , :22 , :23 , :24 , :25 , :26 , :27 , :28 , :29 , :30 , :31 , :32 , :33 , :34 , :35 , :36 , :37 )|1|1|1||0|0|229439|229439|35|35|
|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|44006|44006|5|5|
|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|4|4||0|0|120774|120774|0|0|
|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 ( ( memorialtype = :3 and month ( memorialday ) = month ( date_sub ( curdate ( ) , interval :4 day ) ) and day ( memorialday ) = day ( date_sub ( curdate ( ) , interval :5 day ) ) ) or ( memorialtype = :6 and month ( memorialday ) = month ( date_sub ( :7 , interval :8 day ) ) and day ( memorialday ) = day ( date_sub ( :9 , interval :10 day ) ) ) )|1|1|1||0|0|18196|18196|0|0|
|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 = :1 and account_id = :2 and status = :3 and tenant_wx_app_id = :4 )|1|1|1||0|0|58855|58855|0|0|
||select count ( * ) from message_push.message_log|1|1|1||0|0|2390984|2390984|1|1|
|user_service|select ue.user_id as id , tm.user_name as username , tm.head_img_url as headimgurl , tm.user_name as nickname , tm.mobile_no as mobile , tm.sex from user_service.user_employee ue join user_service.tenant_member tm on tm.tenant_id = ue.tenant_id and tm.tenant_app_id = ue.tenant_wechatapp_id and tm.user_id = ue.user_id join user_service.tenant_member_info tmi on tmi.tenant_id = tm.tenant_id and tmi.id = tm.id where ue.employee_id = :1 and ue.tenant_id = :2 and ue.tenant_wechatapp_id = :3 and tmi.shop_id = :4 order by tm.id desc|1|1|1||0|0|360383|360383|41|41|
|user_service|select count ( * ) from user_service.user_employee ue join user_service.tenant_member_info tu on tu.tenant_id = ue.tenant_id and tu.user_id = ue.user_id and tu.tenant_app_id = ue.tenant_wechatapp_id where ue.tenant_id = :1 and ue.employee_id = :2 and ue.tenant_wechatapp_id = :3 and tu.shop_id = :4|1|1|1||0|0|184978|184978|1|1|
|mysql|delete from wx_gateway.wx_template_msg where create_time < date_sub ( now ( ) , interval :1 day )|1|32|32||0|0|1074007|1074007|0|0|
|message_push|delete from message_log where create_time < :1|1|16|16||0|0|156324|156324|0|0|
|corpwx|update external_user set un_assign_flag = :1 where ( tenant_id = :2 and un_assign_flag = :3 )|1|1|1||0|0|209180|209180|0|0|
|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|
|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|61|61|
|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 inner 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 = :1 and tu.tenant_app_id = :2 and mb.erp_member_id in ( :3 , :4 , :5 , :6 , :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 , :15 , :16 , :17 , :18 , :19 , :20 , :21 , :22 , :23 , :24 , :25 , :26 , :27 , :28 , :29 , :30 , :31 , :32 , :33 , :34 , :35 , :36 , :37 , :38 , :39 , :40 , :41 , :42 , :43 , :44 , :45 , :46 , :47 , :48 ,|1|1|1||0|0|484795|484795|70|70|
|mysql|insert into erp_sync.sync_record_20190924 select * from erp_sync.sync_record where create_time < date_sub ( now ( ) , interval :1 day )|1|24|24||0|0|1272161|1272161|0|0|
|tenant|select es.id , es.sales_no , es.sales_date , es.dept_erp_id , shop.shop_name as dept_name , es.employee_name , es.member_erp_id , es.comment_id from tenant.erp_sales es left join tenant.tenant_wechatapp_shop shop on shop.tenant_wechatapp_id = es.tenant_wechatapp_id and shop.dept_erp_id = es.dept_erp_id join tenant.employee e on e.tenant_id = es.tenant_id and e.employee_erp_id = es.employee_erp_id join tenant.employee_shop esh on esh.tenant_app_id = es.tenant_wechatapp_id and esh.employee_id = e.id and esh.dept_erp_id = es.dept_erp_id where es.tenant_wechatapp_id = :1 and es.dept_erp_id = :2 and es.comment_id is not null and es.comment_id != :3 and esh.status in ( :4 , :5 ) limit :6 , :7|1|3|3||0|0|1317419|1317419|25|25|
|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 , a.send_count , a.message , a.source_type from sms_send a 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 = :1 where a.tenant_app_id = :2 ) table_count|1|9|9||0|0|267491|267491|1|1|
|user_service|select tu.user_id , tm.shop_id , mb.erp_member_id membererpid , tu.mobile_no , tu.user_name , ue.employee_id , tm.grade_id from user_service.tenant_member tu inner join user_service.tenant_member_info tm on tu.tenant_id = tm.tenant_id and tu.id = tm.id inner join user_service.tenant_member_bind mb on tu.tenant_id = mb.tenant_id and tu.id = mb.id inner 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 = :1 and tu.tenant_app_id = :2 and mb.erp_member_id in ( :3 , :4 , :5 , :6 , :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 , :15 , :16 , :17 , :18 , :19 , :20 , :21 , :22 , :23 , :24 , :25 , :26 , :27 , :28 , :29 , :30 , :31 , :32 , :33 , :34 , :35 , :36 , :37 , :38 , :39 , :40 , :41 , :42 , :43 , :44 , :45 , :46 , :47 , :48 , :49 ,|1|1|1||0|0|337441|337441|70|70|
|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.product_status = :4 and p.tenant_id = :5 and p.product_name like :6 and p.product_type = :7 ) order by p.id desc limit :8|1|1|1||0|0|20253|20253|1|1|
|user_service|select count ( 0 ) from ( select ue.user_id as id , tm.user_name as username , tm.head_img_url as headimgurl , tm.user_name as nickname , tm.mobile_no as mobile , tm.sex , if ( ifnull ( wu.is_subscribe , 0 ) = 0 , false , true ) as hassubscribe from user_service.user_employee ue join user_service.tenant_member tm on tm.tenant_id = ue.tenant_id and tm.tenant_app_id = ue.tenant_wechatapp_id and tm.user_id = ue.user_id join user_service.tenant_member_info tmi on tmi.tenant_id = tm.tenant_id and tmi.id = tm.id join user_service.tenant_member_bind tmb on tmb.tenant_id = ue.tenant_id and tmb.tenant_app_id = ue.tenant_wechatapp_id and tmb.user_id = ue.user_id left join user_service.wx_user wu on wu.id = tmb.wx_user_id where ue.employee_id = :1 and ue.tenant_id = :2 and ue.tenant_wechatapp_id = :3 and tmi.shop_id = :4 and ue.user_id not in ( :5 ) order by tm.id desc ) tmp_count|1|1|1||0|0|244689|244689|1|1|
|platform|select * from ( select u.id as memberid , act.id as bid , u.headimgurl , u.nickname , b.id as ismemberid , b.nickname as isnickname , l.createtime , b.headimgurl as isheadimgurl from bargainapplication act join bargainlog l on act.id = l.bid join member u on act.uid = u.id join member b on l.uid = b.id where :1 = :2 and actid = :3 order by bid ) as tv limit :4 , :5|1|1|1||0|0|408357|408357|20|20|
|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|4|4||0|0|322234|322234|1|1|
|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|363781|363781|0|0|
|warranty_service|select count ( * ) from warranty where user_id = :1 and tenant_wechatapp_id = :2 and is_disable = :3|1|1|1||0|0|3968|3968|1|1|
|user_service|select tu.user_id , tm.shop_id , mb.erp_member_id membererpid , tu.mobile_no , tu.user_name , ue.employee_id , tm.grade_id from user_service.tenant_member tu inner join user_service.tenant_member_info tm on tu.tenant_id = tm.tenant_id and tu.id = tm.id inner join user_service.tenant_member_bind mb on tu.tenant_id = mb.tenant_id and tu.id = mb.id inner 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 = :1 and tu.tenant_app_id = :2 and mb.erp_member_id in ( :3 , :4 , :5 , :6 , :7 , :8 , :9 , :10 , :11 , :12 , :13 , :14 , :15 , :16 , :17 , :18 , :19 , :20 , :21 , :22 , :23 , :24 , :25 , :26 , :27 , :28 , :29 , :30 , :31 , :32 , :33 , :34 , :35 , :36 , :37 , :38 , :39 , :40 , :41 , :42 )|1|3|3||0|0|609676|609676|37|37|
|platform|select * from ( select * from coupondetail where getuid = :1 and ( couponstate = :2 or couponstate = :3 ) and expirytime >= now ( ) ) as tv limit :4 , :5|1|2|2||0|0|322234|322234|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-1 day ) , date_add ( start_add_time , interval add_days + keeping_days-1 day ) from value_added_user where keeping_days > :1 and state = :2 and start_add_time = date_add ( curdate ( ) , interval :3 * ( add_days-1 ) day )|1|1|1||0|0|363791|363791|1136|1136|
|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|1|1|1||0|0|20293|20293|3|3|
|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|1|4|4||0|0|102870|102870|0|0|
|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 status = :2 and date_sub ( curdate ( ) , interval :3 day ) = date_format ( salesdate , :4 )|1|1|1||0|0|120774|120774|0|0|
|coupon_service|select id , tenant_id , tenant_app_id , template_id , coupon_push_id , coupon_no , coupon_state , user_id , coupon_name , coupon_type , face_value , discount , use_threshold , begin_time , end_time , wx_card_id , wx_card_no , source , source_id , business_id , create_time , update_time from coupon where ( tenant_id = :1 and tenant_app_id = :2 and wx_card_no = :3 )|1|3|3||0|0|108316|108316|1|1|
|gift_mail|select count ( 0 ) from ( select p.* , sp.take_type , ifnull ( pp.integral_price , ifnull ( ( select min ( inventory.price ) from inventory where inventory.product_id = p.id ) , :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.product_name like :6 and p.product_type = :7 )|1|1|1||0|0|20252|20252|1|1|
|erp_sync|select * from retry_data where tenant_app_id = :1 and user_id = :2|1|1|1||0|0|10103|10103|1|1|
|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|21211|21211|28|28|
|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|2855|2855|1|1|
|mysql|delete from erp_sync.sync_record where create_time < date_sub ( now ( ) , interval :1 day )|1|9|9||0|0|1272161|1272161|0|0|
|coupon_service|select id , tenant_id , tenant_app_id , template_id , coupon_push_id , coupon_no , coupon_state , user_id , coupon_name , coupon_type , face_value , discount , use_threshold , begin_time , end_time , wx_card_id , wx_card_no , source , source_id , business_id , create_time , update_time from coupon where ( tenant_id = :1 and tenant_app_id = :2 and wx_card_id = :3 and wx_card_no = :4 )|1|3|3||0|0|108316|108316|1|1|
