-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- 主机： localhost
-- 生成日期： 2026-06-22 16:27:14
-- 服务器版本： 5.7.26
-- PHP 版本： 7.3.4

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- 数据库： `jc_open_platform`
--

-- --------------------------------------------------------

--
-- 表的结构 `admin_users`
--

CREATE TABLE `admin_users` (
  `id` bigint(20) NOT NULL,
  `username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `password_hash` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL,
  `role` enum('admin','viewer') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '角色: admin/viewer',
  `status` smallint(6) DEFAULT NULL COMMENT '1=启用 0=禁用',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- 转存表中的数据 `admin_users`
--

INSERT INTO `admin_users` (`id`, `username`, `password_hash`, `role`, `status`, `created_at`) VALUES
(1, 'admin', '$2b$12$9A5ZKeGsMDRzk.5BdKC7dOVhox1ciLqnueM/ZLBokDl7aUkxe2jSa', 'admin', 1, '2026-06-16 17:29:55');

-- --------------------------------------------------------

--
-- 表的结构 `api_keys`
--

CREATE TABLE `api_keys` (
  `id` bigint(20) NOT NULL,
  `client_id` bigint(20) NOT NULL,
  `api_key` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'API Key 公开标识',
  `api_secret_hash` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'API Secret SHA256 哈希',
  `status` smallint(6) DEFAULT NULL COMMENT '1=启用 0=禁用',
  `rate_limit_per_minute` int(11) DEFAULT NULL COMMENT '每分钟限流次数',
  `rate_limit_per_day` int(11) DEFAULT NULL COMMENT '每天限流次数',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- 转存表中的数据 `api_keys`
--

INSERT INTO `api_keys` (`id`, `client_id`, `api_key`, `api_secret_hash`, `status`, `rate_limit_per_minute`, `rate_limit_per_day`, `created_at`) VALUES
(1, 1, '4e2bf206a82f846c699e978cea8c2f87', 'e763f998cbc9ceb3ff41356638d18e7725cb6b6d2ae02bdc4bdbba55a0978a4f', 1, 60, 5000, '2026-06-16 17:42:13'),
(2, 2, '5accba6300d79ed4dfc760bfe2dd1706', '5e656527cdf5e3390daf55635dbf8b6238ca60187a45d1dd2b4e665b716fd847', 1, 60, 5000, '2026-06-16 17:42:13'),
(4, 3, '188daebd9c2df615eeaa6cb56a904432', '8e9a5bcea99396653b2f9d7189e8ed3cab16860a3c1c3f978d9c831b274f6761', 1, 60, 5000, '2026-06-17 20:40:21'),
(7, 3, '95361b57cb0d3df13faa60de3ddad1aa', '15bf61093e55d6f17a977ae4d7f3ea492fee17251c0900329424b5832d0101b2', 1, 60, 5000, '2026-06-17 21:16:29'),
(8, 5, '26f4214d10306ac64c80528fd36ebaa3', '8cb79da24a47d5fe3ec345479a02491792c313a7fa97abcf47e01a0ab829f35a', 1, 60, 5000, '2026-06-17 21:30:13'),
(9, 4, '9c736cd495816be2d70a33db10e56fda', '16eb4c56fb4f112c559a05eda2875df32c10ea75a18431c228fc44ce20a2f2a1', 1, 60, 5000, '2026-06-17 21:30:16');

-- --------------------------------------------------------

--
-- 表的结构 `api_logs`
--

CREATE TABLE `api_logs` (
  `id` bigint(20) NOT NULL,
  `api_key_id` bigint(20) NOT NULL,
  `client_id` bigint(20) NOT NULL,
  `endpoint` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '接口路径',
  `request_params` json DEFAULT NULL COMMENT '请求参数(脱敏)',
  `response_code` int(11) DEFAULT NULL COMMENT 'HTTP 响应码',
  `response_body` json DEFAULT NULL COMMENT '响应体(精简)',
  `record_count` int(11) DEFAULT NULL COMMENT '返回数据条数',
  `duration_ms` int(11) DEFAULT NULL COMMENT '耗时(毫秒)',
  `ip_address` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `error_message` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '错误信息',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `sql_query` text COLLATE utf8mb4_unicode_ci COMMENT '执行的SQL查询语句'
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- 转存表中的数据 `api_logs`
--

INSERT INTO `api_logs` (`id`, `api_key_id`, `client_id`, `endpoint`, `request_params`, `response_code`, `response_body`, `record_count`, `duration_ms`, `ip_address`, `error_message`, `created_at`, `sql_query`) VALUES
(1, 2, 2, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 4105, '127.0.0.1', NULL, '2026-06-17 22:33:28', NULL),
(2, 2, 2, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 4188, '127.0.0.1', NULL, '2026-06-17 22:36:59', NULL),
(3, 2, 2, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 4078, '127.0.0.1', NULL, '2026-06-17 22:37:14', NULL),
(4, 2, 2, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 2, '127.0.0.1', NULL, '2026-06-17 22:37:16', NULL),
(5, 2, 2, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 3, '127.0.0.1', NULL, '2026-06-17 22:37:17', NULL),
(6, 2, 2, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 2, '127.0.0.1', NULL, '2026-06-17 22:37:18', NULL),
(7, 4, 3, '/api/v1/chuku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 4104, '127.0.0.1', NULL, '2026-06-17 22:40:25', NULL),
(8, 4, 3, '/api/v1/chuku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 4081, '127.0.0.1', NULL, '2026-06-17 22:42:13', NULL),
(9, 4, 3, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 4074, '127.0.0.1', NULL, '2026-06-17 22:43:23', NULL),
(10, 4, 3, '/api/v1/chuku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 4115, '127.0.0.1', NULL, '2026-06-17 22:44:31', NULL),
(11, 4, 3, '/api/v1/chuku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 3, '127.0.0.1', NULL, '2026-06-17 22:44:32', NULL),
(12, 4, 3, '/api/v1/chuku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 2, '127.0.0.1', NULL, '2026-06-17 22:44:33', NULL),
(13, 4, 3, '/api/v1/chuku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 2, '127.0.0.1', NULL, '2026-06-17 22:44:33', NULL),
(14, 4, 3, '/api/v1/chuku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 2, '127.0.0.1', NULL, '2026-06-17 22:44:34', NULL),
(15, 4, 3, '/api/v1/chuku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 2, '127.0.0.1', NULL, '2026-06-17 22:44:35', NULL),
(16, 4, 3, '/api/v1/chuku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 3, '127.0.0.1', NULL, '2026-06-17 22:44:36', NULL),
(17, 4, 3, '/api/v1/chuku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 4137, '127.0.0.1', NULL, '2026-06-17 22:53:36', ''),
(18, 4, 3, '/api/v1/chuku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 3, '127.0.0.1', NULL, '2026-06-17 22:53:39', ''),
(19, 4, 3, '/api/v1/chuku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 3, '127.0.0.1', NULL, '2026-06-17 22:53:42', ''),
(20, 4, 3, '/api/v1/chuku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 4114, '127.0.0.1', NULL, '2026-06-17 22:56:02', ''),
(21, 4, 3, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 2, '127.0.0.1', NULL, '2026-06-17 22:56:19', ''),
(22, 4, 3, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 0, '127.0.0.1', NULL, '2026-06-17 22:56:23', ''),
(23, 4, 3, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 1, '127.0.0.1', NULL, '2026-06-17 22:56:24', ''),
(24, 4, 3, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 4100, '127.0.0.1', NULL, '2026-06-17 22:59:29', ''),
(25, 4, 3, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 3, '127.0.0.1', NULL, '2026-06-17 22:59:30', ''),
(26, 4, 3, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 1, '127.0.0.1', NULL, '2026-06-17 22:59:31', ''),
(27, 4, 3, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 4106, '127.0.0.1', NULL, '2026-06-17 23:06:00', '\nWITH PageData AS (\n    SELECT\n        ROW_NUMBER() OVER (ORDER BY [登记时间] DESC) AS RowID,\n        [种类]          AS type,\n        [票号]          AS ticket_no,\n        [登记时间]      AS register_time,\n        [供方序号]      AS supplier_code,\n        [供方全称]      AS supplier_name,\n        [采购员]        AS purchaser,\n        [负责人]        AS responsible_person,\n        [来货单号]      AS arrival_no,\n        [发票单号]      AS invoice_no,\n        [摘要]          AS summary,\n        [金额合计]      AS total_amount,\n        [操作员]        AS operator,\n        [存盘]          AS saved,\n        [存盘时间]      AS save_time,\n        [结帐]          AS settled,\n        [结帐人]        AS settler,\n        [结帐时间]      AS settle_time,\n        [编辑标识]      AS edit_flag,\n        [接收]          AS received,\n        [财务导出]      AS finance_exported,\n        [导出时间]      AS export_time,\n        [导出人]        AS exporter,\n        [标识]          AS flag,\n        [进行状态]      AS status,\n        [财务凭证号]    AS finance_voucher_no,\n        [wms接收]       AS wms_received,\n        [wms接收时间]   AS wms_receive_time\n    FROM [ywsj].[dbo].[brka]\n    WHERE 1=1\n     AND [登记时间] >= \'2026-06-01\' AND [登记时间] <= \'2026-06-30\'\n     AND [销方全称] = \'敖汉旗黄羊洼镇中心卫生院\'\n)\nSELECT\n    type, ticket_no, register_time, supplier_code, supplier_name,\n    purchaser, responsible_person, arrival_no, invoice_no, summary,\n    total_amount, operator, saved, save_time, settled, settler, settle_time,\n    edit_flag, received, finance_exported, export_time, exporter, flag,\n    status, finance_voucher_no, wms_received, wms_receive_time\nFROM PageData\nWHERE RowID BETWEEN (0 + 1) AND (0 + 100)\nORDER BY RowID\n'),
(28, 4, 3, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 3, '127.0.0.1', NULL, '2026-06-17 23:06:01', '\nWITH PageData AS (\n    SELECT\n        ROW_NUMBER() OVER (ORDER BY [登记时间] DESC) AS RowID,\n        [种类]          AS type,\n        [票号]          AS ticket_no,\n        [登记时间]      AS register_time,\n        [供方序号]      AS supplier_code,\n        [供方全称]      AS supplier_name,\n        [采购员]        AS purchaser,\n        [负责人]        AS responsible_person,\n        [来货单号]      AS arrival_no,\n        [发票单号]      AS invoice_no,\n        [摘要]          AS summary,\n        [金额合计]      AS total_amount,\n        [操作员]        AS operator,\n        [存盘]          AS saved,\n        [存盘时间]      AS save_time,\n        [结帐]          AS settled,\n        [结帐人]        AS settler,\n        [结帐时间]      AS settle_time,\n        [编辑标识]      AS edit_flag,\n        [接收]          AS received,\n        [财务导出]      AS finance_exported,\n        [导出时间]      AS export_time,\n        [导出人]        AS exporter,\n        [标识]          AS flag,\n        [进行状态]      AS status,\n        [财务凭证号]    AS finance_voucher_no,\n        [wms接收]       AS wms_received,\n        [wms接收时间]   AS wms_receive_time\n    FROM [ywsj].[dbo].[brka]\n    WHERE 1=1\n     AND [登记时间] >= \'2026-06-01\' AND [登记时间] <= \'2026-06-30\'\n     AND [销方全称] = \'敖汉旗黄羊洼镇中心卫生院\'\n)\nSELECT\n    type, ticket_no, register_time, supplier_code, supplier_name,\n    purchaser, responsible_person, arrival_no, invoice_no, summary,\n    total_amount, operator, saved, save_time, settled, settler, settle_time,\n    edit_flag, received, finance_exported, export_time, exporter, flag,\n    status, finance_voucher_no, wms_received, wms_receive_time\nFROM PageData\nWHERE RowID BETWEEN (0 + 1) AND (0 + 100)\nORDER BY RowID\n'),
(29, 9, 4, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 4127, '127.0.0.1', NULL, '2026-06-17 23:48:46', '\nWITH PageData AS (\n    SELECT\n        ROW_NUMBER() OVER (ORDER BY [登记时间] DESC) AS RowID,\n        [种类]          AS type,\n        [票号]          AS ticket_no,\n        [登记时间]      AS register_time,\n        [供方序号]      AS supplier_code,\n        [供方全称]      AS supplier_name,\n        [采购员]        AS purchaser,\n        [负责人]        AS responsible_person,\n        [来货单号]      AS arrival_no,\n        [发票单号]      AS invoice_no,\n        [摘要]          AS summary,\n        [金额合计]      AS total_amount,\n        [操作员]        AS operator,\n        [存盘]          AS saved,\n        [存盘时间]      AS save_time,\n        [结帐]          AS settled,\n        [结帐人]        AS settler,\n        [结帐时间]      AS settle_time,\n        [编辑标识]      AS edit_flag,\n        [接收]          AS received,\n        [财务导出]      AS finance_exported,\n        [导出时间]      AS export_time,\n        [导出人]        AS exporter,\n        [标识]          AS flag,\n        [进行状态]      AS status,\n        [财务凭证号]    AS finance_voucher_no,\n        [wms接收]       AS wms_received,\n        [wms接收时间]   AS wms_receive_time\n    FROM [ywsj].[dbo].[brka]\n    WHERE 1=1\n     AND [登记时间] >= \'2026-06-01\' AND [登记时间] <= \'2026-06-30\'\n     AND [供方全称] = \'xx医院\'\n)\nSELECT\n    type, ticket_no, register_time, supplier_code, supplier_name,\n    purchaser, responsible_person, arrival_no, invoice_no, summary,\n    total_amount, operator, saved, save_time, settled, settler, settle_time,\n    edit_flag, received, finance_exported, export_time, exporter, flag,\n    status, finance_voucher_no, wms_received, wms_receive_time\nFROM PageData\nWHERE RowID BETWEEN (0 + 1) AND (0 + 100)\nORDER BY RowID\n'),
(30, 9, 4, '/api/v1/ruku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 4117, '127.0.0.1', NULL, '2026-06-17 23:57:06', '\nWITH PageData AS (\n    SELECT\n        ROW_NUMBER() OVER (ORDER BY [登记时间] DESC) AS RowID,\n        [种类]          AS type,\n        [票号]          AS ticket_no,\n        [登记时间]      AS register_time,\n        [供方序号]      AS supplier_code,\n        [供方全称]      AS supplier_name,\n        [采购员]        AS purchaser,\n        [负责人]        AS responsible_person,\n        [来货单号]      AS arrival_no,\n        [发票单号]      AS invoice_no,\n        [摘要]          AS summary,\n        [金额合计]      AS total_amount,\n        [操作员]        AS operator,\n        [存盘]          AS saved,\n        [存盘时间]      AS save_time,\n        [结帐]          AS settled,\n        [结帐人]        AS settler,\n        [结帐时间]      AS settle_time,\n        [编辑标识]      AS edit_flag,\n        [接收]          AS received,\n        [财务导出]      AS finance_exported,\n        [导出时间]      AS export_time,\n        [导出人]        AS exporter,\n        [标识]          AS flag,\n        [进行状态]      AS status,\n        [财务凭证号]    AS finance_voucher_no,\n        [wms接收]       AS wms_received,\n        [wms接收时间]   AS wms_receive_time\n    FROM [ywsj].[dbo].[brka]\n    WHERE 1=1\n     AND [登记时间] >= \'2026-06-01\' AND [登记时间] <= \'2026-06-30\'\n     AND [销方序号] IN (\'12222\')\n)\nSELECT\n    type, ticket_no, register_time, supplier_code, supplier_name,\n    purchaser, responsible_person, arrival_no, invoice_no, summary,\n    total_amount, operator, saved, save_time, settled, settler, settle_time,\n    edit_flag, received, finance_exported, export_time, exporter, flag,\n    status, finance_voucher_no, wms_received, wms_receive_time\nFROM PageData\nWHERE RowID BETWEEN (0 + 1) AND (0 + 100)\nORDER BY RowID\n'),
(31, 9, 4, '/api/v1/chuku', '{\"page\": 1, \"limit\": 100, \"end_date\": \"2026-06-30\", \"start_date\": \"2026-06-01\"}', 200, '{\"count\": 1, \"total\": 1}', 1, 4117, '127.0.0.1', NULL, '2026-06-18 00:00:47', '\nWITH PageData AS (\n    SELECT\n        ROW_NUMBER() OVER (ORDER BY [登记时间] DESC) AS RowID,\n        [种类]          AS type,\n        [票号]          AS ticket_no,\n        [登记时间]      AS register_time,\n        [销方序号]      AS customer_code,\n        [会员序号]      AS member_code,\n        [销方全称]      AS customer_name,\n        [业务员]        AS salesman,\n        [发票种类]      AS invoice_type,\n        [约定时间]      AS appointment_time,\n        [提货人]        AS receiver,\n        [提货方式]      AS delivery_method,\n        [摘要]          AS summary,\n        [金额合计]      AS total_amount,\n        [毛利合计]      AS total_profit,\n        [折让合计]      AS total_discount,\n        [操作员]        AS operator,\n        [存盘]          AS saved,\n        [存盘时间]      AS save_time,\n        [审核]          AS audited,\n        [审核人]        AS auditor,\n        [审核票号]      AS audit_ticket_no,\n        [审核方式]      AS audit_method,\n        [审核时间]      AS audit_time,\n        [装车]          AS loaded,\n        [装车人]        AS loader,\n        [装车时间]      AS load_time,\n        [发车]          AS shipped,\n        [发车人]        AS shipper,\n        [发车时间]      AS ship_time,\n        [结帐]          AS settled,\n        [结帐人]        AS settler,\n        [结帐时间]      AS settle_time,\n        [编辑标识]      AS edit_flag,\n        [上传]          AS uploaded,\n        [加价]          AS price_added,\n        [加价人]        AS price_adder,\n        [加价时间]      AS price_add_time,\n        [库审]          AS warehouse_audited,\n        [库审人]        AS warehouse_auditor,\n        [库审时间]      AS warehouse_audit_time,\n        [备货员]        AS stock_preparer,\n        [财务导出]      AS finance_exported,\n        [导出时间]      AS export_time,\n        [导出人]        AS exporter,\n        [成本导出]      AS cost_exported,\n        [成本导出时间]  AS cost_export_time,\n        [成本导出人]    AS cost_exporter,\n        [标识]          AS flag,\n        [标号]          AS mark,\n        [返点]          AS rebate,\n        [客户地区]      AS customer_region,\n        [兑赠品]        AS gift,\n        [取票人]        AS ticket_collector,\n        [驻店药师]      AS pharmacist,\n        [销售凭据号]    AS sales_voucher_no,\n        [现金]          AS cash,\n        [市保]          AS city_insurance,\n        [省保]          AS province_insurance,\n        [铁保]          AS railway_insurance,\n        [银联]          AS unionpay,\n        [其它]          AS other_payment,\n        [找零]          AS change,\n        [折扣审核人]    AS discount_auditor,\n        [积分倍数]      AS points_multiplier,\n        [打印次数]      AS print_count,\n        [库房打印A]     AS warehouse_printed,\n        [打印人A]       AS printer,\n        [打印时间A]     AS print_time,\n        [GK]            AS gk,\n        [整箱]          AS whole_box,\n        [零箱]          AS partial_box,\n        [零袋]          AS partial_bag,\n        [特殊客户A]     AS special_customer,\n        [复核员]        AS reviewer,\n        [装箱员]        AS packer,\n        [数字签名]      AS digital_signature,\n        [兑赠品审核]    AS gift_audited,\n        [兑赠品审核人]  AS gift_auditor,\n        [兑赠品审核时间] AS gift_audit_time,\n        [当日流水号]    AS daily_serial_no,\n        [集中打印]      AS centralized_print,\n        [集中打印序号]  AS centralized_print_seq,\n        [集中打印流水号] AS centralized_print_serial,\n        [集中打印顺序号] AS centralized_print_order,\n        [整货打印]      AS whole_goods_print,\n        [整货打印人]    AS whole_goods_printer,\n        [整货打印时间]  AS whole_goods_print_time,\n        [整货打印2]     AS whole_goods_print2,\n        [整货打印人2]   AS whole_goods_printer2,\n        [整货打印时间2] AS whole_goods_print_time2,\n        [已收回执单]    AS receipt_collected,\n        [收回执单时间]  AS receipt_collect_time,\n        [收回执单人]    AS receipt_collector,\n        [处理]          AS processed,\n        [处理人]        AS processor,\n        [处理时间]      AS process_time,\n        [回执]          AS receipt,\n        [回执时间]      AS receipt_time,\n        [抵现]          AS cash_discount,\n        [购买人姓名]    AS buyer_name,\n        [购买人身份证号] AS buyer_id_card,\n        [附加信息1]     AS additional_info,\n        [送货人]        AS deliverer,\n        [备注]          AS remark,\n        [来电号码]      AS phone_number,\n        [经理审核]      AS manager_audited,\n        [经理]          AS manager,\n        [经理审核时间]  AS manager_audit_time,\n        [经理审核意见]  AS manager_audit_opinion,\n        [审方申请]      AS prescription_review_applied,\n        [审方]          AS prescription_reviewed,\n        [审方意见]      AS prescription_review_opinion,\n        [审方人]        AS prescription_reviewer,\n        [审方时间]      AS prescription_review_time,\n        [代金券]        AS voucher,\n        [收款折让]      AS payment_discount,\n        [证件类型]      AS id_type,\n        [双人复核]      AS double_reviewed,\n        [双人复核人]    AS double_reviewer,\n        [双人复核时间]  AS double_review_time,\n        [支付方式]      AS payment_method,\n        [入库发票图片打印] AS purchase_invoice_printed,\n        [入库发票图片打印人] AS purchase_invoice_printer,\n        [入库发票图片打印时间] AS purchase_invoice_print_time,\n        [本单积分]      AS points,\n        [th上传]        AS th_uploaded,\n        [th上传时间]    AS th_upload_time,\n        [th上传人]      AS th_uploader,\n        [澳德图片上传]  AS aode_image_uploaded,\n        [澳德图片上传人] AS aode_image_uploader,\n        [澳德图片上传时间] AS aode_image_upload_time,\n        [开发票A]       AS invoice_issued,\n        [发票号码A]     AS invoice_no,\n        [发票代码A]     AS invoice_code,\n        [发车序号]      AS ship_seq,\n        [运输序号]      AS transport_seq,\n        [财务凭证号]    AS finance_voucher_no,\n        [处方结果]      AS prescription_result,\n        [wms接收]       AS wms_received,\n        [wms接收时间]   AS wms_receive_time\n    FROM [ywsj].[dbo].[bcka]\n    WHERE 1=1\n     AND [登记时间] >= \'2026-06-01\' AND [登记时间] <= \'2026-06-30\'\n     AND [销方序号] IN (\'12222\')\n)\nSELECT\n    type, ticket_no, register_time, customer_code, member_code, customer_name,\n    salesman, invoice_type, appointment_time, receiver, delivery_method, summary,\n    total_amount, total_profit, total_discount, operator, saved, save_time,\n    audited, auditor, audit_ticket_no, audit_method, audit_time, loaded, loader,\n    load_time, shipped, shipper, ship_time, settled, settler, settle_time,\n    edit_flag, uploaded, price_added, price_adder, price_add_time,\n    warehouse_audited, warehouse_auditor, warehouse_audit_time, stock_preparer,\n    finance_exported, export_time, exporter, cost_exported, cost_export_time,\n    cost_exporter, flag, mark, rebate, customer_region, gift, ticket_collector,\n    pharmacist, sales_voucher_no, cash, city_insurance, province_insurance,\n    railway_insurance, unionpay, other_payment, change, discount_auditor,\n    points_multiplier, print_count, warehouse_printed, printer, print_time,\n    gk, whole_box, partial_box, partial_bag, special_customer, reviewer, packer,\n    digital_signature, gift_audited, gift_auditor, gift_audit_time,\n    daily_serial_no, centralized_print, centralized_print_seq,\n    centralized_print_serial, centralized_print_order, whole_goods_print,\n    whole_goods_printer, whole_goods_print_time, whole_goods_print2,\n    whole_goods_printer2, whole_goods_print_time2, receipt_collected,\n    receipt_collect_time, receipt_collector, processed, processor, process_time,\n    receipt, receipt_time, cash_discount, buyer_name, buyer_id_card,\n    additional_info, deliverer, remark, phone_number, manager_audited, manager,\n    manager_audit_time, manager_audit_opinion, prescription_review_applied,\n    prescription_reviewed, prescription_review_opinion, prescription_reviewer,\n    prescription_review_time, voucher, payment_discount, id_type,\n    double_reviewed, double_reviewer, double_review_time, payment_method,\n    purchase_invoice_printed, purchase_invoice_printer, purchase_invoice_print_time,\n    points, th_uploaded, th_upload_time, th_uploader, aode_image_uploaded,\n    aode_image_uploader, aode_image_upload_time, invoice_issued, invoice_no,\n    invoice_code, ship_seq, transport_seq, finance_voucher_no,\n    prescription_result, wms_received, wms_receive_time\nFROM PageData\nWHERE RowID BETWEEN (0 + 1) AND (0 + 100)\nORDER BY RowID\n');

-- --------------------------------------------------------

--
-- 表的结构 `clients`
--

CREATE TABLE `clients` (
  `id` bigint(20) NOT NULL,
  `client_no` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '客户序号',
  `name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户名称',
  `client_type` enum('supplier','distributor','hospital','other') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户类型: supplier/distributor/hospital/other',
  `contact_person` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '联系人',
  `phone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '手机号',
  `status` smallint(6) DEFAULT NULL COMMENT '1=启用 0=禁用',
  `remark` text COLLATE utf8mb4_unicode_ci COMMENT '备注',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- 转存表中的数据 `clients`
--

INSERT INTO `clients` (`id`, `client_no`, `name`, `client_type`, `contact_person`, `phone`, `status`, `remark`, `created_at`, `updated_at`) VALUES
(1, '936', '赤峰学院附属医院（新城院区）', 'distributor', '', '', 1, '', '2026-06-16 17:42:13', '2026-06-17 20:38:41'),
(2, '430', '颈复康药业集团赤峰丹龙药业有限公司', 'supplier', '', '', 1, '', '2026-06-16 17:42:13', '2026-06-17 20:38:13'),
(3, '833', '敖汉旗黄羊洼镇中心卫生院', 'distributor', NULL, NULL, 1, NULL, '2026-06-17 20:39:10', '2026-06-17 20:42:54'),
(4, '12222', 'xx医院', 'other', NULL, NULL, 1, NULL, '2026-06-17 21:29:37', '2026-06-17 21:29:37'),
(5, '3333', 'xx诊所', 'hospital', NULL, NULL, 1, NULL, '2026-06-17 21:29:51', '2026-06-17 21:29:51');

-- --------------------------------------------------------

--
-- 表的结构 `permissions`
--

CREATE TABLE `permissions` (
  `id` bigint(20) NOT NULL,
  `api_key_id` bigint(20) NOT NULL,
  `allow_chuku` smallint(6) DEFAULT NULL COMMENT '是否允许出库接口 1=允许 0=禁止',
  `allow_ruku` smallint(6) DEFAULT NULL COMMENT '是否允许入库接口 1=允许 0=禁止',
  `allow_full_data` smallint(6) DEFAULT NULL COMMENT '是否允许全量数据 1=允许 0=过滤',
  `filter_field` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '过滤字段: 销方全称/供方全称/ 销方序号/供方序号',
  `filter_values` json DEFAULT NULL COMMENT '过滤值 JSON 数组',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `data_mode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT 'filter' COMMENT '数据过滤模式: filter=按接口权限过滤, custom=自定义过滤规则, full=全量数据'
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- 转存表中的数据 `permissions`
--

INSERT INTO `permissions` (`id`, `api_key_id`, `allow_chuku`, `allow_ruku`, `allow_full_data`, `filter_field`, `filter_values`, `created_at`, `updated_at`, `data_mode`) VALUES
(1, 1, 1, 0, 0, '销方全称', '[\"喀喇沁旗中医蒙医医院\"]', '2026-06-16 17:42:13', '2026-06-16 17:42:13', 'filter'),
(2, 2, 0, 1, 0, '供方全称', '[\"通化华夏药业有限责任公司\"]', '2026-06-16 17:42:13', '2026-06-17 23:54:58', 'custom'),
(4, 4, 1, 0, 1, NULL, 'null', '2026-06-17 20:40:21', '2026-06-17 23:51:01', 'filter'),
(7, 7, 0, 0, 0, NULL, NULL, '2026-06-17 21:16:29', '2026-06-17 21:16:29', 'filter'),
(8, 8, 1, 1, 0, '销方序号', '[\"3333\"]', '2026-06-17 21:30:13', '2026-06-17 23:56:00', 'custom'),
(9, 9, 1, 0, 0, '销方序号', '[\"12222\"]', '2026-06-17 21:30:16', '2026-06-17 23:58:20', 'custom');

--
-- 转储表的索引
--

--
-- 表的索引 `admin_users`
--
ALTER TABLE `admin_users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`);

--
-- 表的索引 `api_keys`
--
ALTER TABLE `api_keys`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `api_key` (`api_key`),
  ADD KEY `client_id` (`client_id`);

--
-- 表的索引 `api_logs`
--
ALTER TABLE `api_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_client_id` (`client_id`),
  ADD KEY `idx_api_key_id` (`api_key_id`),
  ADD KEY `idx_created_at` (`created_at`);

--
-- 表的索引 `clients`
--
ALTER TABLE `clients`
  ADD PRIMARY KEY (`id`);

--
-- 表的索引 `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `api_key_id` (`api_key_id`);

--
-- 在导出的表使用AUTO_INCREMENT
--

--
-- 使用表AUTO_INCREMENT `admin_users`
--
ALTER TABLE `admin_users`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- 使用表AUTO_INCREMENT `api_keys`
--
ALTER TABLE `api_keys`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- 使用表AUTO_INCREMENT `api_logs`
--
ALTER TABLE `api_logs`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;

--
-- 使用表AUTO_INCREMENT `clients`
--
ALTER TABLE `clients`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- 使用表AUTO_INCREMENT `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
