mybatis-plus 关联子表查询

单个实体关联查询:

<resultMap id="transactionResultMapEmpower" type="com.xxxx.dal.dataobject.transaction.TransactionDO2" >

<id property="id" column="id"/>

<result property="traderUnitsName" column="trader_units_name"/>

<result property="transactionAmount" column="transaction_amount"/>

<result property="transactionDate" column="transaction_date"/>

<result property="transactionStatus" column="transaction_status"/>

<result property="transactionApplicationTime" column="transaction_application_time"/>

<result property="transactionApplicationUnitName" column="transaction_application_unit_name"/>

<result property="valueEvaluationType" column="value_evaluation_type"/>

<result column="result_id" jdbcType="INTEGER" property="resultId" />

<association property="resultinfoDO"

javaType="com.xxxx.dal.dataobject.resultinfo.ResultinfoDO"

column="result_id"

select="com.ixxxx.dal.mysql.resultinfo.ResultinfoMapper.selectById"

fetchType="eager" >

</association>

</resultMap>

设置mybatis二级缓存策略:

添加一个属性fetchType="eager" (急加载)

集合查询:

<collection property="roles" ofType="Role"

select="com.jd.wms.mapper.RoleMapper.selectRolesByEmployeeId" column="id">

</collection>

相关推荐
气π8 小时前
【JavaWeb】——(若依 + AI)-基础学习笔记
java·spring boot·笔记·学习·java-ee·mybatis·ruoyi
Ai东10 小时前
[特殊字符] xbatis:重新定义 MyBatis 开发体验
mybatis
期待のcode14 小时前
Springboot多数据源配置
java·数据库·spring boot·后端·mybatis
计算机学姐15 小时前
基于SSM的网上花店销售系统【2026最新】
java·vue.js·mysql·java-ee·tomcat·intellij-idea·mybatis
TimberWill17 小时前
Mybatis一、二级缓存解析
mybatis
期待のcode1 天前
Wrapper体系中的condition参数
java·spring boot·后端·mybatis
期待のcode2 天前
MyBatis-Plus的Wrapper核心体系
java·数据库·spring boot·后端·mybatis
期待のcode2 天前
Springboot数据层开发—Springboot整合JdbcTemplate和Mybatis
spring boot·后端·mybatis
在坚持一下我可没意见2 天前
Spring 开发小白学习过程中常用通用配置文件,即拿即用!(持续更新中)
java·数据库·后端·学习·spring·tomcat·mybatis
m0_740043732 天前
SpringBoot03-Mybatis框架入门
java·数据库·spring boot·sql·spring·mybatis