Browse Source

商品新增或编辑bug修复

eganwu 1 year ago
parent
commit
dfdbd74ea5
1 changed files with 14 additions and 0 deletions
  1. 14 0
      src/custom/restcontroller/webmanage/saletool/fad/FadGoods.java

+ 14 - 0
src/custom/restcontroller/webmanage/saletool/fad/FadGoods.java

@@ -111,9 +111,23 @@ public class FadGoods extends Controller {
 
         }
 
+        Rows attachmentRows = Attachment.get(this, "sa_fadid", sa_fadid);
+
         sa_fadids.add(sa_fadid);
         for (Long id : sa_fadids) {
             listSQL.add(FadHelper.getIsOnSalesUpdateSQL(this, id).getSQL());
+            for (Row attachmentRow : attachmentRows) {
+                InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sys_attachment_links");
+                insertSQL.setSiteid(siteid);
+                insertSQL.setUniqueid(createTableID("sys_attachment_links"));
+                insertSQL.setValue("usetype", attachmentRow.getString("usetype"));
+                insertSQL.setValue("attachmentid", attachmentRow.getLong("attachmentid"));
+                insertSQL.setValue("sequence", 1);
+                insertSQL.setValue("ownertable", sa_fad);
+                insertSQL.setValue("ownerid", id);
+                insertSQL.setWhere("not exists(select 1 from  sys_attachment_links where attachmentid=" + attachmentRow.getLong("attachmentid") + " and ownertable='sa_fad' and siteid='" + siteid + "' and ownerid=" + id + " )");
+                listSQL.add(insertSQL.getSQL());
+            }
         }
         //上下架
         dbConnect.runSqlUpdate(listSQL);