话不多说,直接贴sql。
一、入参是列表,出参要返回入参中对应的数据
SELECT
DATA_VALUE dataValue,
NUMBER number,
PARAM param,
CASE
<foreach collection="mapList" item="item" open="" close="" separator=",">
WHEN NUMBER = #{item.number} AND PARAM = LEFT(#{item.param}, 4) THEN #{item.vo}
</foreach>
ELSE '0'
END vo,
CASE
<foreach collection="mapList" item="item" open="" close="" separator=",">
WHEN NUMBER = #{item.number} AND PARAM = LEFT(#{item.param}, 4) THEN #{item.id}
</foreach>
ELSE '0'
END id
FROM
${tableName}
WHERE
PARAM IN
<foreach collection="mapList" item="item" open="(" close=")" separator=",">
LEFT(#{item.param}, 4)
</foreach>
AND NUMBER IN
<foreach collection="mapList" item="item" open="(" close=")" separator=",">
#{item.number}
</foreach>
本文地址:https://blog.csdn.net/qq_36897177/article/details/108998180