2 Star 1 Fork 0

wpfc / websocket

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
MybatisTest.java 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
wpfc 提交于 2018-02-23 15:13 . mybatis collection
package cn.dq;
import java.util.List;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import cn.edu.ntu.entity.Area;
import cn.edu.ntu.entity.User;
import cn.edu.ntu.mapper.AreaMapper;
import cn.edu.ntu.mapper.UserMapper;
import cn.edu.ntu.utils.JsonUtils;
public class MybatisTest {
@Test
public void test(){
ApplicationContext application = new ClassPathXmlApplicationContext("classpath*:spring/applicationContext.xml");
UserMapper userMapper = application.getBean(UserMapper.class);
User user = userMapper.selectByPrimaryKey(1L);
System.out.println("username : " + user.getUserName());
AreaMapper areaMapper = application.getBean(AreaMapper.class);
List<Area> areaList = areaMapper.queryCity();
System.out.println(areaList.size());
System.out.println(areaList.get(0).getSubAreas().size());
System.out.println(JsonUtils.objectToJson(areaList));
// MongoTemplate mongoTemplate = application.getBean(MongoTemplate.class);
// System.out.println(mongoTemplate);
// long count = mongoTemplate.count(new Query(Criteria.where("zan").is(0)), "form");
// System.out.println("documents count : " + count);
}
}
1
https://gitee.com/wpfc/websocket.git
git@gitee.com:wpfc/websocket.git
wpfc
websocket
websocket
master

搜索帮助