Kaynağa Gözat

成本报表 若查不到数据返回提示信息

liuchaohui 2 yıl önce
ebeveyn
işleme
bd65ed5d54

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/controller/SyCostAllocationController.java

@@ -94,11 +94,16 @@ public class SyCostAllocationController {
     public Result<?> queryByPlanNum(@RequestParam(name = "plannum", required = true) String plannum,
                                     @RequestParam(name = "type", required = true) String type) {
         SyCostAllocation syCostAllocation=new SyCostAllocation();
+        Result result = new Result();
         if (oConvertUtils.isEmpty(plannum)) {
             throw new JeecgBootException("计划号不能为空!");
         }
         if(type.equals("query")){
             syCostAllocation=syCostAllocationService.queryByPlanNum(plannum,type);
+            if(syCostAllocation==null){
+                result.setMessage("查找不到数据");
+                return result;
+            }
         }else if(type.equals("add")){
 
         }

+ 3 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/service/impl/SyCostAllocationServiceImpl.java

@@ -188,6 +188,9 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                 " LEFT JOIN Customer cc ON ss.cCusCode = cc.cCusCode" +
                 " WHERE c.cInvCcode like '19%' GROUP BY v.cVenName ";
         List<Map<String, Object>> list  = senYuDataSourceOne.queryForList(sqlQueryhard);
+        if(list.size()==0){
+            return null;
+        }
         List<JSONObject> jianSon = JsonChangeUtils.toJSONObject(list);
         syCostAllocation = JSONObject.toJavaObject(jianSon.get(0), SyCostAllocation.class);
         for (int i=0;i<jianSon.size();i++) {