查询一个类,需要带出来其他两个类

投递简历Vo

@ApiModel(value="投递简历Vo")
public class SendResumeVo implements Serializable {// 省略其他属性@ApiModelProperty(value="招聘信息ID" )private   Long recruitId;@ApiModelProperty(value="招聘信息Vo" )private    RecruitVo recruitVo;//求职者ID@ApiModelProperty(value="求职者ID" )private Long userId;@ApiModelProperty(value="简历ID" )private Long resumeId;@ApiModelProperty(value="简历Vo" )private   ResumeVo resumeVo;
}

投递简历xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxx.mapper.SendResumeMapper"><!--投递简历Vo--><resultMap id="resultMap" type="com.xxx.entity.SendResumeVo"><id column="id" property="id"/><result column="company_id" property="companyId"/><result column="recruit_id" property="recruitId"/><result column="user_id" property="userId"/><result column="resume_id" property="resumeId"/><result column="status" property="status"/><result column="create_date" property="createDate"/><!--association column的id是对应查询片段中的变量,recruit_id是当前resultMap中查询的列名--><association property="recruitVo" select="com.xxx.mapper.RecruitMapper.selectOneVo" column="{id=recruit_id}" /><association property="resumeVo" select="com.xxx.mapper.ResumeMapper.selectOneVo" column="{id=resume_id}" /></resultMap><select id="selectPageSendResumeVo" resultMap="resultMap">SELECT省略...,resume_id,recruit_idFROMsend_resume AS sr<where>sr.user_id = #{userId} </where></select>
</mapper>```
#### 其他两个xml的片段
```xml<!--据说被引用的sql片段这里一定要写 parameterType="java.util.Map",实测不写也ok--><select id="selectOneVo" parameterType="java.util.Map" resultType="com.xxx.entity.RecruitVo">SELECT省略...FROMrecruit AS r<where><if test="id!=null">AND r.id=#{id}</if></where>LIMIT 1</select>
``````xml<!--据说被引用的sql片段这里一定要写 parameterType="java.util.Map",实测不写也ok--><select id="selectOneVo" parameterType="java.util.Map" resultType="com.xxx.entity.ResumeVo">SELECT省略...FROMresume AS r<where><if test="id!=null">AND r.id=#{id}</if></where>ORDER BY r.update_date DESCLIMIT 1</select>
```#### 查询结果json
```json
{"id": 1,"companyId": 1,"recruitId": 1,"recruitVo": {"id": 1,"companyId": 1,"companyName": "能力有限","companyType": "1","industryId": 0,"industryLabel": "","jobStationId": 2,"jobStationLabel": "印前","jobPosition": null,"jobAreaId": 0,"jobAreaLabel": "","hiringNumber": 0,"gender": "1","genderLabel": "男","educationLevel": "1","educationLevelLabel": "小学","workingYears": "1","workingYearsLabel": "一年及以下","salaryLevel": "3","salaryLevelLabel": "3000-4000元","endDate": "2020-02-02 00:00:00","jobRequirements": null,"jobDuties": null,"createDate": "2020-02-23 18:25:08","updateDate": "2020-02-23 18:40:33","viewCount": 2},"userId": 1,"resumeId": 1,"resumeVo": {"id": 1,"userId": 0,"name": "lzx","gender": "1","genderLabel": "男","birthDate": "2020-02-20 00:00:00","nativePlaceProvinceId": 0,"nativePlaceProvinceLabel": "","phone": "17051018721","photo": null,"img": null,"educationLevel": "1","educationLevelLabel": "小学","workingYears": "1","workingYearsLabel": "一年及以下","livingCityId": 0,"livingCityLabel": "","workingStatus": "1","workingStatusLabel": "在职,看看新计划","industryId": 0,"industryLabel": "","jobStationId": 0,"jobStationLabel": "","jobPosition": "wz","salaryLevel": "1","salaryLevelLabel": "2000元及以下","avatar": "http://aa.jpg","workExperience": "1","experienceDesc": null,"specialSkill": "","selfEvaluation": null,"introduce": "hfsjfsf","jobExpect": "ex","advantage": "1,2,3","advantageLabel": "形象好,气质佳,能出差","viewCount": 0,"inviteCount": 0,"createDate": "2020-02-23 16:53:07"},"status": "1","createDate": "2020-02-25 12:14:24"}```

MyBatis中的resultMap两个association相关推荐

  1. mybatis中的ResultMap使用

    mybatis中的ResultMap使用 文章目录 mybatis中的ResultMap使用 一.自动映射 二.手动映射 1.返回值类型为resultMap 2.编写resultMap,实现手动映射! ...

  2. mybatis中的resultMap,超详细讲解

    使用mybatis,有两个属性标签<resultType>.<resultMap>可以提供结果映射. 虽然resultType 属性在大部分情况下都够用,但是在一些特殊情况下无 ...

  3. 浅谈MyBatis中的resultMap(个人总结)

    官方文档:          mybatis – MyBatis 3 | XML 映射器https://mybatis.org/mybatis-3/zh/sqlmap-xml.html"re ...

  4. mybatis中的resultMap与resultType、parameterMap与 parameterType的区别

    Map:映射:Type:Java类型 resultMap 与 resultType.parameterMap 与  parameterType的区别在面试的时候被问到的几率非常高,项目中出现了一个小b ...

  5. mybatis中@Results,@ResultMap注解使用

    一.Results的用法 用法一: 当数据库字段名与实体类对应的属性名不一致时,可以使用@Results映射来将其对应起来.column为数据库字段名,porperty为实体类属性名,jdbcType ...

  6. Mybatis中强大的resultMap

    本文来说下mybatis中的resultMap,在平时的开发中resultType使用的比较多.resultType在解决一对一的关系时候比较方便,但是在设计到多对多的时候,使用resultMap比较 ...

  7. mybatis与php,浅谈mybatis中的#和$的区别

    浅谈mybatis中的#和$的区别 发布于 2016-07-30 11:14:47 | 236 次阅读 | 评论: 0 | 来源: 网友投递 MyBatis 基于Java的持久层框架MyBatis 本 ...

  8. Mybatis中强大的功能元素:resultMap

    转载自  Mybatis中强大的功能元素:resultMap 前言 在Mybatis中,有一个强大的功能元素resultMap.当我们希望将JDBC ResultSets中的数据,转化为合理的Java ...

  9. Mybatis中resultMap

    MyBatis中在查询进行select映射的时候,返回类型可以用resultType,也可以用resultMap,resultType是直接 表示返回类型的,而resultMap则是对外部Result ...

最新文章

  1. java 异或_Java之超级基础且实用的知识点
  2. Spring Boot中的缓存支持(一)注解配置与EhCache使用
  3. S3C2440 lds链接脚本解析
  4. Gym 101128A :Promotions (Southwestern Europe Regional Contest )
  5. 准备入手Macbook Pro
  6. CIO,你想做一辈子“消防员”吗?
  7. WPS 删除线快捷键
  8. 服务监管框架下的 IT 运维服务与绩效管理体系建设
  9. 图解大数据 | 大数据分析挖掘-Spark初步
  10. 51单片机复习:红外通信
  11. android后台定时执行任务,后台执行的定时任务
  12. java中将Fri Feb 19 17:32:34 CST 2021时间格式转为yyyy-MM-dd HH:mm:ss时间格式
  13. 创建服务器站点的步骤,如何自己建立网站 基本步骤和流程有哪些
  14. python nlp 句子提取_自然语言16.1_Python自然语言处理学习笔记之信息提取步骤分块(chunking)...
  15. 全球与中国医疗3D打印机市场深度研究分析报告
  16. 思维导图的优缺点与绘制思维导图方法
  17. 考研英一----2006年真题知识点总结
  18. 明明没PS,看起来却像PS过的32张照片
  19. CSDN BLOG技术专家群工作平台发布公告
  20. javafx label设置字体大小_如何把智能手机,设置成老年人模式?

热门文章

  1. 图形变换核心原理(平移、缩放、旋转,拉伸)
  2. 双软企业两免三减半政策
  3. 2021-04-28 Mac上插入公式的三种方法
  4. 从程序员到架构师的转型思维的转变 NLP思维利器(二)
  5. 百变郁锦香,开创新典范,深化全球战略布局成就国际高端酒店品质之选
  6. python 围棋按照坐标查找棋子_python 实现围棋游戏(纯tkinter gui)
  7. preg_replace() 函数
  8. 医院信息系统 固定资产管理子系统
  9. 为什么工作上处处帮助别人,从来不主动为难人,不批评人,换来的却是同事的不尊重?
  10. Unity3d开发之二十:闪电