Skip to content
dict logo

字典配置

dict

系统字典和业务字典配置。建表需要枚举字段或给表添加枚举类字段时使用

SKILL.md

Full skill instructions

字典配置

字段声明

-- 系统字典
`is_locked` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '锁定,dict:is_locked',
-- 业务字典, 字典编码格式: {mod}_{table}_{column}
`status` varchar(20) NOT NULL DEFAULT '' COMMENT '状态,dictbiz:ec_order_status',

添加字典

1. 创建 CSV 文件

src/​tables/​{mod}/
├── base_dict.{mod}.sql.csv        # 系统字典
├── base_dict_detail.{mod}.sql.csv # 系统字典明细
├── base_dictbiz.{mod}.sql.csv     # 业务字典
├── base_dictbiz_detail.{mod}.sql.csv # 业务字典明细
base_dictbiz.{mod}.sql.csv 中:
  • id 使用 nr uuid 生成唯一 ID
  • lbl 为: {table_comment}-{column_comment}, 例: 订单-状态
  • type 一般为: string, 或 number
  • tenant_id 固定为: ZDbZlC1OT8KaDg6soxMCBQ (默认租户)
  • is_sys 一般为: 1 代表是否 系统记录, 系统记录禁止用户修改/删除
  • is_add 一般为: 0 代表是否允许用户新增字典明细
  • order_by 从1开始依次递增
  • 例如:
id,code,lbl,type,order_by,tenant_id,is_sys,is_add
l4V3aK5XRCOqSWsc/​59GEw,exh_booking_order_state,订单-状态,string,1,ZDbZlC1OT8KaDg6soxMCBQ,1,0
base_dictbiz_detail.{mod}.sql.csv 中:
  • id 使用 nr uuid 生成唯一 ID
  • dictbiz_id 为业务字典 ID, 对应 base_dictbiz.{mod}.sql.csv 中对应业务字典的 ID
  • _dictbiz_lbl 为业务字典标签, 对应 base_dictbiz.{mod}.sql.csv 中对应业务字典的 lbl 字段
  • lbl 字段为字典明细标签
  • val 字段为字典明细值
  • order_by 此业务字典从1开始依次递增
  • tenant_id 固定为: ZDbZlC1OT8KaDg6soxMCBQ (默认租户)
  • is_sys 一般为: 1 代表是否 系统记录, 系统记录禁止用户修改/删除
  • 多个字典明细之间可以留空行, 方便阅读
  • 例如:
id,dictbiz_id,_dictbiz_lbl,lbl,val,order_by,tenant_id,is_sys
QudgQBmlTtGBastzn2jpwA,l4V3aK5XRCOqSWsc/​59GEw,订单-状态,未支付,unpaid,1,ZDbZlC1OT8KaDg6soxMCBQ,1
23GjMKTwRKeUvIZvTCwHSg,l4V3aK5XRCOqSWsc/​59GEw,,已支付,paid,2,ZDbZlC1OT8KaDg6soxMCBQ,1

2. 生成 UUID

nr uuid      # 生成1个
nr uuid -- 3 # 生成3个

3. 导入业务字典

nr importCsv {mod}/​base_dictbiz.{mod}.sql.csv

内置系统字典

编码用途
is_deleted删除标记
is_locked锁定
is_enabled启用
is_default默认
yes_no是否

is_sys 字段

`is_sys` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '系统记录,dict:is_sys',

is_sys=1 时:

  • 自动生成枚举类型
  • 禁止用户修改/删除

More Other skills

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

179.7K 100.1K
View

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

179.7K 89.5K
View

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

179.7K 76.1K
View

Fundamental design principles for writing maintainable, testable Python code.

40.2K 21.9K
View

Modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first strategies.

40.2K 20K
View

Generate Playwright tests from scenarios using interactive browser exploration and validation.

39.7K 18.2K
View

Modern React state management with Redux Toolkit, Zustand, Jotai, and React Query for every state category.

40.2K 14.7K
View

GDPR-compliant data handling with consent management, data subject rights, and privacy controls.

40.2K 14.3K
View

Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.

40.2K 13.5K
View

Detailed multi-file refactor planning with safety checks and rollback guidance.

39.7K 13K
View