import com.house365.beans.vo.User;
import com.house365.common.searchBeans.CommonSearchResponse;
import com.house365.common.searchBeans.QueryParams;
import com.house365.dao.UserMapper;
import com.house365.service.impl.UserService;
import org.apache.commons.collections.map.HashedMap;
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.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Date: 2016/12/15</p>
 *
 * @author XN
 * @version 1.0
 */
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@Transactional
@SpringApplicationConfiguration(MyBatis331Test.class)
public class MyBatis331Test {
    private Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private UserService userService;

    @Test
    public void testGetArea() {
        Map<String, Object> map = new HashedMap();
        map.put("GT_id", 2);

        QueryParams<User> queryParams = new QueryParams<>();
        queryParams.setSearchParams(map);
        queryParams.setOrderColumn("id");
        queryParams.setOrderMode("desc");

        CommonSearchResponse<User> list = userService.queryByPage(queryParams);
        if (list != null) {
            logger.info("user size===={}", list.getObjectList().size());
        }
    }

}
