Database Queries

总计17条数据
TimeDurationTypeQuery
  
23:14:52.5914.4 msSELECTSELECT * FROM "global"."vw_user_login" WHERE "id"=5250

23:14:52.6002.1 msSELECTSELECT * FROM "a57be577deb434"."tbl_users" WHERE "id"=5250

23:14:52.6061.6 msSELECTSELECT "user_id" FROM "a57be577deb434"."tbl_user_role_change_logs" "urcl" LEFT JOIN "a57be577deb434"."tbl_users" "u" ON urcl.user_id = u.id WHERE ("role_name"='AccountManager') AND (((start_from < end_at) or end_at is null)) AND (tsrange(start_from::TIMESTAMP, end_at::TIMESTAMP, '[)') && '[2025-01-01 00:00:00, 2025-12-31 23:59:59]'::tsrange) GROUP BY "user_id", "pinyin1", "namecut1", "pinyin2", "namecut2", "pinyin3", "namecut3", "pinyin4", "namecut4" ORDER BY pinyin1 nulls first, namecut1 nulls first, pinyin2 nulls first, namecut2 nulls first, pinyin3 nulls first, namecut3 nulls first, pinyin4 nulls first, namecut4 nulls first

23:14:52.6081.1 msSELECTSELECT "created_by" FROM "a57be577deb434"."tbl_projects" WHERE ("bargain_date" >= '2025-01-01 00:00:00') AND ("bargain_date" <= '2025-12-31 23:59:59') AND ("project_status"=3) AND ("created_by" NOT IN (5329, 5332, 5448, 5420, 1001, 5087, 5300, 5311, 5295, 1013, 1004, 1005, 5449)) GROUP BY "created_by"

23:14:52.6100.7 msSELECTSELECT g.name, string_agg( sgr.sales_id::varchar, ',') AS list FROM "a57be577deb434"."tbl_groups" "g" LEFT JOIN "a57be577deb434"."tbl_sales_group_relationships" "sgr" ON sgr.group_id = g.id WHERE "sgr"."sales_id" IN (5329, 5332, 5448, 5420, 1001, 5087, 5300, 5311, 5295, 1013, 1004, 1005, 5449) GROUP BY "g"."name"

23:14:52.6111.0 msSELECTSELECT count(id) AS count FROM "a57be577deb434"."tbl_clients" WHERE "sales_rep" IN ('1001', '1004', '1005', '1013', '5087', '5295', '5300', '5311', '5329', '5332', '5420', '5448', '5449')

23:14:52.6120.5 msSELECTSELECT count(id) AS count FROM "a57be577deb434"."tbl_clients" WHERE sales_rep is null

23:14:52.61314.7 msSELECTSELECT COUNT(*) FROM (SELECT DISTINCT c.id, c.client_class, cc.notice_days, extract(epoch from (now() - max(sl.end_at))) / 86400 as last_contact FROM "a57be577deb434"."tbl_clients" "c" LEFT JOIN "a57be577deb434"."tbl_client_classes" "cc" ON cc.id = c.client_class LEFT JOIN "a57be577deb434"."tbl_work_logs" "sl" ON sl.client_id = c.id and sl.is_draft = false WHERE ("c"."sales_rep" IN ('1001', '1004', '1005', '1013', '5087', '5295', '5300', '5311', '5329', '5332', '5420', '5448', '5449')) AND ("c"."deleted" = FALSE) GROUP BY "c"."id", "cc"."id") "sub" WHERE sub.last_contact > sub.notice_days

23:14:52.6281.2 msSELECTSELECT sum(p.budget * p.profit_pct / 100) AS profits, sum(p.budget) AS currents, sum(p.collected) AS collected, sum(case when p.budget >= p.collected THEN p.budget - p.collected ELSE 0 END) AS un_collected, count(p.id) AS count_current FROM "a57be577deb434"."tbl_projects" "p" WHERE ("p"."created_by" IN ('1001', '1004', '1005', '1013', '5087', '5295', '5300', '5311', '5329', '5332', '5420', '5448', '5449')) AND ("p"."project_status"=3) AND (p.bargain_date >= '2025-01-01 00:00:00' AND p.bargain_date < timestamp '2025-12-31 23:59:59' + interval '1 second')

23:14:52.6304.9 msSELECTSELECT sum(c.erp_settle_amount) AS collected FROM (SELECT * FROM ((SELECT '1' || r.id::varchar as id, 1 as ticket_type, r.sales_contract_id as contract_id, r.amount as amount, t.created_at as collected_date, t.created_at, t.created_by, t.abstract as description FROM "a57be577deb434"."tbl_erp_collect_ticket_settles" "r" LEFT JOIN "a57be577deb434"."tbl_erp_collect_tickets" "t" ON r.erp_collect_ticket_id = t.id WHERE (r.sales_contract_id is not null) AND ("t"."status" IN (2, 5, 1))) UNION ALL ( SELECT '2' || r.id::varchar as id, 2 as ticket_type, r.sales_contract_id as contract_id, r.amount as amount, t.created_at as collected_date, t.created_at, t.created_by, t.abstract as description FROM "a57be577deb434"."tbl_erp_cash_cost_ticket_sales_contract_settles" "r" LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON r.erp_cash_cost_ticket_id = t.id WHERE (r.sales_contract_id is not null) AND ("t"."status" IN (2, 5, 1)) ) UNION ALL ( SELECT '3' || r.id::varchar as id, 3 as ticket_type, r.sales_contract_id as contract_id, 0 - r.amount as amount, t.created_at as collected_date, t.created_at, t.created_by, t.abstract as description FROM "a57be577deb434"."tbl_erp_payment_ticket_settles" "r" LEFT JOIN "a57be577deb434"."tbl_erp_payment_tickets" "t" ON r.erp_payment_ticket_id = t.id WHERE (r.sales_contract_id is not null) AND ("t"."status" IN (2, 5, 1)) )) "sub") "scp" LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "c" ON c.id = scp.contract_id LEFT JOIN "a57be577deb434"."tbl_projects" "p" ON c.from_project = p.id WHERE ("p"."created_by" IN ('1001', '1004', '1005', '1013', '5087', '5295', '5300', '5311', '5329', '5332', '5420', '5448', '5449')) AND ("p"."project_status"=3) AND (scp.collected_date >= '2025-01-01 00:00:00' AND scp.collected_date < timestamp '2025-12-31 23:59:59' + interval '1 second')

23:14:52.6350.9 msSELECTSELECT sum(case when p.budget >= p.collected THEN p.budget - p.collected ELSE 0 END) AS un_collected FROM "a57be577deb434"."tbl_projects" "p" WHERE ("p"."created_by" IN ('1001', '1004', '1005', '1013', '5087', '5295', '5300', '5311', '5329', '5332', '5420', '5448', '5449')) AND ("p"."project_status"=3)

23:14:52.6361.9 msSELECTSELECT count(*) as count, sum(budget) as sum, sum(budget * profit_pct / 100) AS profits, "project_status" FROM (SELECT budget, profit_pct, CASE WHEN project_status = 3 and budget <= collected THEN 0 WHEN project_status = 3 and budget > collected THEN 3 ELSE project_status END as project_status FROM "a57be577deb434"."tbl_projects" "p" WHERE "p"."created_by" IN ('1001', '1004', '1005', '1013', '5087', '5295', '5300', '5311', '5329', '5332', '5420', '5448', '5449')) "sub" GROUP BY "project_status"

23:14:52.6392.8 msSELECTSELECT sum(sci.amount) AS invoices FROM "a57be577deb434"."tbl_sales_contract_invoices" "sci" LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "c" ON c.id = sci.contract_id LEFT JOIN "a57be577deb434"."tbl_projects" "p" ON c.project_id = p.id WHERE "p"."created_by" IN ('1001', '1004', '1005', '1013', '5087', '5295', '5300', '5311', '5329', '5332', '5420', '5448', '5449')

23:14:52.6422.8 msSELECTSELECT sum(sub.invoices) as invoices FROM (SELECT sc.id, CASE WHEN sum(sci.amount) > sc.amount or sc.including_tax = false THEN 0 ELSE sc.amount - (CASE WHEN SUM ( sci.amount ) IS NOT NULL THEN SUM ( sci.amount ) ELSE 0 END) END as invoices FROM "a57be577deb434"."tbl_sales_contracts" "sc" LEFT JOIN "a57be577deb434"."tbl_sales_contract_invoices" "sci" ON sc.id = sci.contract_id LEFT JOIN "a57be577deb434"."tbl_projects" "p" ON sc.project_id = p.id WHERE ("p"."created_by" IN ('1001', '1004', '1005', '1013', '5087', '5295', '5300', '5311', '5329', '5332', '5420', '5448', '5449')) AND ("sc"."including_tax"=TRUE) GROUP BY "sc"."id") "sub"

23:14:52.6454.0 msSELECTSELECT * FROM "a57be577deb434"."tbl_visit_module_histories" WHERE ("user_id"=5250) AND ("object_type"=23) AND ("visit_date"='2025-08-31')

23:14:52.6491.0 msUPDATEUPDATE "a57be577deb434"."tbl_visit_module_histories" SET "num"=4, "last_visit_at"='now()' WHERE "id"=55416

23:14:52.6501.1 msINSERTINSERT INTO "global"."tbl_api_log" ("code", "schema", "user_id", "device_type", "url", "request", "response", "php_error", "time") VALUES (200, 'a57be577deb434', 5250, 5, 'vue/analysis/sales-counts', '{"period":"today","period2":"currentfascalyear","status":"","dataUserId":"1001,1004,1005,1013,5087,5295,5300,5311,5329,5332,5420,5448,5449","alert":"false","web_access_token":"HRJtynI-E0wmAZJhW07mofn0AVjTn_iH"}', '{"code":2000,"result":{"counts":[{"name":"\u5f53\u524d\u9690\u6027\u9700\u6c42","key":"status1","value":17,"unit":"\u4e2a","valueEx":770.97,"unitEx":"\u4e07","color":"#98c450","link":{}},{"name":"\u5f53\u524d\u660e\u786e\u9700\u6c42","key":"status2","value":26,"unit":"\u4e2a","valueEx":4068.45,"unitEx":"\u4e07","color":"#98c450","link":{}},{"name":"\u672c\u8d22\u5e74\u6210\u4ea4\u91d1\u989d","key":"journal_account_accomplished","value":150,"unit":"\u4e2a","valueEx":2999.34,"unitEx":"\u4e07","color":"#649fd7","link":{}},{"name":"\u672c\u8d22\u5e74\u5229\u6da6","key":"profit_accomplished","value":150,"unit":"\u4e2a","valueEx":1372.77,"unitEx":"\u4e07","color":"#649fd7","link":{}},{"name":"\u672c\u8d22\u5e74\u5df2\u6536\u6b3e\u91d1\u989d","key":"collected","value":5745.95,"unit":"\u4e07","valueEx":"","unitEx":"","color":"#649fd7","link":{}},{"name":"\u672a\u6536\u6b3e\u91d1\u989d","key":"un_collected","value":1902.07,"unit":"\u4e07","valueEx":"","unitEx":"","color":"#649fd7","link":{}},{"name":"\u5ba2\u6237\u6570\u91cf\/\u8d85\u671f\u672a\u8054\u7cfb","key":"total_client_number","value":999,"unit":932,"valueEx":256,"unitEx":"\u4e2a","color":"#98c450","link":{"url":"client","filter":[{"key":"ClientSearch[sales_rep]","value":""}]}},{"name":"\u5df2\u5f00\/\u672a\u5f00\u53d1\u7968\u91d1\u989d","key":"invoices","value":27264.34,"unit":"\u4e07","valueEx":2318.94,"unitEx":"\u4e07","color":"#e75a4a","link":{"url":"client","filter":[{"key":"ClientSearch[sales_rep]","value":""}]}},{"name":"\u7d2f\u8ba1\u6210\u4ea4\u91d1\u989d","key":"status3","value":1043,"unit":"\u4e2a","valueEx":29195.87,"unitEx":"\u4e07","color":"#98c450","link":{}},{"name":"\u7d2f\u8ba1\u6210\u4ea4\u5229\u6da6","key":"status3","value":1043,"unit":"\u4e2a","valueEx":6516.85,"unitEx":"\u4e07","color":"#98c450","link":{}},{"name":"\u7d2f\u8ba1\u5931\u8d25\u91d1\u989d","key":"status4","value":278,"unit":"\u4e2a","valueEx":11772.08,"unitEx":"\u4e07","color":"#98c450","link":{}},{"name":"\u7d2f\u8ba1\u6401\u7f6e\u91d1\u989d","key":"status5","value":366,"unit":"\u4e2a","valueEx":15090.03,"unitEx":"\u4e07","color":"#98c450","link":{}}]},"status":1,"msg":[{"name":"success","success":"\u6210\u529f\u83b7\u53d6\u6570\u636e","error":""}],"mod":0}', FALSE, '2025-08-31 23:14:52') RETURNING "id"