天天看點

mybatis根據list查詢,更新,删除

批量查詢,根據list條件

<select id="queryStkbalseList" resultMap="BaseResultMapVO">
         select
        <include refid="Base_Column_List"/>
        from cc_stkbale stkbale
        <where>
            <foreach collection="stkbalseDTOS" item="record" separator=" or ">
                (stkbale.ORG_ID=#{record.orgId} and stkbale.MANAGER_NO=#{record.managerNo} and
                stkbale.BUNDLE_NO=#{record.bundleNo})
            </foreach>
        </where>
</select>           
<update id="updateXsSalesRemarkPriceByList" parameterType="java.util.List">
	<foreach collection="list" item="item" index="index" open="" close="" separator=";">
		UPDATE xs_sales_item
		<set>
			remark_price= #{item.remarkPrice,jdbcType=DECIMAL},
			price= #{item.price,jdbcType=DECIMAL}
		</set>
		<where>
			sales_item_no = #{item.salesItemNo,jdbcType=VARCHAR}
		</where>
	</foreach>
</update>           
<select id="querySaleItemDataByIds"
		resultType="com.mountslink.platform.components.sale.sale.vo.SalesExamRegisterVo">
	select
	price_tax as salePrice,
	cg_price as purchasePrice,
	sales_item_no as salesItemNo
	from xs_sales_item
	<where>
		id in
		<foreach collection="ids" item="id" separator="," open="(" close=")">
			#{id}
		</foreach>
		and status != '00'
	</where>
</select>