- Implemented Outdoor Fair Attendee and Device entities, including their respective controllers, services, and mappers. - Added statistics endpoint for Outdoor Fair data, allowing aggregation by day, week, month, or year. - Introduced SQL scripts for creating tables and mock data for attendees and devices. - Created a write-capable script for executing DML/DDL statements against the SHZ HighGo database. - Enhanced the existing query capabilities to support both read and write operations.
43 lines
2.2 KiB
SQL
43 lines
2.2 KiB
SQL
-- 户外招聘会设备码表
|
||
-- 依赖:shz.cms_outdoor_fair(fair_id 外键逻辑关联,不建物理外键)
|
||
|
||
CREATE SEQUENCE IF NOT EXISTS shz.cms_outdoor_fair_device_id_seq
|
||
START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
|
||
|
||
CREATE TABLE IF NOT EXISTS shz.cms_outdoor_fair_device (
|
||
id BIGINT NOT NULL DEFAULT nextval('shz.cms_outdoor_fair_device_id_seq'::regclass) PRIMARY KEY,
|
||
fair_id BIGINT NOT NULL,
|
||
device_code VARCHAR(64) NOT NULL,
|
||
company_id BIGINT,
|
||
company_name VARCHAR(255),
|
||
bind_time TIMESTAMP,
|
||
create_by VARCHAR(64),
|
||
create_time TIMESTAMP,
|
||
update_by VARCHAR(64),
|
||
update_time TIMESTAMP,
|
||
remark VARCHAR(500),
|
||
del_flag CHAR(1) DEFAULT '0'
|
||
);
|
||
|
||
CREATE INDEX IF NOT EXISTS idx_cms_outdoor_fair_device_fair
|
||
ON shz.cms_outdoor_fair_device (fair_id);
|
||
|
||
COMMENT ON TABLE shz.cms_outdoor_fair_device IS '户外招聘会设备码表';
|
||
COMMENT ON COLUMN shz.cms_outdoor_fair_device.id IS '主键';
|
||
COMMENT ON COLUMN shz.cms_outdoor_fair_device.fair_id IS '招聘会ID';
|
||
COMMENT ON COLUMN shz.cms_outdoor_fair_device.device_code IS '设备码(UUID)';
|
||
COMMENT ON COLUMN shz.cms_outdoor_fair_device.company_id IS '绑定的参会企业ID';
|
||
COMMENT ON COLUMN shz.cms_outdoor_fair_device.company_name IS '绑定的参会企业名称';
|
||
COMMENT ON COLUMN shz.cms_outdoor_fair_device.bind_time IS '绑定时间';
|
||
COMMENT ON COLUMN shz.cms_outdoor_fair_device.del_flag IS '删除标志(0存在 2删除)';
|
||
|
||
-- mock 数据:为 id=8 的招聘会生成 5 个设备码,其中 2 个绑定参会企业
|
||
INSERT INTO shz.cms_outdoor_fair_device
|
||
(fair_id, device_code, company_id, company_name, bind_time, create_by, create_time, del_flag)
|
||
VALUES
|
||
(8, 'a1b2c3d4e5f6471a9b8c1d2e3f4a5b6c', null, null, null, 'admin', now(), '0'),
|
||
(8, 'b2c3d4e5f6a7482bac9d0e1f2a3b4c5d', null, null, null, 'admin', now(), '0'),
|
||
(8, 'c3d4e5f6a7b8493cbd0e1f2a3b4c5d6e', 101, '示例科技有限公司', '2026-06-25 10:00:00', 'admin', now(), '0'),
|
||
(8, 'd4e5f6a7b8c9404dce1f2a3b4c5d6e7f', 102, '示范商贸有限公司', '2026-06-25 10:05:00', 'admin', now(), '0'),
|
||
(8, 'e5f6a7b8c9d0415edf2a3b4c5d6e7f8a', null, null, null, 'admin', now(), '0');
|