Commit 2957b512 authored by 王果's avatar 王果

21080 添加设备时,设备品种可以为空进行提交,导致设备原本有品种提交了无品种数据的设备。

parent 3035bd99
......@@ -175,14 +175,17 @@ public class EquipmentCategoryController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "设备类别下是否有设备品种", notes = "设备类别下是否有设备品种")
@GetMapping(value = "/haveTree")
public ResponseModel<String> haveTree(@RequestParam(value = "code", required = false) String code) {
public ResponseModel<Object> haveTree(@RequestParam(value = "code", required = false) String code) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("count", "0");
if (ObjectUtils.isEmpty(code)) {
return ResponseHelper.buildResponse("0");
return ResponseHelper.buildResponse(jsonObject);
}
QueryWrapper<EquipmentCategory> queryWrapper = new QueryWrapper<>();
queryWrapper.likeRight("code", code.replaceAll("0+$", ""));
int count = equipmentCategoryServiceImpl.count(queryWrapper);
return ResponseHelper.buildResponse(count + "");
jsonObject.put("count", (count - 1) + "");
return ResponseHelper.buildResponse(jsonObject);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment