Search in sources :

Example 1 with UserEntity

use of com.mendmix.mybatis.test.entity.UserEntity in project jeesuite-libs by vakinge.

the class BaseMybatisTest method testSelectByExample.

@Test
public void testSelectByExample() throws InterruptedException {
    UserEntity example = new UserEntity();
    example.setName("嘎子");
    example.setType((short) 1);
    example.setCreatedAt(new Date());
    userMapper.selectByExample(example);
}
Also used : UserEntity(com.mendmix.mybatis.test.entity.UserEntity) Date(java.util.Date) Test(org.junit.Test)

Example 2 with UserEntity

use of com.mendmix.mybatis.test.entity.UserEntity in project jeesuite-libs by vakinge.

the class BaseMybatisTest method testXXXX.

@Test
public void testXXXX() {
    UserEntity entity = userMapper.selectByPrimaryKey(8);
    userMapper.findMobileByIds(Arrays.asList(4, 5, 6));
    userMapper.findByMobile(entity.getMobile());
    userMapper.findByType((short) 1);
    entity = userMapper.selectByPrimaryKey(8);
    entity.setName(RandomStringUtils.random(5, true, true));
    userMapper.updateByPrimaryKeySelective(entity);
    userMapper.findMobileByIds(Arrays.asList(4, 5, 6));
    userMapper.findByType((short) 1);
}
Also used : UserEntity(com.mendmix.mybatis.test.entity.UserEntity) Test(org.junit.Test)

Example 3 with UserEntity

use of com.mendmix.mybatis.test.entity.UserEntity in project jeesuite-libs by vakinge.

the class BaseMybatisTest method testUpdate.

@Test
public void testUpdate() throws InterruptedException {
    UserEntity example = new UserEntity();
    example.setStatus((short) 1);
    example.setType((short) 1);
    example.setName("嘎子");
    example.setMobile("13800373090");
    // userMapper.updateByExample(example);
    // 
    // userMapper.updateType(1, new int[] {1,2,3});
    // 
    // userMapper.updateByName("嘎子");
    // 
    Map<String, Object> param = new HashMap<>();
    param.put("status", example.getStatus());
    param.put("type", example.getType());
    param.put("name", example.getName());
    param.put("mobile", example.getMobile());
    // userMapper.updateByMap(param);
    userMapper.updateTypeByExample(example.getType(), example);
    Thread.sleep(60000);
}
Also used : HashMap(java.util.HashMap) UserEntity(com.mendmix.mybatis.test.entity.UserEntity) Test(org.junit.Test)

Example 4 with UserEntity

use of com.mendmix.mybatis.test.entity.UserEntity in project jeesuite-libs by vakinge.

the class BaseMybatisTest method testInsertSelective.

@Test
public void testInsertSelective() {
    UserEntity entity = buildUserEntity();
    userMapper.insertSelective(entity);
    userMapper.deleteByPrimaryKey(entity.getId());
}
Also used : UserEntity(com.mendmix.mybatis.test.entity.UserEntity) Test(org.junit.Test)

Example 5 with UserEntity

use of com.mendmix.mybatis.test.entity.UserEntity in project jeesuite-libs by vakinge.

the class BaseMybatisTest method buildUserEntity.

private UserEntity buildUserEntity() {
    String mobile = "13800" + RandomStringUtils.random(6, false, true);
    UserEntity entity = new UserEntity();
    entity.setEmail(mobile + "@163.com");
    entity.setMobile(mobile);
    entity.setType((short) 1);
    entity.setStatus((short) 1);
    return entity;
}
Also used : UserEntity(com.mendmix.mybatis.test.entity.UserEntity)

Aggregations

UserEntity (com.mendmix.mybatis.test.entity.UserEntity)10 Test (org.junit.Test)9 Date (java.util.Date)2 OrderBy (com.mendmix.common.model.OrderBy)1 PageParams (com.mendmix.common.model.PageParams)1 PageDataLoader (com.mendmix.mybatis.plugin.pagination.PageExecutor.PageDataLoader)1 HashMap (java.util.HashMap)1