您现在的位置是:首页 > 文章详情

nbsaas-boot 新增动态 sql 构建和查询功能

日期:2024-04-30点击:263
<parent>
     <groupId>com.nbsaas.boot</groupId>
     <artifactId>nbsaas-boot</artifactId>
     <version>1.1.10-2024</version>
</parent>

本次更新内容

1. 新增实验室功能,后台动态构造sql语句,方便及时处理前端业务查询,同时对数据进行强校验,减少sql注入问题,集成shiro权限功能,可以对查询配置权限。其中包括分页查询,列表查询,批量查询,批量查询支持同步和异步查询。

2. 后端管理端新增组合函数,减少很多重复代码

3. 优化代码生成器,可以对生成的类进行重命名

4.  修改vue3代码生成模板

5. 代码生成器中mybatis-plus模式下字段映射问题

6. 新增通用查询功能

nbsaas-boot 具有以下特点:

自动建表:nbsaas-boot 提供了自动建表功能,根据用户定义的数据模型自动生成数据库表结构,减少手动操作,提高开发效率。

支持 jpa,mybatis-plus 等数据库 orm。内置一套访问数据的注解 DSL

开发规范:nbsaas-boot 提供一套开发规范,包括代码风格、命名规范、注释规范等,使团队开发更加规范化和高效化。

代码生成器:nbsaas-boot 提供代码生成器,根据数据模型自动生成前端和后端代码,提高开发效率和代码质量。

多租户支持:nbsaas-boot 支持多租户,为不同客户提供独立的数据存储空间和访问权限,保证数据安全性和隔离性

通过 Command 处理复杂的业务

InputRequestObject context = new InputRequestObject();
context.setConfig(config);
context.setFormBean(formBean);

 

    new DomainCommand()
        .after(new ApiCommand())
        .after(new ConvertCommand())
        .after(new ControllerFrontCommand())
        .after(new RestCommand())
        .after(new ExtApiCommand())
        .after(new RepositoryCommand())
        .after(new FieldCommand())
        .after(new FinishCommand()).execute(context);

模型构建

@CatalogClass
@FormAnnotation(title = "组织架构管理", model = "组织架构")
@Data
@Entity
@Table(name = "sys_structure")
public class Structure extends CatalogEntity {

    @FormField(title = "父分类名称")
    @Comment("父分id")
    @FieldName
    @FieldConvert(classType = "Integer")
    @ManyToOne(fetch = FetchType.LAZY)
    private Structure parent;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "parent")
    private List<Structure> children;

}

搜索模型

@Data
public class ArticleSearch extends PageRequest implements Serializable {

    /**
     * 主键id  ==查询
     **/
    @Search(name = "id", operator = Operator.eq)
    private Long id;

    /**
     * 文章标题  模糊查询
     **/
    @Search(name = "title", operator = Operator.like)
    private String title;


}

通过模型数据提取,然后通过代码生成器生成后端代码 + vue3 后端管理代码

项目最佳实践:https://gitee.com/quhaodian/nbsaas-mall2

基础功能项目 https://gitee.com/cng1985/nbsaas-boot-starter
项目脚手架 https://gitee.com/cng1985/nbsaas-admin
vue3 后台管理脚手架 https://gitee.com/cng1985/nbsaas-admin-vue3

原文链接:https://www.oschina.net/news/290353/nbsaas-boot-updated
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章