Usage of BaseMapper @TableLogic annotation

Effect: Add this annotation to the field and then execute the delete method of BaseMapper, the delete method will become a modification

Example:

  Entity class:      

@TableLogic(delval = "2")
private Integer deleted;

   service layer:
      call deleteById(id) of BaseMapper; //id is the primary key corresponding to the entity

 execution is the effect:

      In the case of adding @TableLogic

      sql: UPDATE table name SET deleted=2 WHERE id=? AND deleted=0

        without @TableLogic

      Take delete from table name where id=value

 @TableLogic annotation parameters

    value = "" Default original value

    delval = "" deleted value

    @TableLogic(value="original value",delval="change value")

Guess you like

Origin blog.csdn.net/xc_nostalgia/article/details/109726031