java - 如何使一张表中的数据相对独立
大家讲道理
大家讲道理 2017-04-17 13:02:04
0
1
275

现有一些表,里面有一些不同公司的的数据,要求当前的操作人只能访问和操作本公司的数据,请问应该怎么实现比较好?
现在用的方法是每个表都加个字段来区分,查询或者操作的时候都加上这个条件。

项目框架 spring mvc +shiro + mybatis + mysql

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
左手右手慢动作

If there are many companies, you will be fine if you do this.

There are not many companies, so they can be divided into tables and distinguished by table names. It can also be divided into databases, with one database for each company.

These three types have their own advantages for tenant types. You can set permissions on the database by table, just like the database, which is more secure. The advantage of the field-by-field method is that it is flexible and does not need to consider the performance impact of cross-table and cross-database operations and the trouble of code writing. But you need to be careful about the permission management of the app. These tasks that could have been done by the database now need to be considered by the app itself.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!