a.id AS "id", a.productArchiveId AS "productArchiveId", a.title AS "title", a.type AS "type", a.addTime AS "addTime", if(a.type=2,cf.ossName,ifnull(cf.waterOssName,cf.ossName)) as ossName, cf.fileName, cf.uploadTime, if(a.type=2,cf.ossUrl,ifnull(cf.waterOssUrl,cf.ossUrl)) as ossUrl left join cm_product_archive_file cf on a.id = cf.archiveContentId and a.type != 1 INSERT INTO cm_product_archive_content( productArchiveId, title, type, addTime ) VALUES ( #{productArchiveId}, #{title}, #{type}, now() ) insert into cm_product_archive_file(archiveContentId, fileName, ossName, ossUrl, waterOssName, waterOssUrl, uploadTime) values (#{archiveContentId}, #{fileName}, #{ossName}, #{ossUrl}, #{waterOssName}, #{waterOssUrl}, now()) UPDATE cm_product_archive_content SET title = #{title} WHERE id = #{id} update cm_product_archive_file set archiveContentId = #{archiveContentId} where id = #{fileId} update cm_product_archive_file set waterOssName = #{waterOssName}, waterOssUrl = #{waterOssUrl} where id = #{id} DELETE FROM cm_product_archive_content WHERE id = #{id} delete from cm_product_archive_file where archiveContentId = #{archiveContentId}