Open whatmiss opened 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 系列示例表
orm_department
id
name
superior
levels
order_no
create_time
last_update_time
然后查询处理的结果会这样无限循环,这是为什么呢? 查询方式(两种):
// List departmentList = departmentDao.findDepartmentsByLevels(1); List departmentList = departmentDao.findAll(); ret.put("data", departmentList); return ret;
您的邮件已收到!
User类需要加个注解
/**
测试模块: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;