test.sql 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. -- 测试信息表
  2. CREATE TABLE IF NOT EXISTS test_tab (
  3. id INT AUTO_INCREMENT PRIMARY KEY COMMENT '用户唯一标识符',
  4. name VARCHAR(100) NOT NULL COMMENT '用户姓名',
  5. email VARCHAR(100) UNIQUE NOT NULL COMMENT '用户邮箱,唯一',
  6. age INT COMMENT '用户年龄',
  7. status ENUM('active', 'inactive') DEFAULT 'active' COMMENT '用户状态:active-活跃, inactive-非活跃',
  8. created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '记录创建时间',
  9. updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '记录最后更新时间',
  10. INDEX idx_email (email) COMMENT '邮箱索引,用于快速查找',
  11. INDEX idx_status (status) COMMENT '状态索引,用于按状态筛选'
  12. ) COMMENT='用户信息表';
  13. ### MySQL 数据库操作测试
  14. - 新增
  15. http://localhost:8001/test/mysql/add
  16. {
  17. "config": {
  18. "session_id":"10002"
  19. },
  20. "input": "张三"
  21. }
  22. - 查询列表
  23. http://localhost:8001/test/mysql/list
  24. {
  25. "config": {
  26. "session_id":"10002"
  27. },
  28. "input": "张三"
  29. }
  30. - 查询单个
  31. http://localhost:8001/test/mysql/get
  32. {
  33. "config": {
  34. "session_id":"10002"
  35. },
  36. "input": "4"
  37. }
  38. - 修改
  39. http://localhost:8001/test/mysql/update
  40. {
  41. "config": {
  42. "session_id":"1"
  43. },
  44. "input": "李四"
  45. }