当前位置: 首页>>代码示例>>Java>>正文


Java Country.setCountrycode方法代码示例

本文整理汇总了Java中tk.mybatis.mapper.model.Country.setCountrycode方法的典型用法代码示例。如果您正苦于以下问题:Java Country.setCountrycode方法的具体用法?Java Country.setCountrycode怎么用?Java Country.setCountrycode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tk.mybatis.mapper.model.Country的用法示例。


在下文中一共展示了Country.setCountrycode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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();
    }
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:21,代码来源:TestMysql.java

示例2: testDynamicSelectPage

import tk.mybatis.mapper.model.Country; //导入方法依赖的package包/类
/**
 * 查询全部
 */
@Test
public void testDynamicSelectPage() {
    SqlSession sqlSession = MybatisHelper.getSqlSession();
    try {
        CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);
        Country country = new Country();
        country.setCountrycode("US");
        List<Country> countryList = mapper.selectPage(country, 0, 10);
        //查询总数
        Assert.assertEquals(1, countryList.size());

        countryList = mapper.selectPage(null, 100, 10);
        //查询总数
        Assert.assertEquals(10, countryList.size());
    } finally {
        sqlSession.close();
    }
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:22,代码来源:TestSelect.java

示例3: 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();
    }
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:20,代码来源:TestSelect.java

示例4: testDynamicSelect

import tk.mybatis.mapper.model.Country; //导入方法依赖的package包/类
/**
 * 根据查询条件进行查询
 */
@Test
public void testDynamicSelect() {
    SqlSession sqlSession = MybatisHelper.getSqlSession();
    try {
        CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);
        Country country = new Country();
        country.setCountrycode("CN");
        List<Country> countryList = mapper.select(country);

        Assert.assertEquals(1, countryList.size());
        Assert.assertEquals(true, countryList.get(0).getId() == 35);
        Assert.assertEquals("China", countryList.get(0).getCountryname());
    } finally {
        sqlSession.close();
    }
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:20,代码来源:TestSelect.java

示例5: 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();
    }
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:19,代码来源:TestSelect.java

示例6: testDynamicSelect

import tk.mybatis.mapper.model.Country; //导入方法依赖的package包/类
/**
 * 根据查询条件进行查询
 */
@Test
public void testDynamicSelect() {
    SqlSession sqlSession = MybatisHelper.getSqlSession();
    try {
        CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);
        Country country = new Country();
        country.setCountrycode("CN");
        Country result = mapper.selectOne(country);

        Assert.assertEquals(true, result.getId() == 35);
        Assert.assertEquals("China", result.getCountryname());
    } finally {
        sqlSession.close();
    }
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:19,代码来源:TestSelectOne.java

示例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();
    }
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:19,代码来源:TestSelectOne.java

示例8: testDynamicSelect

import tk.mybatis.mapper.model.Country; //导入方法依赖的package包/类
/**
 * 根据查询条件进行查询
 */
@Test
public void testDynamicSelect() {
    SqlSession sqlSession = MybatisHelper.getSqlSession();
    try {
        CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);
        Country country = new Country();
        country.setCountrycode("CN");
        Assert.assertEquals(1, mapper.selectCount(country));
    } finally {
        sqlSession.close();
    }
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:16,代码来源:TestSelectCount.java

示例9: 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();
    }
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:17,代码来源:TestSelectCount.java


注:本文中的tk.mybatis.mapper.model.Country.setCountrycode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。