|数据库名称|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 )|92|166|5||0|0|1885221|20558|92|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|84|151|4||0|0|1722899|20578|1295|20|
|platform|select count ( 1 ) from `salesdetaillog` where `vendorid` = :1 and `noteid` = :2|56|103|4||0|0|1843026|40529|56|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 )|43|74|3||0|0|33022024|767963|18|11|
|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|28|34|1||0|0|7687857|346757|28|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|26|69|11||0|0|2391176|139130|26|1|
|platform|select count ( 1 ) from coupondetail cd where getuid = :1 and ( couponstate = :2 or couponstate = :3 ) and date_format ( expirytime , :4 ) >= curdate ( )|25|52|2||0|0|8055850|322234|25|1|
|platform|select `typefullname` , `methodname` , `arguments` , `partition` , `offset` , `createtime` , `updatetime` , `retried` , `errormsg` , `id` from `pushlog` where `typefullname` = :1 and `methodname` = :2 and `arguments` = :3|23|35|5||0|0|5796225|258256|1|1|
|platform|select count ( 1 ) from `integrallog` where `vendorid` = :1 and `changefrom` = :2 and `changeid` = :3|21|32|2||0|0|594790|34994|21|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|19|24|2||0|0|1394389|85453|19|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|17|45|8||0|0|572141|90724|0|0|
|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|14|98|15||0|0|88855069|6351624|14|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|14|25|2||0|0|6952143|740532|1628|332|
|corpwx|update external_user set un_assign_flag = :1 where ( tenant_id = :2 and corp_user_id = :3 and user_id = :4 )|13|16|1||0|0|2375335|182719|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|12|19|2||0|0|1584295|139111|0|0|
|user_service|select count ( 0 ) from user_service.user_employee ue join user_service.tenant_member tm on tm.tenant_id = ue.tenant_id and tm.tenant_app_id = ue.tenant_wechatapp_id and tm.user_id = ue.user_id 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|11|12|1||0|0|4943867|493103|11|1|
|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|13|2||0|0|366682|44347|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|9|23|3||0|0|2131473|242385|44|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|7|16|3||0|0|820605|117230|42|6|
|corpwx|update external_user set wx_user_id = :1 where ( tenant_id = :2 and user_id = :3 )|5|7|1||0|0|913589|182718|0|0|
|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|5|5|1||0|0|413013|82998|0|0|
|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|7|2||0|0|135|70|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|4|4|1||0|0|15791|5605|4|1|
|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|4|9|4||0|0|1395411|539162|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|3|5|2||0|0|111878|40451|11|5|
|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|6|3||0|0|100668|62529|36|34|
|comment_service|select *from comment_service.comment_reward where comment_id = :1 limit :2|2|2|1||0|0|177659|88830|2|1|
|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|13|9||0|0|93295|63789|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 )|2|2|1||0|0|216637|138238|34|18|
|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 ,|2|5|4||0|0|1414865|740532|263|219|
|mysql|delete from message_push.message_log where create_time < date_sub ( now ( ) , interval :1 day )|1|3|3||0|0|71910|71910|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|
|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|1|1|1||0|0|439583|439583|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|5|5||0|0|120774|120774|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|1|1|1||0|0|105498|105498|0|0|
|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 ) order by p.id desc limit :6|1|1|1||0|0|20457|20457|10|10|
|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 )|1|1|1||0|0|5268|5268|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|2|2||0|0|22486|22486|28|28|
|mysql|delete from wx_gateway.wx_template_msg where create_time < date_sub ( now ( ) , interval :1 day )|1|30|30||0|0|1039364|1039364|0|0|
|gift_mail|select t.id , t.trade_no , t.create_time , t.order_status as tradestatus , p.product_name , p.default_image_url as productimage , t.specification , t.price from gift_mail.trade t left outer join gift_mail.product p on p.id = t.product_id left outer join gift_mail.trade_take tt on tt.trade_id = t.id where ( t.tenant_wechatapp_id = :1 and t.trade_type = :2 and t.order_status = :3 ) order by id desc limit :4|1|8|8||0|0|45660|45660|6|6|
|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 , :6 )|1|1|1||0|0|480639|480639|1|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.product_status = :4 and p.tenant_id = :5 and p.product_type = :6 ) order by p.id desc limit :7|1|1|1||0|0|20442|20442|4|4|
|platform|select count ( 1 ) from `taskassignment` ta where ta.tasktype = :1 and ( ta.taskstatus = :2 or ta.taskstatus = :3 ) and vendorid = :4 and uid = :5|1|1|1||0|0|767963|767963|1|1|
|gift_mail|select count ( 0 ) from gift_mail.trade t left outer join gift_mail.product p on p.id = t.product_id left outer join gift_mail.trade_take tt on tt.trade_id = t.id where ( t.tenant_wechatapp_id = :1 and t.trade_type = :2 and t.order_status = :3 )|1|4|4||0|0|44752|44752|1|1|
|mysql|insert into erp_sync.sync_record_20190924 select * from erp_sync.sync_record where create_time < date_sub ( now ( ) , interval :1 day )|1|14|14||0|0|600170|600170|0|0|
|user_service|select tu.user_id , tm.shop_id , mb.erp_member_id membererpid , tu.mobile_no , tu.user_name , ue.employee_id , tm.grade_id from user_service.tenant_member tu inner join user_service.tenant_member_info tm on tu.tenant_id = tm.tenant_id and tu.id = tm.id inner join user_service.tenant_member_bind mb on tu.tenant_id = mb.tenant_id and tu.id = mb.id 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|1|1||0|0|191247|191247|39|39|
|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 )|1|1|1||0|0|3974|3974|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_type = :6 )|1|1|1||0|0|20438|20438|1|1|
|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|
|message_push|delete from message_log where create_time < :1|1|17|17||0|0|170565|170565|0|0|
|user_service|select tu.user_id , tm.shop_id , mb.erp_member_id membererpid , tu.mobile_no , tu.user_name , ue.employee_id , tm.grade_id from user_service.tenant_member tu inner join user_service.tenant_member_info tm on tu.tenant_id = tm.tenant_id and tu.id = tm.id inner join user_service.tenant_member_bind mb on tu.tenant_id = mb.tenant_id and tu.id = mb.id 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 )|1|1|1||0|0|137966|137966|11|11|
|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|2|2||0|0|120774|120774|0|0|
|user_service|select count ( 0 ) from ( select tm.user_id as userid , tm.head_img_url as headimgurl , tm.user_name as nickname , tm.mobile_no as mobileno , tm.sex , date_format ( tm.create_time , '%y-%m-%d%h:%i:%s' ) as registertime , tm.id as tenantuserid from user_service.tenant_member tm join user_service.tenant_member_bind tmb on tm.tenant_id = tmb.tenant_id and tm.id = tmb.id join user_service.tenant_member_info tmi on tm.tenant_id = tmi.tenant_id and tm.id = tmi.id 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 = :1 and tmi.tenant_id = :2 and tmi.tenant_app_id = :3 ) table_count|1|1|1||0|0|518666|518666|1|1|
|order|select max ( create_time ) from `order`.order_operator_log where tenant_wechatapp_id = :1 and order_id = :2|1|1|1||0|0|322715|322715|1|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|1|2|2||0|0|19703|19703|0|0|
|coupon_service|select count ( 0 ) from ( select cu.id , cu.coupon_name , cu.coupon_type , cu.coupon_no , cu.source as couponchannel , cu.coupon_state , ce.user_name , ce.creator_user_name as creatorname , round ( cu.face_value/100 , 2 ) as facevalue , cu.begin_time , cu.end_time , ce.remark , ce.mobile_no , ce.creator_mobile_no , cu.create_time , wol.create_time as writeofftime , r.create_time as reservationdate , r.shop_name as reservationshopname , if ( wol.employee_id is null , wol.user_name , wol.employee_name ) writeoffusername , wol.shop_id as shopid , wol.dept_erp_id as erpdeptid , cu.user_id , ce.source_user_id , ce.source_user_type from coupon_service.coupon cu join coupon_service.coupon_extend ce on ce.id = cu.id left join coupon_service.coupon_write_off_log wol on wol.tenant_app_id = cu.tenant_app_id and wol.coupon_id = cu.id and wol.state = :1 left join coupon_service.reservation r on r.coupon_user_id = cu.id and r.state = :2 where cu.tenant_app_id = :3 and cu.coupon_name like concat ( concat ( :4 , :5 ) , :6 ) and cu.template_id = :7 and cu.source = :8 ) tmp_count|1|1|1||0|0|31825|31825|1|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 ( ( 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|18789|18789|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 in ( :6 , :7 ) and expire_time >= :8 order by create_time desc limit :9|1|1|1||0|0|66535|66535|1|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 , :7|1|1|1||0|0|20571|20571|20|20|
|coupon_service|select count ( 0 ) from ( select cu.id , cu.coupon_name , cu.coupon_type , cu.coupon_no , cu.source as couponchannel , cu.coupon_state , ce.user_name , ce.creator_user_name as creatorname , round ( cu.face_value/100 , 2 ) as facevalue , cu.begin_time , cu.end_time , ce.remark , ce.mobile_no , ce.creator_mobile_no , cu.create_time , wol.create_time as writeofftime , r.create_time as reservationdate , r.shop_name as reservationshopname , if ( wol.employee_id is null , wol.user_name , wol.employee_name ) writeoffusername , wol.shop_id as shopid , wol.dept_erp_id as erpdeptid , cu.user_id , ce.source_user_id , ce.source_user_type from coupon_service.coupon cu join coupon_service.coupon_extend ce on ce.id = cu.id left join coupon_service.coupon_write_off_log wol on wol.tenant_app_id = cu.tenant_app_id and wol.coupon_id = cu.id and wol.state = :1 left join coupon_service.reservation r on r.coupon_user_id = cu.id and r.state = :2 where cu.tenant_app_id = :3 and cu.coupon_name like concat ( concat ( :4 , :5 ) , :6 ) and cu.coupon_state = :7 and cu.template_id = :8 and cu.source = :9 ) tmp_count|1|1|1||0|0|20351|20351|1|1|
|coupon_service|select count ( 0 ) from ( select egc.id , tmp.coupon_name , tmp.coupon_type , tmp.remark , cp.take_effect_way , cp.take_start_day , cp.take_effect_day , date_format ( cp.begin_time , '%y-%m-%d' ) as begin_time , date_format ( cp.end_time , '%y-%m-%d' ) as end_time , egc.limit_grant_time , date_format ( egc.grant_begin_time , '%y-%m-%d' ) as grant_begin_time , date_format ( egc.grant_end_time , '%y-%m-%d' ) as grant_end_time , ifnull ( tmp.face_value , 0 ) /100 as face_value , ifnull ( tmp.discount , 0 ) /10 as discount , tmp.scope , tmp.product_name , if ( egc.state = 'down' , 1 , ( case when cp.end_time is not null and cp.end_time < now ( ) then :1 when egc.limit_grant_time = :2 and egc.grant_end_time < now ( ) then :3 when tgl.put_quantity <= ( select count ( * ) from coupon_service.employee_give_coupon_log where employee_give_coupon_id = egc.id ) then :4 else :5 end ) ) as state from coupon_service.employee_give_coupon egc inner join coupon_service.coupon_push cp on egc.template_id = cp.template_id and cp.source = :6 and egc.id = cp.source_id and cp.state = :7 inner join coupon_service.template tmp on egc.template_id = tmp.id and tmp.state = :8 inner join coupon_service.template_grant_limit tgl on cp.id = tgl.coupon_push_id where egc.tenant_app_id = :9 and ( egc.limit_grant_time = :10 or egc.grant_begin_time <= now ( ) ) and ( egc.limit_shop = :11 or exists ( select 1 from coupon_service.employee_give_coupon_shop cs where egc.id = cs.employee_give_id and cs.shop_id = :12 ) ) and egc.limit_role in ( :13 , :14 ) order by state asc , egc.id desc ) tmp_count|1|1|1||0|0|479129|479129|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-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|2|2||0|0|377899|377899|866|866|
|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|
|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 )|1|1|1||0|0|20447|20447|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|34|34|
|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 )|1|1|1||0|0|14568|14568|7|7|
|order|select sum ( amount ) from tenant.erp_sales where tenant_wechatapp_id = :1 and sales_date between :2 and :3 and sales_status = :4 and is_sales = :5|1|1|1||0|0|70350|70350|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|377892|377892|0|0|
|warranty_service|select count ( 0 ) from warranty_service.warranty where tenant_wechatapp_id = :1 and is_disable = false and dept_erp_id = :2 and sales_date >= :3 and sales_date <= :4 and employee_erp_id in ( :5 , :6 , :7 , :8 , :9 )|1|1|1||0|0|3974|3974|1|1|
|mysql|delete from erp_sync.sync_record where create_time < date_sub ( now ( ) , interval :1 day )|1|1|1||0|0|600170|600170|0|0|
|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 )|1|1|1||0|0|23944|23944|1|1|
