xkcoding / spring-boot-demo

🚀一个用来深入学习并实战 Spring Boot 的项目。
https://parg.co/UZM
MIT License
33.17k stars 10.89k forks source link

[BUG] #242

Open whatmiss opened 2 years ago

whatmiss commented 2 years ago

测试模块:demo-orm-jpa 数据库的表有父子关系: CREATE TABLE orm_department ( id int NOT NULL AUTO_INCREMENT COMMENT '主键', name varchar(32) NOT NULL COMMENT '部门名称', superior int DEFAULT NULL COMMENT '上级id', levels int NOT NULL COMMENT '层级', order_no int NOT NULL DEFAULT '0' COMMENT '排序', create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', last_update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '上次更新时间', PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='Spring Boot Demo Orm 系列示例表

然后查询处理的结果会这样无限循环,这是为什么呢? 查询方式(两种):

// List departmentList = departmentDao.findDepartmentsByLevels(1); List departmentList = departmentDao.findAll(); ret.put("data", departmentList); return ret;

image

guxiren commented 2 years ago

您的邮件已收到!

hugqq commented 1 year ago

User类需要加个注解

/**

guxiren commented 1 year ago

您的邮件已收到!