话不多说,直接贴sql。
一、入参是列表,出参要返回入参中对应的数据
SELECT
DATA_VALUE dataValue,
NUMBER number,
PARAM param,
CASE
<foreach collection="list" 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="list" 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="list" item="item" open="(" close=")" separator=",">
LEFT(#{item.param}, 4)
</foreach>
AND NUMBER IN
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item.number}
</foreach>