目前看到,外键对性能的伤害比较大,而且开发起来这个完整性约束特别麻烦,如果都用事务,许多人不建议使用外键。
JPA Hibernate禁止生成外键。
mybatis还是jpa, jpa要改的太多,一会儿实体一会儿业务,mybatis使用view这种要灵活多变地多。
所以需要数据完整性的部分,比如userService这里,可以用jpa, 而对于业务变动比较频繁,而访问比较要求性能的部分可以用mybatis,这样划分。
refs:
https://www.codejava.net/frameworks/spring-boot/spring-security-jwt-role-based-authorization
https://www.baeldung.com/role-and-privilege-for-spring-security-registration
https://dev.to/alphaaman/building-a-role-based-access-control-system-with-jwt-in-spring-boot-a7l
https://www.devglan.com/spring-security/jwt-role-based-authorization
https://www.jianshu.com/p/1d8ebfae1669
https://www.sobyte.net/post/2021-11/whys-the-design-database-foreign-key/
https://dataedo.com/blog/why-there-are-no-foreign-keys-in-your-database-referential-integrity-checks
https://zhuanlan.zhihu.com/p/447922429
https://www.jb51.net/article/197243.htm
https://www.geeksforgeeks.org/how-to-design-a-relational-database-for-e-commerce-website/
https://www.geeksforgeeks.org/how-to-design-database-inventory-management-systems/