Skip to content

sourcespro/commons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

1、use the left and right tree structure

create an Entity extends BaseTree

public class Tree extends BaseTree {
    private String name;
    ……
}

use the tree plug-in

@Bean
public LRTreeInterceptor treeInterceptor(){
    logger.info("Initialize the left and right tree structure mybatis plug-in");
    return new LRTreeInterceptor();
}

The TreeMapper.java is probably like this.
insert method, This plug-in intercepts the Entity extends of BaseTree. delete method, This plug-in intercepts the @LRTreeDelete.

@Mapper
public interface TreeMapper {

    int insert(Tree record);

    int updateById(Tree record);

    Tree findById(Long id);

    List<Tree> findByPid(Long pid);

    List<Tree> findByLftAndRgt(@Param("lft") Integer lft, @Param("rgt") Integer rgt);

    @LRTreeDelete
    int deleteById(Long id);
}

About

project bootstrap

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages