mybatis foreach list中的map

例1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<insert id="insertPlanProdsInfo" parameterType="java.util.ArrayList">

INSERT INTO PointPlan.dbo.T_D_PlanProdsInfo
(
GroupCD,
StoreMode,
PromotionCD,
ProductCD,
point
)
<foreach collection="list" item="info" separator="union all">
(
SELECT GroupCD
,0
,1
,#{info.ProductCD}
,#{info.Point}
FROM PointPlan.dbo.T_D_PlanInfo
WHERE ApplyCD=#{info.ApplyCD}
AND SubID=#{info.SubID}

)
</foreach>

</insert>

例2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<insert id="insertRewardMaster" parameterType="java.util.List">
<foreach collection="list" item="info" separator=";">
INSERT INTO PMCreator.dbo.R_RewardMaster
(
MasterStoreCode,
MaintenanceStoreMode,
PromotionCode,
Code,
OfferLevel,
RewardType,
RewardValue,
RewardLevelType,
ItemCode,
Department,
Tender_ID
)

(
SELECT m.MasterStoreCode,
0,
1,
MAX(Code)+1,
0,
6,
#{info.Point},
1,
#{info.ProductCD},
0,
0
FROM PMCreator.dbo.R_RewardMaster m
INNER JOIN PointPlan.dbo.T_D_PlanInfo p
ON m.MasterStoreCode=p.GroupCD
WHERE p.ApplyCD=#{info.ApplyCD}
AND p.SubID=#{info.subID}
GROUP BY m.MasterStoreCode
)

</foreach>

</insert>