本文整理汇总了Java中tk.mybatis.mapper.model.Country.setCountryname方法的典型用法代码示例。如果您正苦于以下问题:Java Country.setCountryname方法的具体用法?Java Country.setCountryname怎么用?Java Country.setCountryname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tk.mybatis.mapper.model.Country
的用法示例。
在下文中一共展示了Country.setCountryname方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSelectByExample4
import tk.mybatis.mapper.model.Country; //导入方法依赖的package包/类
@Test
public void testSelectByExample4() {
SqlSession sqlSession = MybatisHelper.getSqlSession();
try {
Country ct = new Country();
ct.setCountryname("China");
CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);
Example example = new Example(Country.class);
example.createCriteria().andGreaterThan("id", 20).andEqualTo(ct);
List<Country> countries = mapper.selectByExample(example);
//查询总数
System.out.println(countries.get(0).toString());
Assert.assertEquals(1, countries.size());
} finally {
sqlSession.close();
}
}
示例2: testInsert
import tk.mybatis.mapper.model.Country; //导入方法依赖的package包/类
/**
* 插入完整数据
*/
//该方法测试需要mysql或者h2数据库,所以这里注释掉
//@Test
public void testInsert() {
SqlSession sqlSession = MybatisHelper.getSqlSession();
try {
CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);
Country country = new Country();
country.setCountrycode("CN");
country.setCountryname("天朝");
int count = mapper.insertUseGeneratedKeys(country);
Assert.assertEquals(1, count);
Assert.assertNotNull(country.getId());
} finally {
sqlSession.rollback();
sqlSession.close();
}
}
示例3: testDynamicUpdateByPrimaryKeySelective
import tk.mybatis.mapper.model.Country; //导入方法依赖的package包/类
/**
* 根据查询条件进行查询
*/
@Test
public void testDynamicUpdateByPrimaryKeySelective() {
SqlSession sqlSession = MybatisHelper.getSqlSession();
try {
CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);
Country country = new Country();
country.setId(173);
country.setCountryname("英国");
Assert.assertEquals(1, mapper.updateByPrimaryKeySelective(country));
country = mapper.selectByPrimaryKey(173);
Assert.assertNotNull(country);
Assert.assertEquals(173, (int) country.getId());
Assert.assertEquals("英国", country.getCountryname());
Assert.assertNotNull(country.getCountrycode());
Assert.assertEquals("GB", country.getCountrycode());
} finally {
sqlSession.close();
}
}
示例4: testDynamicUpdateByPrimaryKey
import tk.mybatis.mapper.model.Country; //导入方法依赖的package包/类
/**
* 根据查询条件进行查询
*/
@Test
public void testDynamicUpdateByPrimaryKey() {
SqlSession sqlSession = MybatisHelper.getSqlSession();
try {
CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);
Country country = new Country();
country.setId(174);
country.setCountryname(null);
country.setCountryname("美国");
Assert.assertEquals(1, mapper.updateByPrimaryKey(country));
country = mapper.selectByPrimaryKey(174);
Assert.assertNotNull(country);
Assert.assertEquals(174, (int) country.getId());
Assert.assertEquals("美国",country.getCountryname());
Assert.assertNull(country.getCountrycode());
} finally {
sqlSession.close();
}
}
示例5: testAllColumns
import tk.mybatis.mapper.model.Country; //导入方法依赖的package包/类
/**
* 查询全部
*/
@Test
public void testAllColumns() {
SqlSession sqlSession = MybatisHelper.getSqlSession();
try {
CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);
Country country = new Country();
//35,'China','CN'
country.setCountrycode("CN");
country.setId(35);
country.setCountryname("China");
List<Country> countryList = mapper.select(country);
Assert.assertEquals(1, countryList.size());
} finally {
sqlSession.close();
}
}
示例6: testDynamicSelectZero
import tk.mybatis.mapper.model.Country; //导入方法依赖的package包/类
/**
* 查询不存在的结果
*/
@Test
public void testDynamicSelectZero() {
SqlSession sqlSession = MybatisHelper.getSqlSession();
try {
CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);
Country country = new Country();
country.setCountrycode("CN");
country.setCountryname("天朝");//实际上是 China
List<Country> countryList = mapper.select(country);
Assert.assertEquals(0, countryList.size());
} finally {
sqlSession.close();
}
}
示例7: testDynamicSelectZero
import tk.mybatis.mapper.model.Country; //导入方法依赖的package包/类
/**
* 查询不存在的结果
*/
@Test
public void testDynamicSelectZero() {
SqlSession sqlSession = MybatisHelper.getSqlSession();
try {
CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);
Country country = new Country();
country.setCountrycode("CN");
country.setCountryname("天朝");//实际上是 China
Country result = mapper.selectOne(country);
Assert.assertNull(result);
} finally {
sqlSession.close();
}
}
示例8: testDynamicSelectZero
import tk.mybatis.mapper.model.Country; //导入方法依赖的package包/类
/**
* 查询不存在的结果
*/
@Test
public void testDynamicSelectZero() {
SqlSession sqlSession = MybatisHelper.getSqlSession();
try {
CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);
Country country = new Country();
country.setCountrycode("CN");
country.setCountryname("天朝");//实际上是 China
Assert.assertEquals(0, mapper.selectCount(country));
} finally {
sqlSession.close();
}
}