Mybatis-plus:单表使用关联查询+ResultMap结果映射
一:数据表与实体类
数据表
DROP TABLE IF EXISTS `security_edu_info_type`;
CREATE TABLE `security_edu_info_type` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`keyName` char(12) DEFAULT NULL COMMENT 'key名称',
`valueName` char(64) DEFAULT NULL COMMENT '值名称',
`stage` char(32) DEFAULT NULL COMMENT '读书的年级或阶段',
`stageType` int(1) DEFAULT NULL,
`fieldType` char(64) DEFAULT NULL COMMENT '字段类型 1=currentStudy 2=educationType',
`description` char(64) DEFAULT NULL COMMENT '描述',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=389 DEFAULT CHARSET=utf8 COMMENT='用户 - 教育背景 - 字段区分表(对currentStudy、educationType进行区分)';
-- ----------------------------
-- Records of security_edu_info_type
-- ----------------------------
INSERT INTO `security_edu_info_type` VALUES ('364', '1', '7年级', '高中', '1', 'currentStudy', '目前就读');
INSERT INTO `security_edu_info_type` VALUES ('365', '2', '8年级', '高中', '1', 'currentStudy', '目前就读');
INSERT INTO `security_edu_info_type` VALUES ('366', '3', '9年级', '高中', '1', 'currentStudy', '目前就读');
INSERT INTO `security_edu_info_type` VALUES ('367', '4', '10年级', '高中', '1', 'currentStudy', '目前就读');
INSERT INTO `security_edu_info_type` VALUES ('368', '5', '11年级', '高中', '1', 'currentStudy', '目前就读');
INSERT INTO `security_edu_info_type` VALUES ('369', '6', '12年级', '高中', '1', 'currentStudy', '目前就读');
INSERT INTO `security_edu_info_type` VALUES ('370', '7', '大一', '本科', '2', 'currentStudy', '目前就读');
INSERT INTO `security_edu_info_type` VALUES ('371', '8', '大二', '本科', '2', 'currentStudy', '目前就读');
INSERT INTO `security_edu_info_type` VALUES ('372', '9', '大三', '本科', '2', 'currentStudy', '目前就读');
INSERT INTO `security_edu_info_type` VALUES ('373', '10', '大四', '本科', '2', 'currentStudy', '目前就读');
INSERT INTO `security_edu_info_type` VALUES ('374', '11', '研一', '研究生', '3', 'currentStudy', '目前就读');
INSERT INTO `security_edu_info_type` VALUES ('375', '12', '研二', '研究生', '3', 'currentStudy', '目前就读');
INSERT INTO `security_edu_info_type` VALUES ('376', '0', '暂无', '博士', '4', 'currentStudy', '目前就读');
INSERT INTO `security_edu_info_type` VALUES ('377', '0', '暂无', '高中', '1', 'educationType', '获得学历类型');
INSERT INTO `security_edu_info_type` VALUES ('378', '1', '国内高中文凭', '本科', '2', 'educationType', '获得学历类型');
INSERT INTO `security_edu_info_type` VALUES ('379', '2', 'IB', '本科', '2', 'educationType', '获得学历类型');
INSERT INTO `security_edu_info_type` VALUES ('380', '3', 'GED', '本科', '2', 'educationType', '获得学历类型');
INSERT INTO `security_edu_info_type` VALUES ('381', '4', 'IGCSE', '本科', '2', 'educationType', '获得学历类型');
INSERT INTO `security_edu_info_type` VALUES ('382', '0', '其他', '本科', '2', 'educationType', '获得学历类型');
INSERT INTO `security_edu_info_type` VALUES ('383', '4', '专科'