Browse Source

添加排序

ecss-tx
shenzhouyu 3 weeks ago
parent
commit
1e84cec5ba
  1. 3
      src/main/java/com/xujie/sys/modules/orderIssure/entity/SOIssueNotifyHeaderData.java
  2. 16
      src/main/resources/mapper/orderIssure/IssureNotifyMapper.xml

3
src/main/java/com/xujie/sys/modules/orderIssure/entity/SOIssueNotifyHeaderData.java

@ -34,4 +34,7 @@ public class SOIssueNotifyHeaderData extends SOIssueNotifyHeader {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date needDate;
/** 为 true 时主表按派工单明细子表最早要求发料时间(needDate)升序排序 */
private Boolean orderByMinChildNeedDate;
}

16
src/main/resources/mapper/orderIssure/IssureNotifyMapper.xml

@ -175,6 +175,13 @@ RecordVersion,OutWorkOrderFlag,ProjectID,OrderType,AuthRuleID,bu)
left join sys_user b on a.UserName=b.username
left join eam_WorkShop c on b.workShopId=c.workShopId
LEFT JOIN SOIssueNotifyOrderList d on a.site=d.site and a.NotifyNo=d.NotifyNo and d.ItemNo = '1'
<if test="query.orderByMinChildNeedDate != null and query.orderByMinChildNeedDate">
LEFT JOIN (
SELECT site, NotifyNo, MIN(needDate) AS minChildNeedDate
FROM SOIssueNotifyOrderList
GROUP BY site, NotifyNo
) ol_need ON a.site = ol_need.site AND a.NotifyNo = ol_need.NotifyNo
</if>
<where>
<if test="query.notifyNo != null and query.notifyNo != ''">
@ -215,7 +222,14 @@ RecordVersion,OutWorkOrderFlag,ProjectID,OrderType,AuthRuleID,bu)
AND b.workShopId in ${query.workShopId}
</if>
</where>
order by a.NotifyNo
<choose>
<when test="query.orderByMinChildNeedDate != null and query.orderByMinChildNeedDate">
order by case when ol_need.minChildNeedDate is null then 1 else 0 end, ol_need.minChildNeedDate asc, a.NotifyNo
</when>
<otherwise>
order by a.NotifyNo
</otherwise>
</choose>
</select>
<select id="searchNotifyOrderList" resultType="SOIssueNotifyOrderListData">

Loading…
Cancel
Save