Index: ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/service/RecyclingRecordListSqlGenerator.java =================================================================== diff -u -r37341 -r37496 --- ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/service/RecyclingRecordListSqlGenerator.java (.../RecyclingRecordListSqlGenerator.java) (revision 37341) +++ ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/service/RecyclingRecordListSqlGenerator.java (.../RecyclingRecordListSqlGenerator.java) (revision 37496) @@ -271,10 +271,12 @@ if(CssdUtils.getSystemSetConfigByNameBool("confirmRecyclingAmount",false)){ recyclingAmountNeedConfirmOrder = "case r.recycleAmountNeedConfirm when '" + Constants.STR_YES + "' then 0 else 1 end,"; } + String tousseMaterialsLostMustConfirmOrder = CssdUtils.getSystemSetConfigByNameBool("tousseMaterialsLostMustConfirm", false)? + "case when r.status='"+ RecyclingRecord.STATUS_UNCONFIRMED +"' then 0 else 1 end,":""; if (dbConnection.isSqlServer()) { sql = " SELECT * FROM (SELECT " + " r.*,p.applicationTime, p.type,p.remark,p.submitTime,p.recyclingStatus,p.specialInfection,p.operationRoom,p.patient,p.hospitalNumber,p.serialNumber,p.applicant "+ extraQuery +" " - + ",ROW_NUMBER() OVER (order by " +recyclingAmountNeedConfirmOrder+" r.recyclingTime desc,r.id desc) AS RowNum " + + ",ROW_NUMBER() OVER (order by " +tousseMaterialsLostMustConfirmOrder +recyclingAmountNeedConfirmOrder+" r.recyclingTime desc,r.id desc) AS RowNum " + "FROM " + RecyclingRecord.class.getSimpleName() + " r left join " + InvoicePlan.class.getSimpleName() + " p on r.recyclingApplication_id = p.id " + joinSqlOfUrgent + "where r.orgUnitCoding = '" @@ -291,7 +293,7 @@ + "' and " + filterSql + groupBySql - + " order by " + recyclingAmountNeedConfirmOrder+" r.recyclingTime desc) A WHERE ROWNUM <= " + + " order by " + tousseMaterialsLostMustConfirmOrder + recyclingAmountNeedConfirmOrder+" r.recyclingTime desc) A WHERE ROWNUM <= " + end + ")WHERE RN >= " + start; }