Explorar el Código

1、报销类型传0表示未选择

dongpo hace 1 año
padre
commit
4c78e69ac9

+ 5 - 0
yudao-module-finance/yudao-module-expense-biz/src/main/java/cn/iocoder/yudao/module/expense/service/expensetype/ExpenseTypeServiceImpl.java

@@ -15,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@@ -100,6 +101,10 @@ public class ExpenseTypeServiceImpl implements ExpenseTypeService {
 
     @Override
     public List<ExpenseItemDO> getItemListByExpenseTypeId(Long expenseTypeId) {
+        if (expenseTypeId != null && expenseTypeId == 0L) {
+            // 约定:前端传0,表示未选择报销类型,此时费用项目返回空集合
+            return new ArrayList<>();
+        }
         return itemMapper.selectListByExpenseTypeId(expenseTypeId);
     }