Browse Source

回显数据字典防止空值报错

tags/v2.4.0
RuoYi 4 years ago
parent
commit
bcdf270bb0
  1. 9
      ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDictDataController.java

9
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDictDataController.java

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
package com.ruoyi.system.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody; @@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
@ -75,7 +77,12 @@ public class SysDictDataController extends BaseController @@ -75,7 +77,12 @@ public class SysDictDataController extends BaseController
@GetMapping(value = "/type/{dictType}")
public AjaxResult dictType(@PathVariable String dictType)
{
return AjaxResult.success(dictTypeService.selectDictDataByType(dictType));
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data))
{
data = new ArrayList<SysDictData>();
}
return AjaxResult.success(data);
}
/**

Loading…
Cancel
Save