Home > Back-end >  Ask your bosses help small white busy, my head will blow up, don't know how to write, in this f
Ask your bosses help small white busy, my head will blow up, don't know how to write, in this f

Time:11-29

CodePudding user response:

Logic to rationalize, several main object:

Project, members, the file

A user can belong to multiple members of the project;
Users can upload files under the project, the sharing of files can be private or project team;
Users can view their projects under the private and Shared file;

The user (uid)
Project (pid)
Project_member (pid, uid)
The file (id, pid, uid, see_type)//see_type visible type 1-2 - sharing private

For button permissions, you can on the page based on user roles, role can configure button permissions

CodePudding user response:

Use the SQL!
 
Select * from file table where A (a. project id (in the
Among the select B.a udit_id from table B where user_id=?
)
And A.s tatus=0 and A.u ser_id!=)? The or a. user_id==?

You don't and I said file table no project id, if not, then this table design is definitely has a problem,
Your user corresponding to multiple projects, no project id file table, don't judge this file belongs to which project,
If it is your own doing project, hurriedly with this field, if not their own, to get over the problem feedback to your group,

CodePudding user response:

The third paradigm, in fact, in order to comply with the database, you should separate out a table to record file attributes, should not let the documents show the level and project id,
I found my dimmed eyesight, you file list is a project id
 
Select * from file table A where clause (a. d. raftAuditProjectId in (
Among the select B.a udit_id from table B where user_id=?
)
And A.s tatus=0 and A.u ser_id!=)? The or a. user_id==?

CodePudding user response:

reference timesong wind xiao xi reply: 3/f
database in order to comply with the third paradigm, actually you should separate out a table to record file attributes, should not let the documents show the level and the project id,
I found my dimmed eyesight, you file list is a project id
 
Select * from file table A where clause (a. d. raftAuditProjectId in (
Among the select B.a udit_id from table B where user_id=?
)
And A.s tatus=0 and A.u ser_id!=)? The or a. user_id==?

SELECT
*
The FROM
Act_evidence ae
LEFT the JOIN sys_audit_user sau ON sau. User_id=ae. User_id
LEFT the JOIN sys_user su ON sau. User_id=su. User_id
LEFT the JOIN sys_audit sa ON ae. DraftAuditProjectId=sa. Audit_id
WHERE
Sau. User_id
AND ae. STATUS=0
OR 1
The ORDER BY
Ae. STATUS DESC

CodePudding user response:

reference timesong wind xiao xi reply: 3/f
database in order to comply with the third paradigm, actually you should separate out a table to record file attributes, should not let the documents show the level and the project id,
I found my dimmed eyesight, you file list is a project id
 
Select * from file table A where clause (a. d. raftAuditProjectId in (
Among the select B.a udit_id from table B where user_id=?
)
And A.s tatus=0 and A.u ser_id!=)? The or a. user_id==?

I am writing

CodePudding user response:

Ps_psps_ps
reference 4 floor response:
Quote: refer to the third floor timesong wind xiao xi response:
database in order to comply with the third paradigm, actually you should separate out a table to record file attributes, should not let the documents show the level and the project id,
I found my dimmed eyesight, you file list is a project id
 
Select * from file table A where clause (a. d. raftAuditProjectId in (
Among the select B.a udit_id from table B where user_id=?
)
And A.s tatus=0 and A.u ser_id!=)? The or a. user_id==?

SELECT
*
The FROM
Act_evidence ae
LEFT the JOIN sys_audit_user sau ON sau. User_id=ae. User_id
LEFT the JOIN sys_user su ON sau. User_id=su. User_id
LEFT the JOIN sys_audit sa ON ae. DraftAuditProjectId=sa. Audit_id
WHERE
Sau. User_id
AND ae. STATUS=0
OR 1
The ORDER BY
Ae. STATUS DESC

You write that efficiency is not high and LEFT the JOIN will detect act_evidence all data tables, could also find out more data, are you still using *, that is more pit, * average in the league table of the time not used directly, could be specified field specified field
  • Related