Explorar el Código

mybatis 一对多 分步查询提交

zhang hace 2 años
padre
commit
e25692ad2a

+ 1 - 1
mybatis_train/src/main/java/com/mapper/AccountMapper.java

@@ -13,7 +13,7 @@ public interface AccountMapper {
13 13
     List<AccountEntity> findAll(Integer id);
14 14
     void updateOne(AccountEntity accountEntity);
15 15
     void insertOne(AccountEntity accountEntity);
16
-    AccountRealEntity findByDepId(Integer depId);
16
+    List<AccountRealEntity> findByDepId(Integer depId);
17 17
     // 多对一查询
18 18
     AccountVO findVO(Integer id);
19 19
     AccountVO findByStep(Integer id);

+ 1 - 0
mybatis_train/src/main/resources/com/mapper/DepartmentMapper.xml

@@ -18,6 +18,7 @@
18 18
         <result property="depName" column="dep_name"></result>
19 19
         <collection property="accountEntities"
20 20
                     select="com.mapper.AccountMapper.findByDepId"
21
+                    fetchType="lazy"
21 22
                     column="dep_id">
22 23
         </collection>
23 24
     </resultMap>