/*
 Navicat Premium Data Transfer

 Source Server         : sw-system
 Source Server Type    : PostgreSQL
 Source Server Version : 90204 (90204)
 Source Host           : 192.168.10.130:5432
 Source Catalog        : sw_system
 Source Schema         : public

 Target Server Type    : PostgreSQL
 Target Server Version : 90204 (90204)
 File Encoding         : 65001

 Date: 15/07/2025 15:17:19
*/


-- ----------------------------
-- Table structure for biz_community
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_community";
CREATE TABLE "public"."biz_community" (
  "id" int8 NOT NULL DEFAULT nextval('biz_community_seq'::regclass),
  "name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "address" varchar(500) COLLATE "pg_catalog"."default",
  "contact_number" varchar(100) COLLATE "pg_catalog"."default",
  "dept_code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "parent_id" int8,
  "ancestor_list" varchar(1000) COLLATE "pg_catalog"."default",
  "sort" int4 NOT NULL DEFAULT 0,
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_community" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_community"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_community"."name" IS '小区名称';
COMMENT ON COLUMN "public"."biz_community"."code" IS '小区代码';
COMMENT ON COLUMN "public"."biz_community"."address" IS '小区地址';
COMMENT ON COLUMN "public"."biz_community"."contact_number" IS '联系号码';
COMMENT ON COLUMN "public"."biz_community"."dept_code" IS '部门代码，关联系统部门表';
COMMENT ON COLUMN "public"."biz_community"."parent_id" IS '父级小区id，支持小区层级管理';
COMMENT ON COLUMN "public"."biz_community"."ancestor_list" IS '祖级列表，格式：1,2,3表示祖级小区id列表';
COMMENT ON COLUMN "public"."biz_community"."sort" IS '排序';
COMMENT ON COLUMN "public"."biz_community"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_community"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_community"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_community"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_community"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_community"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_community"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_community"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_community" IS '所属小区表';

-- ----------------------------
-- Table structure for biz_company_account
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_company_account";
CREATE TABLE "public"."biz_company_account" (
  "id" int8 NOT NULL DEFAULT nextval('biz_company_account_seq'::regclass),
  "account_name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "account_address" varchar(500) COLLATE "pg_catalog"."default",
  "bank_name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "bank_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "bank_account" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_company_account" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_company_account"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_company_account"."account_name" IS '账户名称';
COMMENT ON COLUMN "public"."biz_company_account"."account_address" IS '账户地址';
COMMENT ON COLUMN "public"."biz_company_account"."bank_name" IS '开户行名称';
COMMENT ON COLUMN "public"."biz_company_account"."bank_code" IS '开户行代码';
COMMENT ON COLUMN "public"."biz_company_account"."bank_account" IS '开户行账户';
COMMENT ON COLUMN "public"."biz_company_account"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_company_account"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_company_account"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_company_account"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_company_account"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_company_account"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_company_account"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_company_account"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_company_account" IS '水司账户表';

-- ----------------------------
-- Table structure for biz_cost_component
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_cost_component";
CREATE TABLE "public"."biz_cost_component" (
  "id" int8 NOT NULL DEFAULT nextval('biz_cost_component_seq'::regclass),
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "penalty_coefficient" numeric(10,4),
  "zero_usage_calculation" int2 NOT NULL DEFAULT 0,
  "sort" int4 NOT NULL DEFAULT 0,
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_cost_component" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_cost_component"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_cost_component"."name" IS '费用名称';
COMMENT ON COLUMN "public"."biz_cost_component"."code" IS '费用代码';
COMMENT ON COLUMN "public"."biz_cost_component"."penalty_coefficient" IS '违约金系数，违约金计算系数，默认为0表示不收取违约金';
COMMENT ON COLUMN "public"."biz_cost_component"."zero_usage_calculation" IS '零用量是否计算，0-不计算，1-计算';
COMMENT ON COLUMN "public"."biz_cost_component"."sort" IS '排序';
COMMENT ON COLUMN "public"."biz_cost_component"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_cost_component"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_cost_component"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_cost_component"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_cost_component"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_cost_component"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_cost_component"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_cost_component"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_cost_component" IS '费用组成表';

-- ----------------------------
-- Table structure for biz_dept_account_rel
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_dept_account_rel";
CREATE TABLE "public"."biz_dept_account_rel" (
  "id" int8 NOT NULL DEFAULT nextval('biz_dept_account_rel_seq'::regclass),
  "dept_code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "account_id" int8 NOT NULL,
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_dept_account_rel" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_dept_account_rel"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_dept_account_rel"."dept_code" IS '部门代码，关联系统部门表';
COMMENT ON COLUMN "public"."biz_dept_account_rel"."account_id" IS '水司账户id，关联水司账户表';
COMMENT ON COLUMN "public"."biz_dept_account_rel"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_dept_account_rel"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_dept_account_rel"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_dept_account_rel"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_dept_account_rel"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_dept_account_rel"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_dept_account_rel"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_dept_account_rel"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_dept_account_rel" IS '部门和水司账户关系表';

-- ----------------------------
-- Table structure for biz_meter_caliber
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_meter_caliber";
CREATE TABLE "public"."biz_meter_caliber" (
  "id" int8 NOT NULL DEFAULT nextval('biz_meter_caliber_seq'::regclass),
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "value" numeric(10,2),
  "check_period" int4,
  "replace_period" int4,
  "high_coefficient" numeric(10,4),
  "low_coefficient" numeric(10,4),
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_meter_caliber" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_meter_caliber"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_meter_caliber"."name" IS '口径名称';
COMMENT ON COLUMN "public"."biz_meter_caliber"."value" IS '口径值（单位：毫米）';
COMMENT ON COLUMN "public"."biz_meter_caliber"."check_period" IS '强检周期（单位：年）';
COMMENT ON COLUMN "public"."biz_meter_caliber"."replace_period" IS '定换周期（单位：年）';
COMMENT ON COLUMN "public"."biz_meter_caliber"."high_coefficient" IS '量高系数，抄表量高提醒系数';
COMMENT ON COLUMN "public"."biz_meter_caliber"."low_coefficient" IS '量低系数，抄表量低提醒系数';
COMMENT ON COLUMN "public"."biz_meter_caliber"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_meter_caliber"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_meter_caliber"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_meter_caliber"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_meter_caliber"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_meter_caliber"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_meter_caliber"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_meter_caliber"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_meter_caliber" IS '水表口径表';

-- ----------------------------
-- Table structure for biz_meter_maker
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_meter_maker";
CREATE TABLE "public"."biz_meter_maker" (
  "id" int8 NOT NULL DEFAULT nextval('biz_meter_maker_seq'::regclass),
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "recharge_type" varchar(10) COLLATE "pg_catalog"."default",
  "address" varchar(500) COLLATE "pg_catalog"."default",
  "contact" varchar(100) COLLATE "pg_catalog"."default",
  "contact_number" varchar(100) COLLATE "pg_catalog"."default",
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_meter_maker" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_meter_maker"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_meter_maker"."name" IS '厂家名称';
COMMENT ON COLUMN "public"."biz_meter_maker"."code" IS '厂家代码';
COMMENT ON COLUMN "public"."biz_meter_maker"."recharge_type" IS '充值类型';
COMMENT ON COLUMN "public"."biz_meter_maker"."address" IS '地址';
COMMENT ON COLUMN "public"."biz_meter_maker"."contact" IS '联系人';
COMMENT ON COLUMN "public"."biz_meter_maker"."contact_number" IS '联系号码';
COMMENT ON COLUMN "public"."biz_meter_maker"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_meter_maker"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_meter_maker"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_meter_maker"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_meter_maker"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_meter_maker"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_meter_maker"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_meter_maker"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_meter_maker" IS '水表厂家表';

-- ----------------------------
-- Table structure for biz_meter_model
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_meter_model";
CREATE TABLE "public"."biz_meter_model" (
  "id" int8 NOT NULL DEFAULT nextval('biz_meter_model_seq'::regclass),
  "maker_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "caliber_range" varchar(200) COLLATE "pg_catalog"."default",
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_meter_model" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_meter_model"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_meter_model"."maker_code" IS '厂家代码，关联水表厂家表';
COMMENT ON COLUMN "public"."biz_meter_model"."name" IS '型号名称';
COMMENT ON COLUMN "public"."biz_meter_model"."code" IS '型号代码';
COMMENT ON COLUMN "public"."biz_meter_model"."caliber_range" IS '口径范围，如：DN15-DN200';
COMMENT ON COLUMN "public"."biz_meter_model"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_meter_model"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_meter_model"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_meter_model"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_meter_model"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_meter_model"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_meter_model"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_meter_model"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_meter_model" IS '水表型号表';

-- ----------------------------
-- Table structure for biz_meter_range
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_meter_range";
CREATE TABLE "public"."biz_meter_range" (
  "id" int8 NOT NULL DEFAULT nextval('biz_meter_range_seq'::regclass),
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "value" numeric(15,3),
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_meter_range" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_meter_range"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_meter_range"."name" IS '量程名称';
COMMENT ON COLUMN "public"."biz_meter_range"."code" IS '量程代码';
COMMENT ON COLUMN "public"."biz_meter_range"."value" IS '量程值（单位：立方米）';
COMMENT ON COLUMN "public"."biz_meter_range"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_meter_range"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_meter_range"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_meter_range"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_meter_range"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_meter_range"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_meter_range"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_meter_range"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_meter_range" IS '水表量程表';

-- ----------------------------
-- Table structure for biz_price_adjustment_history
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_price_adjustment_history";
CREATE TABLE "public"."biz_price_adjustment_history" (
  "id" int8 NOT NULL DEFAULT nextval('biz_price_adjustment_history_seq'::regclass),
  "template_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "adjustment_name" varchar(200) COLLATE "pg_catalog"."default",
  "effective_date" timestamp(0) NOT NULL,
  "expiry_date" timestamp(0),
  "adjustment_reason" varchar(500) COLLATE "pg_catalog"."default",
  "adjuster" varchar(100) COLLATE "pg_catalog"."default",
  "adjustment_time" timestamp(6),
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_price_adjustment_history" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."template_code" IS '模版代码，关联水价调整模版表';
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."adjustment_name" IS '调价名称，如：2024年居民用水调价方案';
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."effective_date" IS '生效日期';
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."expiry_date" IS '失效日期，为空表示长期有效';
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."adjustment_reason" IS '调价原因';
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."adjuster" IS '调价人';
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."adjustment_time" IS '调价时间';
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_price_adjustment_history"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_price_adjustment_history" IS '水价调整记录表';

-- ----------------------------
-- Table structure for biz_price_category
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_price_category";
CREATE TABLE "public"."biz_price_category" (
  "id" int8 NOT NULL DEFAULT nextval('biz_price_category_seq'::regclass),
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "parent_id" int8,
  "ancestor_list" varchar(1000) COLLATE "pg_catalog"."default",
  "sort" int4 NOT NULL DEFAULT 0,
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_price_category" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_price_category"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_price_category"."name" IS '归属名称';
COMMENT ON COLUMN "public"."biz_price_category"."code" IS '归属代码';
COMMENT ON COLUMN "public"."biz_price_category"."parent_id" IS '父级归属id，支持水价归属层级管理';
COMMENT ON COLUMN "public"."biz_price_category"."ancestor_list" IS '祖级列表，格式：1,2,3表示祖级归属id列表';
COMMENT ON COLUMN "public"."biz_price_category"."sort" IS '排序';
COMMENT ON COLUMN "public"."biz_price_category"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_price_category"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_price_category"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_price_category"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_price_category"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_price_category"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_price_category"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_price_category"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_price_category" IS '水价归属表';

-- ----------------------------
-- Table structure for biz_price_cost_adjustment
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_price_cost_adjustment";
CREATE TABLE "public"."biz_price_cost_adjustment" (
  "id" int8 NOT NULL DEFAULT nextval('biz_price_cost_adjustment_seq'::regclass),
  "template_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "cost_component_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "calculation_mode" int4 NOT NULL DEFAULT 1,
  "is_tiered" int2 NOT NULL DEFAULT 0,
  "tiered_mode" int4 NOT NULL DEFAULT 0,
  "tier_level" int4 NOT NULL DEFAULT 0,
  "volume_coefficient" numeric(10,4) NOT NULL DEFAULT 1,
  "charge_penalty" int2 NOT NULL DEFAULT 1,
  "sort" int4 NOT NULL DEFAULT 0,
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_price_cost_adjustment" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."template_code" IS '模版代码，关联水价调整模版表';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."cost_component_code" IS '费用组成代码，关联费用组成表';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."calculation_mode" IS '计算类型：1-按水量计算，2-按人口数计算，3-固定金额，4-按户数计算';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."is_tiered" IS '是否阶梯，0-非阶梯，1-阶梯';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."tiered_mode" IS '阶梯类型：0-无阶梯，1-年度阶梯，2-月度阶梯，3-季度阶梯';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."tier_level" IS '阶梯级别，第几阶梯，如1、2、3等';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."volume_coefficient" IS '水量系数，用于特殊计算场景';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."charge_penalty" IS '是否收取违约金，0-不收取，1-收取';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."sort" IS '排序';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_price_cost_adjustment" IS '水价费用调整表';

-- ----------------------------
-- Table structure for biz_price_cost_adjustment_history
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_price_cost_adjustment_history";
CREATE TABLE "public"."biz_price_cost_adjustment_history" (
  "id" int8 NOT NULL DEFAULT nextval('biz_price_cost_adjustment_history_seq'::regclass),
  "history_id" int8 NOT NULL,
  "price_category_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "cost_component_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "calculation_mode" int4 NOT NULL DEFAULT 1,
  "is_tiered" int2 NOT NULL DEFAULT 0,
  "tiered_mode" int4 NOT NULL DEFAULT 0,
  "tier_level" int4 NOT NULL DEFAULT 0,
  "volume_coefficient" numeric(10,4) NOT NULL DEFAULT 1,
  "charge_penalty" int2 NOT NULL DEFAULT 1,
  "sort" int4 NOT NULL DEFAULT 0,
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_price_cost_adjustment_history" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."history_id" IS '水价调整记录id，关联水价调整记录表';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."price_category_code" IS '水价归属代码，关联水价归属表';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."cost_component_code" IS '费用组成代码，关联费用组成表';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."calculation_mode" IS '计算类型：1-按水量计算，2-按人口数计算，3-固定金额，4-按户数计算';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."is_tiered" IS '是否阶梯，0-非阶梯，1-阶梯';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."tiered_mode" IS '阶梯类型：0-无阶梯，1-年度阶梯，2-月度阶梯，3-季度阶梯';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."tier_level" IS '阶梯级别，第几阶梯，如1、2、3等';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."volume_coefficient" IS '水量系数，用于特殊计算场景';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."charge_penalty" IS '是否收取违约金，0-不收取，1-收取';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."sort" IS '排序';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_price_cost_adjustment_history"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_price_cost_adjustment_history" IS '水价费用调整历史表';

-- ----------------------------
-- Table structure for biz_price_dept_rel
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_price_dept_rel";
CREATE TABLE "public"."biz_price_dept_rel" (
  "id" int8 NOT NULL DEFAULT nextval('biz_price_dept_rel_seq'::regclass),
  "dept_code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "price_category_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "is_default" int2 NOT NULL DEFAULT 0,
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_price_dept_rel" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_price_dept_rel"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_price_dept_rel"."dept_code" IS '部门代码，关联系统部门表';
COMMENT ON COLUMN "public"."biz_price_dept_rel"."price_category_code" IS '水价归属代码，关联水价归属表';
COMMENT ON COLUMN "public"."biz_price_dept_rel"."is_default" IS '是否默认，该部门是否默认使用此水价归属';
COMMENT ON COLUMN "public"."biz_price_dept_rel"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_price_dept_rel"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_price_dept_rel"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_price_dept_rel"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_price_dept_rel"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_price_dept_rel"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_price_dept_rel"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_price_dept_rel"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_price_dept_rel" IS '水价归属和部门关系表';

-- ----------------------------
-- Table structure for biz_price_discount_cost
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_price_discount_cost";
CREATE TABLE "public"."biz_price_discount_cost" (
  "id" int8 NOT NULL DEFAULT nextval('biz_price_discount_cost_seq'::regclass),
  "tier_id" int8 NOT NULL,
  "cost_component_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "discount_price" numeric(10,4) NOT NULL,
  "sort" int4 NOT NULL DEFAULT 0,
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_price_discount_cost" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_price_discount_cost"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_price_discount_cost"."tier_id" IS '优惠阶梯id，关联水价优惠阶梯表';
COMMENT ON COLUMN "public"."biz_price_discount_cost"."cost_component_code" IS '费用组成代码，关联费用组成表';
COMMENT ON COLUMN "public"."biz_price_discount_cost"."discount_price" IS '优惠价格（单位：元/立方米或元（固定费用））';
COMMENT ON COLUMN "public"."biz_price_discount_cost"."sort" IS '排序';
COMMENT ON COLUMN "public"."biz_price_discount_cost"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_price_discount_cost"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_price_discount_cost"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_price_discount_cost"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_price_discount_cost"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_price_discount_cost"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_price_discount_cost"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_price_discount_cost"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_price_discount_cost" IS '水价优惠费用表';

-- ----------------------------
-- Table structure for biz_price_discount_scheme
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_price_discount_scheme";
CREATE TABLE "public"."biz_price_discount_scheme" (
  "id" int8 NOT NULL DEFAULT nextval('biz_price_discount_scheme_seq'::regclass),
  "scheme_name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "scheme_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "price_category_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "discount_type" int4 NOT NULL,
  "effective_date" timestamp(0) NOT NULL,
  "expiry_date" timestamp(0),
  "scheme_description" varchar(1000) COLLATE "pg_catalog"."default",
  "sort" int4 NOT NULL DEFAULT 0,
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_price_discount_scheme" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."scheme_name" IS '方案名称，如：居民用户优惠方案2024';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."scheme_code" IS '方案代码';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."price_category_code" IS '水价归属代码，关联水价归属表';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."discount_type" IS '优惠方式：1-按次优惠，2-按月优惠，3-按季优惠，4-按年优惠，5-无限期定量优惠';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."effective_date" IS '生效日期';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."expiry_date" IS '失效日期，为空表示长期有效';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."scheme_description" IS '方案描述';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."sort" IS '排序';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_price_discount_scheme"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_price_discount_scheme" IS '水价优惠方案表';

-- ----------------------------
-- Table structure for biz_price_discount_tier
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_price_discount_tier";
CREATE TABLE "public"."biz_price_discount_tier" (
  "id" int8 NOT NULL DEFAULT nextval('biz_price_discount_tier_seq'::regclass),
  "scheme_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "tier_level" int4 NOT NULL DEFAULT 0,
  "start_volume" numeric(15,3),
  "end_volume" numeric(15,3),
  "include_in_tier" int2 NOT NULL DEFAULT 1,
  "sort" int4 NOT NULL DEFAULT 0,
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_price_discount_tier" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_price_discount_tier"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_price_discount_tier"."scheme_code" IS '优惠方案代码，关联水价优惠方案表';
COMMENT ON COLUMN "public"."biz_price_discount_tier"."tier_level" IS '阶梯级别，第几阶梯，如1、2、3等';
COMMENT ON COLUMN "public"."biz_price_discount_tier"."start_volume" IS '开始水量（单位：立方米）';
COMMENT ON COLUMN "public"."biz_price_discount_tier"."end_volume" IS '结束水量（单位：立方米），为空表示无上限';
COMMENT ON COLUMN "public"."biz_price_discount_tier"."include_in_tier" IS '是否计入阶梯，0-不计入阶梯，1-计入阶梯';
COMMENT ON COLUMN "public"."biz_price_discount_tier"."sort" IS '排序';
COMMENT ON COLUMN "public"."biz_price_discount_tier"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_price_discount_tier"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_price_discount_tier"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_price_discount_tier"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_price_discount_tier"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_price_discount_tier"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_price_discount_tier"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_price_discount_tier"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_price_discount_tier" IS '水价优惠阶梯表';

-- ----------------------------
-- Table structure for biz_price_tier_adjustment
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_price_tier_adjustment";
CREATE TABLE "public"."biz_price_tier_adjustment" (
  "id" int8 NOT NULL DEFAULT nextval('biz_price_tier_adjustment_seq'::regclass),
  "cost_adjustment_id" int8 NOT NULL,
  "cost_component_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "tier_level" int4 NOT NULL DEFAULT 0,
  "start_volume" numeric(15,3),
  "end_volume" numeric(15,3),
  "price" numeric(10,4) NOT NULL,
  "volume_coefficient" numeric(10,4) NOT NULL DEFAULT 1,
  "sort" int4 NOT NULL DEFAULT 0,
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_price_tier_adjustment" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."cost_adjustment_id" IS '水价费用调整id，关联水价费用调整表';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."cost_component_code" IS '费用组成代码，关联费用组成表';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."tier_level" IS '阶梯级别，第几阶梯，如1、2、3等';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."start_volume" IS '开始水量（单位：立方米）';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."end_volume" IS '结束水量（单位：立方米），为空表示无上限';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."price" IS '价格（单位：元/立方米或元（固定费用））';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."volume_coefficient" IS '水量系数，用于特殊计算场景';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."sort" IS '排序';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_price_tier_adjustment" IS '水价阶梯调整表';

-- ----------------------------
-- Table structure for biz_price_tier_adjustment_history
-- ----------------------------
DROP TABLE IF EXISTS "public"."biz_price_tier_adjustment_history";
CREATE TABLE "public"."biz_price_tier_adjustment_history" (
  "id" int8 NOT NULL DEFAULT nextval('biz_price_tier_adjustment_history_seq'::regclass),
  "cost_adjustment_history_id" int8 NOT NULL,
  "cost_component_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "tier_level" int4 NOT NULL DEFAULT 0,
  "start_volume" numeric(15,3),
  "end_volume" numeric(15,3),
  "price" numeric(10,4) NOT NULL,
  "volume_coefficient" numeric(10,4) NOT NULL DEFAULT 1,
  "sort" int4 NOT NULL DEFAULT 0,
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL DEFAULT 0,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "creator" varchar(100) COLLATE "pg_catalog"."default",
  "updater" varchar(100) COLLATE "pg_catalog"."default",
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."biz_price_tier_adjustment_history" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."id" IS '主键';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."cost_adjustment_history_id" IS '水价费用调整历史id，关联水价费用调整历史表';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."cost_component_code" IS '费用组成代码，关联费用组成表';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."tier_level" IS '阶梯级别，第几阶梯，如1、2、3等';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."start_volume" IS '开始水量（单位：立方米）';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."end_volume" IS '结束水量（单位：立方米），为空表示无上限';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."price" IS '价格（单位：元/立方米或元（固定费用））';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."volume_coefficient" IS '水量系数，用于特殊计算场景';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."sort" IS '排序';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."remark" IS '备注';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."status" IS '状态：0-否，1-是';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."creator" IS '创建人id';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."updater" IS '更新人id';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."biz_price_tier_adjustment_history"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."biz_price_tier_adjustment_history" IS '水价阶梯调整历史表';

-- ----------------------------
-- Indexes structure for table biz_community
-- ----------------------------
CREATE INDEX "idx_biz_community_code" ON "public"."biz_community" USING btree (
  "code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_community_dept_code" ON "public"."biz_community" USING btree (
  "dept_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_community_parent_id" ON "public"."biz_community" USING btree (
  "parent_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_community_tenant" ON "public"."biz_community" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_company_account
-- ----------------------------
CREATE INDEX "idx_biz_company_account_tenant" ON "public"."biz_company_account" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_cost_component
-- ----------------------------
CREATE INDEX "idx_biz_cost_component_code" ON "public"."biz_cost_component" USING btree (
  "code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_cost_component_tenant" ON "public"."biz_cost_component" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_dept_account_rel
-- ----------------------------
CREATE INDEX "idx_biz_dept_account_rel_account_id" ON "public"."biz_dept_account_rel" USING btree (
  "account_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_dept_account_rel_dept_code" ON "public"."biz_dept_account_rel" USING btree (
  "dept_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_dept_account_rel_tenant" ON "public"."biz_dept_account_rel" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_meter_caliber
-- ----------------------------
CREATE INDEX "idx_biz_meter_caliber_tenant" ON "public"."biz_meter_caliber" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_meter_maker
-- ----------------------------
CREATE INDEX "idx_biz_meter_maker_code" ON "public"."biz_meter_maker" USING btree (
  "code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_meter_maker_tenant" ON "public"."biz_meter_maker" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_meter_model
-- ----------------------------
CREATE INDEX "idx_biz_meter_model_code" ON "public"."biz_meter_model" USING btree (
  "code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_meter_model_maker_code" ON "public"."biz_meter_model" USING btree (
  "maker_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_meter_model_tenant" ON "public"."biz_meter_model" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_meter_range
-- ----------------------------
CREATE INDEX "idx_biz_meter_range_code" ON "public"."biz_meter_range" USING btree (
  "code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_meter_range_tenant" ON "public"."biz_meter_range" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_price_adjustment_history
-- ----------------------------
CREATE INDEX "idx_biz_price_adj_history_category_code" ON "public"."biz_price_adjustment_history" USING btree (
  "template_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_adj_history_effective_date" ON "public"."biz_price_adjustment_history" USING btree (
  "effective_date" "pg_catalog"."timestamp_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_adj_history_tenant" ON "public"."biz_price_adjustment_history" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_price_category
-- ----------------------------
CREATE INDEX "idx_biz_price_category_code" ON "public"."biz_price_category" USING btree (
  "code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_category_parent_id" ON "public"."biz_price_category" USING btree (
  "parent_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_category_tenant" ON "public"."biz_price_category" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_price_cost_adjustment
-- ----------------------------
CREATE INDEX "idx_biz_price_cost_adj_category_code" ON "public"."biz_price_cost_adjustment" USING btree (
  "template_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_cost_adj_component_code" ON "public"."biz_price_cost_adjustment" USING btree (
  "cost_component_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_cost_adj_tenant" ON "public"."biz_price_cost_adjustment" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_price_cost_adjustment_history
-- ----------------------------
CREATE INDEX "idx_biz_price_cost_adj_hist_category_code" ON "public"."biz_price_cost_adjustment_history" USING btree (
  "price_category_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_cost_adj_hist_component_code" ON "public"."biz_price_cost_adjustment_history" USING btree (
  "cost_component_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_cost_adj_hist_history_id" ON "public"."biz_price_cost_adjustment_history" USING btree (
  "history_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_cost_adj_hist_tenant" ON "public"."biz_price_cost_adjustment_history" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_price_dept_rel
-- ----------------------------
CREATE INDEX "idx_biz_price_dept_rel_category_code" ON "public"."biz_price_dept_rel" USING btree (
  "price_category_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_dept_rel_dept_code" ON "public"."biz_price_dept_rel" USING btree (
  "dept_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_dept_rel_tenant" ON "public"."biz_price_dept_rel" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_price_discount_cost
-- ----------------------------
CREATE INDEX "idx_biz_price_discount_cost_component_code" ON "public"."biz_price_discount_cost" USING btree (
  "cost_component_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_discount_cost_tenant" ON "public"."biz_price_discount_cost" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_discount_cost_tier_id" ON "public"."biz_price_discount_cost" USING btree (
  "tier_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_price_discount_scheme
-- ----------------------------
CREATE INDEX "idx_biz_price_discount_scheme_category_code" ON "public"."biz_price_discount_scheme" USING btree (
  "price_category_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_discount_scheme_code" ON "public"."biz_price_discount_scheme" USING btree (
  "scheme_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_discount_scheme_effective_date" ON "public"."biz_price_discount_scheme" USING btree (
  "effective_date" "pg_catalog"."timestamp_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_discount_scheme_tenant" ON "public"."biz_price_discount_scheme" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_price_discount_tier
-- ----------------------------
CREATE INDEX "idx_biz_price_discount_tier_scheme_code" ON "public"."biz_price_discount_tier" USING btree (
  "scheme_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_discount_tier_tenant" ON "public"."biz_price_discount_tier" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_price_tier_adjustment
-- ----------------------------
CREATE INDEX "idx_biz_price_tier_adj_component_code" ON "public"."biz_price_tier_adjustment" USING btree (
  "cost_component_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_tier_adj_cost_adj_id" ON "public"."biz_price_tier_adjustment" USING btree (
  "cost_adjustment_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_tier_adj_tenant" ON "public"."biz_price_tier_adjustment" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table biz_price_tier_adjustment_history
-- ----------------------------
CREATE INDEX "idx_biz_price_tier_adj_hist_component_code" ON "public"."biz_price_tier_adjustment_history" USING btree (
  "cost_component_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_tier_adj_hist_cost_adj_hist_id" ON "public"."biz_price_tier_adjustment_history" USING btree (
  "cost_adjustment_history_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_biz_price_tier_adj_hist_tenant" ON "public"."biz_price_tier_adjustment_history" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);
