![](https://img-blog.csdnimg.cn/f46d8cc470f14424b8cdc12ac89b8552.png)
所有的 sql 语句都写在 org.thingsboard.server.dao.sql 包下面,里面有所有实体的查询语句。
所有的实体类都通过 Table 注解,在 org.thingsboard.server.dao.model.sql 下。
![](https://img-blog.csdnimg.cn/e73b1feb7e474240b789f699f212e0de.png)
![](https://img-blog.csdnimg.cn/8d20c7f7acf64303971ffba2e48a2b86.png)
【自动切换数据源】
数据源配置:
spring.data.jpa.repositories.enabled = true
spring.datasource.url = jdbc:postgresql://172.16.4.62: