ServerGroupDao extends BaseDao { public Long getCountByIdAndName(Long id, String name) throws SQLException { String sql = "SELECT count(1) FROM server_group WHERE name='" + name + "' and id = " + id; return this.getCount(sql); }  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 getCountByIdAndName() throws Exception { Long count = serverGroupDao.getCountByName("pres_test"); System.out.println("getCountByName :-------> " + count); Assert.assertTrue(count > 0); }