INSERT INTO OrderOwnGoods ( orderOwnGoodsId, orderInfoId, goodsId, years, startTime, endTime, price, amount , areaid ) Values ( #{orderOwnGoodsId}, #{orderInfoId}, #{goodsId}, #{years}, #{startTime}, #{endTime}, #{price}, #{amount} , #{areaid} ) UPDATE OrderOwnGoods SET orderOwnGoodsId = #{orderOwnGoodsId}, orderInfoId = #{orderInfoId}, goodsId = #{goodsId}, years = #{years}, startTime = #{startTime}, endTime = #{endTime}, price = #{price}, amount = #{amount} , areaid = #{areaid} where orderOwnGoodsId=#{orderOwnGoodsId} INSERT INTO OrderOwnGoods ( orderOwnGoodsId , orderInfoId , goodsId , years , startTime , endTime , price , amount , areaid ) SELECT nextval('seq_orderOwnGoodsId') , #{orderInfoId} , #{goodsId} , 0 , #{startTime}, #{endTime} , 0 , 0 , #{areaid} INSERT INTO OrderOwnGoods ( orderOwnGoodsId, orderInfoId, goodsId, years, startTime, endTime, price, amount , areaid ) Values ( #{item.orderOwnGoodsId}, #{item.orderInfoId}, #{item.goodsId}, #{item.years}, #{item.startTime}, #{item.endTime}, #{item.price}, #{item.amount} , #{item.areaid} ) UPDATE OrderOwnGoods SET years = #{newYears},endTime = ( endTime - interval ' ${refundYears} year '),price=#{price},amount=#{amount} where orderinfoid = #{orderInfoId} and areaid = #{areaId}