Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
P
project-credit
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • 互联网应用开发
  • project-credit
  • Wiki
  • sql

sql · Changes

Page history
chenchang created page: sql authored Aug 16, 2016 by 金小龙's avatar 金小龙
Hide whitespace changes
Inline Side-by-side
Showing with 6 additions and 1 deletion
+6 -1
  • sql.md sql.md +6 -1
  • No files found.
sql.md
View page @ aa360fc5
...@@ -25,4 +25,9 @@ SELECT user_id, api_id, status, count(0) FROM personal_credit.api_log WHERE crea ...@@ -25,4 +25,9 @@ SELECT user_id, api_id, status, count(0) FROM personal_credit.api_log WHERE crea
INSERT INTO personal_credit.api_log_statistics (time_index, user_id, api_id, data_key, data_value, create_time) VALUES (20160815, 1, 1, 'call_error', 2, UNIX_TIMESTAMP(NOW())),(20160815, 1, 1, 'call_success', 2, UNIX_TIMESTAMP(NOW())),(20160815, 1, 1, 'call_total', 4, UNIX_TIMESTAMP(NOW())),(20160815, 1, 3, 'call_success', 1, UNIX_TIMESTAMP(NOW())),(20160815, 1, 3, 'call_total', 1, UNIX_TIMESTAMP(NOW())),(20160815, 2, 1, 'call_success', 1, UNIX_TIMESTAMP(NOW())),(20160815, 2, 1, 'call_total', 1, UNIX_TIMESTAMP(NOW()))ON DUPLICATE KEY UPDATE data_value = VALUES(data_value) INSERT INTO personal_credit.api_log_statistics (time_index, user_id, api_id, data_key, data_value, create_time) VALUES (20160815, 1, 1, 'call_error', 2, UNIX_TIMESTAMP(NOW())),(20160815, 1, 1, 'call_success', 2, UNIX_TIMESTAMP(NOW())),(20160815, 1, 1, 'call_total', 4, UNIX_TIMESTAMP(NOW())),(20160815, 1, 3, 'call_success', 1, UNIX_TIMESTAMP(NOW())),(20160815, 1, 3, 'call_total', 1, UNIX_TIMESTAMP(NOW())),(20160815, 2, 1, 'call_success', 1, UNIX_TIMESTAMP(NOW())),(20160815, 2, 1, 'call_total', 1, UNIX_TIMESTAMP(NOW()))ON DUPLICATE KEY UPDATE data_value = VALUES(data_value)
``` ```
对应表 :`api_log_statistics`; 对应表 :`api_log_statistics`;
查询条件:`time_index, user_id, api_id, data_key`; 查询条件:`time_index, user_id, api_id, data_key`;
\ No newline at end of file
* Credit_User_SearchHistoryController 控制器
```
SELECT * FROM `api_log_statistics` WHERE `api_id` IN (?) AND `data_key` = ? AND `time_index` <= ? AND `time_index` >= ? AND `user_id` = ? ORDER BY time_index ASC
```
\ No newline at end of file
Clone repository
  • api
  • crontab
  • db
  • doc
  • files
  • Home
  • sql