插入:
void insertMerchantBusiness(List<MerchantBusinessType> list);
<insert id="insertMerchantBusiness">
insert into t_merchant_business_type
(merchant_id, business_type_id)
values
<foreach item="item" collection="list" separator=",">
(#{item.merchantId}, #{item.businessTypeId})
</foreach>
</insert>
-----------------------------------------
查询:
List<Integer> selectBusinessTypeIds(List<String> type);
<select id="selectBusinessTypeIds" resultType="integer">
select id from t_business_type
where type in
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
</select>
------------------------------------------------------------
删除:
void deleteMerchantBusiness(int merchantId, List<Integer> types);
<delete id="deleteMerchantBusiness">
delete from t_merchant_business_type
where merchant_id = #{merchantId}
and business_type_id in
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
</delete>