官方文档:http://mybatis-mp.cn

mybatis-mp 是一款超级好用ORM框架,它不是mybatis-plus;设计简单、 使用灵活、快捷、扩展性超强

JPA Hibernate JdbcTempte 等要么太死 太难 太呆;稍微复杂一点就需要拼sql 好累!!!

所以为什么不来试试 mybatis-mp;我只能说这太好用了,不信的 可以自己去试试,反正免费的!!!

1 单表:

//单条SysUser sysUser=QueryChain.of(sysUserMapper)        .like(SysUser::getName,"xx")        .limit(1)        .get()//listList<SysUser> list=QueryChain.of(sysUserMapper)        .like(SysUser::getName,"xx")        .list()//分页Pager<SysUser> page=QueryChain.of(sysUserMapper)        .like(SysUser::getName,"xx")        .paging(Pager.of(1,20))

2 连表:

//VO@Data@ResultEntity(SysUser.class)public class SysUserRoleVo {    private Integer id;    private String userName;    @ResultEntityField(target = SysUser.class, property = "password")    private String pwd;    @NestedResultEntity(target = SysRole.class)    private SysRole role;}//单条SysUserVO sysUserVO=QueryChain.of(sysUserMapper)        .select(SysUserVO.class)        .from(SysUser.class)        .join(SysUser.class, SysRole.class, on -> on.eq(SysUser::getRoleId, SysRole::getId)        .like(SysUser::getName,"xx")        .limit(1)        .returnType(SysUserVO.class)        .get()//listList<SysUserVO> list=QueryChain.of(sysUserMapper)        .select(SysUserVO.class)        .from(SysUser.class)        .join(SysUser.class, SysRole.class, on -> on.eq(SysUser::getRoleId, SysRole::getId)        .like(SysUser::getName,"xx")        .returnType(SysUserVO.class)        .list()//分页Pager<SysUserVO> page=QueryChain.of(sysUserMapper)        .select(SysUserVO.class)        .from(SysUser.class)        .join(SysUser.class, SysRole.class, on -> on.eq(SysUser::getRoleId, SysRole::getId)        .like(SysUser::getName,"xx")        .returnType(SysUserVO.class)        .paging(Pager.of(1,20))

复杂定制

展示 窗口函数能力 实现 ORM + SQL模板的厉害

SysUserRoleAutoSelectVo vo = QueryChain.of(sysUserMapper)        .select(SysUserRoleAutoSelectVo.class)        .selectWithFun(SysRole::getId, c -> CmdTemplate.create(" RANK() OVER( ORDER BY {0}) ", c).as("RANK2"))        .from(SysUser.class)        .join(SysUser.class, SysRole.class)        .returnType(SysUserRoleAutoSelectVo.class)        .orderBy(SysUser::getId)        .limit(1)        .get();

轻轻松松 简简单单 帮你迅速开发;还有很多很好的功能和特性,请前往官网查看 :http://mybatis-mp.cn

mybatis-mp 可以说 没有构建不出来的 sql 欢迎体验:http://mybatis-mp.cn

免责声明:本文系转载,版权归原作者所有;旨在传递信息,不代表一休教程网的观点和立场。