|
|
@@ -12,13 +12,10 @@ import com.unissoft.common.ResultView;
|
|
12
|
12
|
import io.swagger.annotations.Api;
|
|
13
|
13
|
import io.swagger.annotations.ApiOperation;
|
|
14
|
14
|
import org.springframework.util.StringUtils;
|
|
15
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
16
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
17
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
18
|
|
-
|
|
19
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
15
|
+import org.springframework.web.bind.annotation.*;
|
|
20
|
16
|
|
|
21
|
17
|
import javax.annotation.Resource;
|
|
|
18
|
+import java.util.List;
|
|
22
|
19
|
import java.util.UUID;
|
|
23
|
20
|
|
|
24
|
21
|
/**
|
|
|
@@ -49,12 +46,28 @@ public class BasicDeviceClassifyController {
|
|
49
|
46
|
return ResultView.error();
|
|
50
|
47
|
}
|
|
51
|
48
|
}
|
|
|
49
|
+
|
|
|
50
|
+ @GetMapping("/getParentList")
|
|
|
51
|
+ @ApiOperation(value = "父级菜单列表", notes = "所有一级父级list")
|
|
|
52
|
+ public ResultView getParentList(String classifyName) {
|
|
|
53
|
+ try {
|
|
|
54
|
+ List<BasicDeviceClassify> list = basicDeviceClassifyService.getParentList(classifyName);
|
|
|
55
|
+ return ResultView.success(list);
|
|
|
56
|
+ } catch (Exception e) {
|
|
|
57
|
+ e.printStackTrace();
|
|
|
58
|
+ return ResultView.error();
|
|
|
59
|
+ }
|
|
|
60
|
+ }
|
|
|
61
|
+
|
|
52
|
62
|
@PostMapping("/save")
|
|
53
|
63
|
@ApiOperation(value = "保存/保存子分类", notes = "更新或保存")
|
|
54
|
64
|
public ResultView save(@RequestBody BasicDeviceClassify basicDeviceClassify) {
|
|
55
|
65
|
if (StringUtils.isEmpty(basicDeviceClassify.getId())) {
|
|
56
|
66
|
basicDeviceClassify.setId(UUID.randomUUID().toString());
|
|
57
|
67
|
basicDeviceClassify.setCreateTime(DateUtils.getDate());
|
|
|
68
|
+ if (StringUtils.isEmpty(basicDeviceClassify.getParentId())) {
|
|
|
69
|
+ basicDeviceClassify.setParentId("0");
|
|
|
70
|
+ }
|
|
58
|
71
|
}
|
|
59
|
72
|
boolean save = basicDeviceClassifyService.saveOrUpdate(basicDeviceClassify);
|
|
60
|
73
|
if (save)
|
|
|
@@ -64,5 +77,4 @@ public class BasicDeviceClassifyController {
|
|
64
|
77
|
}
|
|
65
|
78
|
|
|
66
|
79
|
|
|
67
|
|
-
|
|
68
|
80
|
}
|