Home > Back-end >  Have give a complete logic delete code!!!!!!!!!!!!!!!
Have give a complete logic delete code!!!!!!!!!!!!!!!

Time:11-27

The more detailed, the better code

CodePudding user response:

Logic delete refers to sa?

CodePudding user response:

Logic to delete, refers to the database?
Then you can design a does field, 0 to delete, not 1 to delete, you can update the data does field is 1

CodePudding user response:

Is the logic delete code

CodePudding user response:

Delete the database logic

CodePudding user response:

reference 4 floor InnovateI response:
database logic delete
he said on the second floor, add a field field judgment, delete is to change the value of this field

CodePudding user response:

reference 5 floor got to have you give reply:
Quote: refer to 4th floor InnovateI response:
database logic delete
he said on the second floor, just add a field field judgment, delete is to change the value of this field

I can't inject baen tip userMapper

CodePudding user response:

Just change the state of the data, where there is great with the delete

CodePudding user response:

Create methods 0 to 1

CodePudding user response:

Code for, tell me the differences between logical deletion and physical delete it,
Physical delete: when deleting database is to perform the delete statement, actually delete the data itself, (delete from the table where id='id')
Logic delete: when deleting database is to perform the update, actually don't delete data, through the query and delete state judgment, not query marked for deletion of data, (the update table set isDelete=true where id='id'. Select * from table where isDelete!=true;

Theoretical data correlation less and less important when using physical delete, data correlation is wide, important degree is high, need to keep data delete history with logic operation,

CodePudding user response:

refer to 6th floor InnovateI response:
Quote: you got to give them have quoted 5 floor response:
Quote: refer to 4th floor InnovateI response:
database logic delete
he said on the second floor, just add a field field judgment, delete is to change the value of this field

I suggest userMapper unable to inject baen
didn't scan to? See if other classes in the directory structure in the Application class at a lower level of your project directory structure and fault posted a look

CodePudding user response:

Logic to delete, having a field to distinguish between display does not show, no real physical delete, delete is logic,

CodePudding user response:

Logic to delete the only constraint conflict, easy to cause the database table like a commodity, commodity code requirements, create a unique constraint logic but delete case, because the data is not really deleted, this could be a commodity to be deleted, and then continue to add the same number of goods, so there will be a commodity code violation of the constraints,
I the general treatment method is to remove to table's primary key field definitions of the same type, the only constraint into fields and delete tags field joint constraints, only when the data is not deleted, remove the tag field is zero, when marked for deletion, remove the tag field values and primary key values are equal,
Such as commodity list:
The create table goods (
Id bigint primary key,
Goods_no varchar (20),
.
Does bigint not null default 0,
The constraint uq_goods_goods_no unique (goods_no, does)
);

CodePudding user response:

Mysql to delete the delete fromtable where id=?

CodePudding user response:

Each table to add isdeleted fields, and then update the delete is the update table set isdeleted=1, where clause for the query is a select * from table where ISNULL (isdeleted, 0)=0
  • Related