ServerGroupDao extends BaseDao { public int deleteServerGroupAndServerAndServerConfigByServerGroupId(Long serverGroupId) throws SQLException { String sql = "DELETE t1, t2, t3 " + "from `server_group` t1 " + "left join `server` t2 on t1.id = t2.server_group_id " + "left join `server_config` t3 on t2.id = t3.server_id " + "where t1.id = ?"; return this.updataBysql(sql, Parameter.integerOf(StringUtils.EMPTY, serverGroupId)); }  Long insertServerGroup(ServerGroup serverGroup); ServerGroup getServerGroupById(Long id); List<ServerGroup> getAllServerGroups(); Long getCountByName(String name); Long getCountByIdAndName(Long id, String name); int updateServerGroup(ServerGroup serverGroup); int deleteServerGroup(ServerGroup serverGroup); int deleteServerGroupAndServerAndServerConfigByServerGroupId(Long serverGroupId); List<Server> serversNoGroup(Integer appGroupId); Long getServerGroupTotalCount(Paging<ServerGroup> paging); List<ServerGroupView> findServerGroupPageList(Paging<ServerGroup> paging);  }
@Test public void deleteServerGroupAndServerAndServerConfigByServerGroupId() throws Exception { serverGroup.setId(3L); int count = serverGroupDao.deleteServerGroupAndServerAndServerConfigByServerGroupId(3L); System.out.println("deleteServerGroup :-------> " + count); Assert.assertTrue(count > 0); }