package test.dao;

import cn.com.countrygarden.bi.main.dao.sys.RoleMapper;
import cn.com.countrygarden.bi.main.model.sys.Role;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import tk.mybatis.mapper.entity.Condition;

import java.util.ArrayList;
import java.util.List;

/**
 * package: test.dao
 * describe:
 * creat_user: lsl
 * creat_date: 2018/6/9
 * creat_time: 0:46
 **/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:/spring/applicationContext.xml")
public class TestRoleMapper {

    Logger logger= LoggerFactory.getLogger(getClass());

    @Autowired
    private RoleMapper roleMapper;

    @Test
    public void test(){
        Role role=new Role();
        role.setId(1);
        List<Role> select = roleMapper.select(role);
        logger.debug(select.size()+"");


        Condition condition=new Condition(Role.class);
        List<String> ids=new ArrayList<>();
        ids.add("1");
        ids.add("2");
        condition.createCriteria().andIn("id",ids);
        roleMapper.selectByCondition(condition);


    }

}
