eganwu 1 anno fa
parent
commit
09cd0d1adc

+ 4 - 1
src/custom/restcontroller/webmanage/saletool/sharematerial/LongPicText.java

@@ -218,8 +218,11 @@ public class LongPicText extends Controller {
         attachmentQuery.setWhere("ownertable", ownertable);
         attachmentQuery.setWhere("ownerid", sat_sharematerialid);
         attachmentQuery.setWhere("usetype", ownertable);
+        attachmentQuery.setOrderBy("t1.sequence");
+        System.err.println(attachmentQuery.getSQL());
         Rows attachmentRows = attachmentQuery.query();
 
+
         ArrayList<Long> ids = attachmentRows.toArrayList("attachmentid", new ArrayList<>());
 
         RowsMap attRowsMap = Attachment.get(this, ids).toRowsMap("attachmentid");
@@ -228,7 +231,7 @@ public class LongPicText extends Controller {
             Rows attPicRows = new Rows();
             Rows tempAttRows = attRowsMap.getOrDefault(row.getString("attachmentid"), new Rows());
             for (Row tempAttRow : tempAttRows) {
-                if (tempAttRow.getString("ownertable").equals(ownertable)) {
+                if (tempAttRow.getString("usetype").equals(ownertable)) {
                     attPicRows.add(tempAttRow);
                 }
             }