1.0.3 发布
2021年11月2日 - 1.0.3 发布了:tada::tada::tada:
mybatis-mapper 项目升级为 1.0.3:
- mybatis-common 项目中缺少默认语言包,已经将中文设置为默认语言包。
- 解决
Example
中的orderBy
多次时连接字符串错误的 BUG,增加多个方便使用的orderBy
方法。 - 修复 Example.selectColumns 关键词列名的Bug #16 by ydq
- Example 系列方法 支持拼接单层级的 OR 条件 #17 by ydq
尝试性的支持 #15 单层级(不支持 andOr() 条件里面 继续嵌套更细粒度的 andOr() )的 or 条件拼接输出SQL(支持 select 和 update)://example: UserMapper2 mapper = sqlSession.getMapper(UserMapper2.class); Example<User> example = mapper.example(); example.createCriteria() .andEqualTo(User::getSex,"男") .andOr(example.orPart() .andLike(User::getUserName,"杨%"), example.orPart() .andLike(User::getUserName,"俞%") .andLike(User::getUserName,"%舟"));
xxx WHERE ( sex = ? AND ( ( name LIKE ? ) OR ( name LIKE ? AND name LIKE ? ) ) )
Fn<T, R>
功能优化,增加缓存,支持引用父类方法,示例如下:public static class BaseId { @Entity.Column(id = true) private Long id; public Long getId() { return id; } public void setId(Long id) { this.id = id; } } public static class BaseEntity extends BaseId { @Entity.Column(value = "when_create", jdbcType = JdbcType.TIMESTAMP) private Long whenCreate; public Long getWhenCreate() { return whenCreate; } public void setWhenCreate(Long whenCreate) { this.whenCreate = whenCreate; } } @Entity.Table("sys_user") public static class SysUser extends BaseEntity { @Entity.Column("name") private String userName; public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } } @Entity.Table("sys_role") public class SysRole extends BaseEntity { @Entity.Column("name") private String roleName; public String getRoleName() { return roleName; } public void setRoleName(String roleName) { this.roleName = roleName; } } @Test public void testExtends() { Assert.assertEquals("id", ((Fn<SysUser, Object>) SysUser::getId).toField()); Assert.assertEquals("id", ((Fn<SysUser, Object>) SysUser::getId).toColumn()); Assert.assertEquals("whenCreate", ((Fn<SysUser, Object>) SysUser::getWhenCreate).toField()); Assert.assertEquals("when_create", ((Fn<SysUser, Object>) SysUser::getWhenCreate).toColumn()); Assert.assertEquals("userName", ((Fn<SysUser, Object>) SysUser::getUserName).toField()); Assert.assertEquals("name", ((Fn<SysUser, Object>) SysUser::getUserName).toColumn()); Assert.assertEquals("id", ((Fn<SysRole, Object>) SysRole::getId).toField()); Assert.assertEquals("id", ((Fn<SysRole, Object>) SysRole::getId).toColumn()); Assert.assertEquals("whenCreate", ((Fn<SysRole, Object>) SysRole::getWhenCreate).toField()); Assert.assertEquals("when_create", ((Fn<SysRole, Object>) SysRole::getWhenCreate).toColumn()); Assert.assertEquals("roleName", ((Fn<SysRole, Object>) SysRole::getRoleName).toField()); Assert.assertEquals("name", ((Fn<SysRole, Object>) SysRole::getRoleName).toColumn()); }