# ibizlab-template-groovy **Repository Path**: ibizlab-edge/ibizlab-template-groovy ## Basic Information - **Project Name**: ibizlab-template-groovy - **Description**: iBiz 模型驱动开发体系中的 Groovy 项目构型模版,底层基于以SpringBoot/SpringCloud为内核 ibiz-service-runner 引擎,将传统的 Controller/Service/Repository 模板演变为ORM框架,每个实体对应一个 Groovy 控制类,发布 DTO 与 Runtime 控制逻辑。 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: https://www.ibizlab.cn/ - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-02 - **Last Updated**: 2025-09-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 🌀 模板介绍 iBiz 模型驱动开发体系中的 Groovy 项目构型模版,底层基于以SpringBoot/SpringCloud为内核 ibiz-service-runner 引擎,将传统的 Controller/Service/Repository 模板演变为ORM框架,每个实体对应一个 Groovy 控制类,发布 DTO 与 Runtime 控制逻辑。 示例发布成果 [https://gitee.com/ibizlab/plm-service](https://gitee.com/ibizlab/plm-service) 📢 📢 [介绍视频](https://www.bilibili.com/video/BV1sCoNYMEeV) 📢 📢 ## 架构说明 ### ✅ 动态控制器生成 每个实体对应一个 Groovy 控制类,无需传统 Controller/Service/Repository 分层样板代码。例如: 包路径: ``` {{system}} └─ {{projectName}}-core ├─ pom.xml.hbs └─ src └─ main └─ grovvy └─ {{packageName}} └─ {{modules}} 系统模块目录 └─ {{entities}} 实体 └─ DTO 实体 ├─ {{entities}}DTO 实体DTO └─ {{entities}}FilterDTO 实体Filter ``` ### ✅ DTO 简洁链式调用 ```groovy @Test void testSave() { ProductDTO dto = Product.getInstance().entity() .setId("test1") .setName("test1产品") .setIdentifier("0000") .setScopeType("organization") .setVisibility("public") .setMembers([ new ProductMemberDTO() .setUserId("demo_admin") .setName("管理员") .setRoleId("admin") ]) .save() as ProductDTO println dto } ``` ### ✅ 动态获取与查询示例 ```groovy @Test void testGet() { ProductDTO dto = Product.getInstance().get("test1", true) if (!dto) { dto = Product.getInstance().create(new ProductDTO() .setId("test1") .setName("test1产品") .setIdentifier("0000") .setScopeType("organization") .setVisibility("public") .setMembers([ new ProductMemberDTO().setUserId("demo_admin").setName("管理员").setRoleId("admin") ])) println "未命中,创建新数据: ${dto}" } else { println "命中: ${dto}" } } ``` ```groovy @Test void testFetchDefault() { Page page = Product.getInstance() .fetchDefault(new ProductFilterDTO().sort("create_time,desc")) println "共${page.totalPages}页,${page.totalElements}行" // 简写方式 page = Product.getInstance().filter().sort("create_time,desc").fetch() page.content.each { println it } } ```