# TkMybatisPlus **Repository Path**: yalex/tk-mybatis-plus ## Basic Information - **Project Name**: TkMybatisPlus - **Description**: tk-mybatis使用mybatis-plus的lambda形式 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 4 - **Forks**: 0 - **Created**: 2021-08-09 - **Last Updated**: 2024-10-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: tk-mybatis, Lambda ## README # TkMybatisPlus #### 介绍 tk-mybatis使用mybatis-plus的lambda形式 1. tk-mybatis的原生使用形式是需要显示的固定数据库字段名称,假如数据库字段修改的话,应用程序会抛异常。 2. 看到mybatis-plus的lambda形式后,写了一个工具类ExampleWrapper,传入对应的实体类,可以实现类似的功能。 #### 使用说明 1. 原tk-mybatis示例: Example example = new Example(User.class); example.setOrderByClause("create_time DESC"); example.createCriteria().andEqualTo("username", user.getUsername()); List user = userMapper.selectByExample(example); 2. 本工具类tk-mybatis-plus示例: ExampleWrapper wrapper = ExampleWrapperFactory.create(User.class); wrapper.andEqualTo(User::getUsername, user.getUsername());//lambda表达式 List userPlus = userMapper.selectByExample(wrapper);