xda il y a 2 ans
Parent
commit
f3be4399b9

+ 3 - 0
src/main/java/com/winhc/repal/model/bo/BillPageBO.java

@@ -52,4 +52,7 @@ public class BillPageBO {
     @ApiModelProperty(value = "关键词")
     private String keyword;
 
+    @ApiModelProperty(value = "总金额标识")
+    private Boolean totalFlag;
+
 }

+ 3 - 0
src/main/java/com/winhc/repal/service/impl/RepalBillServiceImpl.java

@@ -175,6 +175,7 @@ public class RepalBillServiceImpl extends ServiceImpl<RepalBillMapper, RepalBill
         BeanUtils.copyProperties(billPageBO, totalOverdueQueryBO);
         BeanUtils.copyProperties(billPageBO, totalSumBO);
         totalQueryBO.setOverdueStatus(Objects.isNull(dto.getOverdueStatus()) ? 6 : dto.getOverdueStatus());
+        totalQueryBO.setTotalFlag(false);
         if (Objects.isNull(dto.getOverdueStatus()) || OverdueStatusEnum.已逾期.getCode().equals(dto.getOverdueStatus())) {
             totalOverdueQueryBO.setOverdueStatus(OverdueStatusEnum.已逾期.getCode());
         }
@@ -185,8 +186,10 @@ public class RepalBillServiceImpl extends ServiceImpl<RepalBillMapper, RepalBill
         }
         totalMoneyBO = repalBillMapper.getTotalMoneyByGroup(totalQueryBO);
         if (OverdueStatusEnum.已逾期.getCode().equals(totalOverdueQueryBO.getOverdueStatus())) {
+            totalOverdueQueryBO.setTotalFlag(false);
             overdueBO = repalBillMapper.getTotalMoneyByGroup(totalOverdueQueryBO);
         }
+        totalSumBO.setTotalFlag(true);
         totalBO = repalBillMapper.getTotalMoneyByGroup(totalSumBO);
         infoVO.setTotalBillMoneyStr(totalMoneyBO.getTotalMoney().stripTrailingZeros().toPlainString());
         infoVO.setTotalBillCount(totalMoneyBO.getTotalCount());

+ 8 - 1
src/main/resources/mapper/RepalBillMapper.xml

@@ -88,7 +88,14 @@
     </select>
 
     <select id="getTotalMoneyByGroup" resultType="com.winhc.repal.model.bo.TotalMoneyBO" parameterType="com.winhc.repal.model.bo.BillPageBO">
-        SELECT IFNULL(SUM(bill.TOTAL_MONEY),0) AS totalMoney, COUNT(bill.ID) AS totalCount FROM REPAL_BILL AS bill
+        SELECT
+        <if test="totalFlag">
+            IFNULL(SUM(bill.TOTAL_MONEY),0) AS totalMoney, COUNT(bill.ID) AS totalCount
+        </if>
+        <if test="!totalFlag">
+            IFNULL(SUM(bill.RECEIVABLE),0) AS totalMoney, COUNT(bill.ID) AS totalCount
+        </if>
+        FROM REPAL_BILL AS bill
         <if test="!allFlag">
             LEFT JOIN REPAL_RESPONSIBLE_PERSON AS person ON person.REPAL_BILL_ID = bill.ID
         </if>