DataBaseDao extends BaseDao { public List<DataBaseInfo> getAllDbByProjectId(long projectId) throws SQLException { String sql = "select t1.id, t1.db_name, t1.comment,t1.dal_group_id, t1.db_address, t1.db_port, t1.db_user, t1.db_password, t1.db_catalog, t1.db_type from alldbs t1\n" + "inner join (\n" + "select distinct a1.db_Id from databasesetentry a1\n" + "inner join databaseset a2 on a1.dbset_id = a2.id\n" + "inner join project_dbset_relation a3 on a3.dbset_id = a2.id\n" + "inner join project a4 on a4.id = project_id\n" + "where a4.id = " + projectId + ") t2 on t1.id= t2.db_Id"; return this.queryBySql(sql, DataBaseInfo.class); }  Long insertDataBaseInfo(DataBaseInfo dataBaseInfo); int[] insertDatabaselist(List<DataBaseInfo> dataBaseInfoList); int updateDataBaseInfo(DataBaseInfo dataBaseInfo); int updateDataBaseInfo(Long id, String dbname, String db_address, String db_port, String db_user,
                                  String db_password, String db_catalog, Integer db_type, String comment, String updateUserNo); int updateDataBaseInfo(Long id, Long groupId, String comment); int updateDataBaseInfo(Long id, String comment); int updateDataBaseInfo(Long id, Long groupId); int deleteDataBaseInfo(Long id); DataBaseInfo getDataBaseInfoByDbId(Long id); DataBaseInfo getDatabaseByName(String name); List<DataBaseInfo> getAllDbByProjectId(long projectId); List<DataBaseInfo> getAllDbByAppId(String appid); List<String> getAllDbAllinOneNames(); List<DataBaseInfo> getGroupDBsByGroup(Long groupId); Long getCountByName(String dbname); Long getCountByIdAndName(Long id, String dbname); List<DataBaseInfo> getAllDbsByDbNames(List<String> dbNames); List<DataBaseInfo> getAllDbsByIdss(List<Long> ids); DataBaseInfo getMasterCologByDatabaseSetId(Long dbset_id); Long getTotalCount(Paging<DataBaseInfo> paging); List<DataBaseView> findDbPageList(Paging<DataBaseInfo> paging); Long getTotalCountByUserId(Paging<DataBaseInfo> paging, Long userId); List<DataBaseView> findDbPageListByUserId(Paging<DataBaseInfo> paging, Long userId); List<DataBaseInfo> getDatabaseListByLikeName(String dbname);  }
@Test public void getAllDbByProjectId() throws Exception { List<DataBaseInfo> list = dataBaseDao.getAllDbByProjectId(38L); System.out.println("getAllDbByProjectId :-------> " + list); Assert.assertTrue(list.size() > 0); }