delete from student_instrument
where id_ = #{id}
insert into student_instrument
(student_id_,organ_id_,goods_id_,goods_category_id_,goods_category_name_,goods_name_,goods_brand_,specification_,goods_img_,
status_,order_id_,change_order_id_,operation_, start_time_, end_time_, create_time_, update_time
)
values
(#{studentId},#{organId},#{goodsId},#{goodsCategoryId},#{goodsCategoryName},#{goodsName},#{goodsBrand},#{specification},#{goodsImg},
#{status},#{orderId},#{changeOrderId},#{operation}, #{startTime}, #{endTime}, NOW(), NOW()
)
update student_instrument
student_id_ = #{studentId},
organ_id_ = #{organId},
goods_id_ = #{goodsId},
goods_name_ = #{goodsName},
goods_brand_ = #{goodsBrand},
specification_ = #{specification},
goods_img_ = #{goodsImg},
status_ = #{status},
operation_ = #{operation},
start_time_ = #{startTime},
end_time_ = #{endTime},
change_order_id_ = #{changeOrderId},
create_time_ = #{createTime},
del_flag_ = #{delFlag},
update_time = NOW(),
where id_ = #{id}
AND si.student_id_ = #{studentId}
AND FIND_IN_SET(si.organ_id_,#{organId})
AND si.goods_id_ = #{goodsId}
AND si.goods_category_id_ = #{goodsCategoryId}
AND si.goods_brand_ LIKE CONCAT('%',#{goodsBrand},'%')
AND si.specification_ LIKE CONCAT('%',#{specification},'%')
AND si.status_ = #{status}
AND (si.student_id_ = #{search} OR su.phone_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%'))
AND si.del_flag_ = 0
insert into student_instrument
(student_id_,organ_id_,goods_id_,goods_category_id_,goods_category_name_,goods_name_,goods_brand_,specification_,goods_img_,
order_id_,change_order_id_,status_, start_time_, end_time_, create_time_, update_time)
VALUE
(#{item.studentId},#{item.organId},#{item.goodsId},#{item.goodsCategoryId},#{item.goodsCategoryName},#{item.goodsName},#{item.goodsBrand},#{item.specification},#{item.goodsImg},
#{item.orderId},#{item.changeOrderId},#{item.status}, #{item.startTime},
#{item.endTime}, NOW(), NOW())