插件目录结构
以 lg_cms 插件为例
Java 后端目录结构
text
niucloud-addon/
├── lg_cms/
│ ├── pom.xml # Maven配置文件
│ └── src/
│ └── main/
│ ├── java/ # Java源代码目录
│ │ └── com/
│ │ └── niu/
│ │ └── lg_cms/
│ │ ├── WebApplication.java # 插件入口类
│ │ ├── config/ # 配置类
│ │ ├── controller/ # 控制器层
│ │ ├── adminapi/ # 后台管理API
│ │ └── api/ # 前端用户API
│ │ ├── entity/ # 实体类
│ │ ├── enums/ # 枚举类
│ │ ├── event/ # 事件定义
│ │ ├── job/ # 定时任务
│ │ ├── listener/ # 事件监听器
│ │ ├── mapper/ # 数据访问层
│ │ └── service/ # 业务逻辑层
│ └── resources/ # 资源文件目录
│ ├── info.json # 插件元数据配置
│ └── lg_cms/
│ ├── config/ # 配置文件
│ ├── i18n/ # 国际化资源
│ ├── loader/ # 加载器配置
│ └── upgrade/ # 升级脚本web 前端目录结构
text
web/addon/lg_cms/
├── api/ # API 接口定义
│ └── hello_world.ts # 示例 API 接口
├── lang/ # 国际化资源
│ └── zh-cn/
│ ├── hello_world.index.json # 页面国际化配置
│ └── pages.json # 页面路由国际化配置
└── pages/ # 页面组件
├── hello_world/ # 示例页面
│ └── index.vue # 页面组件
└── routes.ts # 页面路由配置uni-app 前端目录结构
text
uni-app/src/addon/lg_cms/
├── api/ # API 接口定义
│ └── hello_world.ts # 示例 API 接口
├── locale/ # 国际化资源
│ ├── en.json # 英文国际化配置
│ ├── zh-Hans/ # 中文国际化配置
│ │ └── pages.hello_world.index.json # 页面国际化配置
│ └── zh-Hans.json # 中文基础国际化配置
└── pages/ # 页面组件
└── hello_world/ # 示例页面
└── index.vue # 页面组件admin 前端目录结构
text
admin/src/addon/lg_cms/
├── api/ # API 接口定义
│ └── hello_world.ts # 示例 API 接口
├── lang/ # 国际化资源
│ └── zh-cn/
│ └── hello_world.index.json # 页面国际化配置
└── views/ # 页面组件
└── hello_world/ # 示例页面
└── index.vue # 页面组件webroot 目录结构
text
webroot/addon/lg_cms/
├── admin/ # 管理后台资源
│ ├── api/ # API 接口定义
│ │ └── hello_world.ts # 示例 API 接口
│ ├── lang/ # 国际化资源
│ │ └── zh-cn/ # 中文国际化
│ └── views/ # 页面组件
│ └── hello_world/ # 示例页面
├── info.json # 插件元数据配置
├── java/ # Java 编译后文件
│ ├── pom.xml # Maven 项目配置
│ └── src/main/ # 源代码
├── menu/ # 菜单配置
│ ├── admin.json # 后台菜单配置
│ └── site.json # 前端菜单配置
├── package/ # 打包相关
│ └── uni-app-pages.txt # 移动端页面配置
├── resource/ # 静态资源
│ ├── cover.png # 插件封面图
│ └── icon.png # 插件图标
├── sql/ # 数据库脚本
│ ├── install.sql # 安装脚本
│ └── uninstall.sql # 卸载脚本
├── uni-app/ # 移动端资源
│ ├── api/ # API 接口定义
│ │ └── hello_world.ts # 示例 API 接口
│ ├── locale/ # 国际化资源
│ │ ├── en.json # 英文国际化
│ │ ├── zh-Hans/ # 中文国际化
│ │ └── zh-Hans.json # 中文基础国际化
│ └── pages/ # 页面组件
│ └── hello_world/ # 示例页面
└── web/ # Web 前端资源
├── api/ # API 接口定义
│ └── hello_world.ts # 示例 API 接口
├── lang/ # 国际化资源
│ └── zh-cn/ # 中文国际化
└── pages/ # 页面组件
├── hello_world/ # 示例页面
└── routes.ts # 路由配置