Skip to content

MoneyHacker/common-dao

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

一 通用Dao组件,Common-dao, Mybaits 一个链接可以查询多个数据表

  • 每张表只需要生成Bean和xml文件即可
  • 一个Dao可以查询同一个链接池关联数据库下所有表
  • Bean 及 xml快速生成,可参考项目generator

二示例,具体其它方法可以查看ICommonDao接口和测试类DaoTester

@Resource
private ICommonDao commonDao;
@Test
public void test() {
    SysUser user = commonDao.get(1L, SysUser.class);
    Assert.assertNotNull(user);
    //根据内置sql查询,按条件查询
    user = commonDao.get(SysUser.class,"userName","aaa");
    Assert.assertNotNull(user);
    //根据自己定义sql查询,sqlId是在xml的sqlId
    List<SysUser> userList =  commonDao.getListBySqlId(SysUser.class, "selectByIds","list", Arrays.asList(1L,2L));
    Assert.assertNotNull(userList);
}

三 交流(QQ群:51567067) 支持

微信支付宝

Releases

No releases published

Packages

No packages published

Languages