<select id="hejiByHeadIds" parameterType="Map" resultMap="ExchangeBillResult">
SELECT IFNULL(SUM(cash), 0)cash , IFNULL(SUM(oilTicket),0)oilTicket , IFNULL(SUM(unionpay),0)unionpay , IFNULL(SUM(youhui),0)youhui
from t_jyz_z_exchange_bill
<where>
<if test="baoBiaoHead_ids!=null ">
and headId in
<foreach item="i" collection="baoBiaoHead_ids" open="(" separator="," close=")" >
#{i}
</foreach>
</if>
</where>
</select>
如果参数不是map 是直接一个list可以按下这个写。
<select id="getHeji" parameterType="java.util.List" resultType="java.lang.Integer">
SELECT SUM(month_value) FROM t_record_value
<where>
<if test="arg0 != null and arg0.size() > 0">
AND record_head_id IN
<foreach item="item" collection="arg0" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>站长微信:xiaomao0055
站长QQ:14496453