素材和版本
tb-release:3.2.2
目标
为了快速地熟悉代码,决定增加一个模块,并且使得模块能够完成CURD功能。
效果图:
改动代码(后端部分)
1)application模块
src/main/java/org/thingsboard/server/controller/ProjectController.java
src/main/java/org/thingsboard/server/controller/BaseController.java
src/main/java/org/thingsboard/server/service/security/permission/CustomerUserPermissions.java
src/main/java/org/thingsboard/server/service/security/permission/Resource.java
src/main/java/org/thingsboard/server/service/security/permission/TenantAdminPermissions.java
Controller:主要增加了api接口
Permission:主要解决权限问题
2)common模块
dao-api/src/main/java/org/thingsboard/server/dao/project/ProjectService.java
data/src/main/java/org/thingsboard/server/common/data/id/EntityIdFactory.java
data/src/main/java/org/thingsboard/server/common/data/tenant/profile/DefaultTenantProfileConfiguration.java
主要是api服务定义和Id,因为我增加了一个最大项目数的配置,所以需要改profile
3)dao模块
src/main/java/org/thingsboard/server/dao/project/ProjectDao.java
src/main/java/org/thingsboard/server/dao/project/ProjectServiceImpl.java
src/main/java/org/thingsboard/server/dao/sql/project/JpaProjectDao.java
src/main/java/org/thingsboard/server/dao/sql/project/ProjectRepository.java
这个模块主要是定义Jpa,数据库Repository层的实现。
本文章来源于互联网,如有侵权,请联系删除!原文地址:Thingsboard二开系列拷贝篇-03快速增加一个模块(后端)