xieb
2023-04-26 02f970afdfd9dbf1f8f1ace7ab3712b51b0c583f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package cn.gistack.sm.sjztmd.controller;
 
import cn.gistack.sm.exam.entity.ExamPlan;
import cn.gistack.sm.sjztmd.entity.AttAdBase;
import cn.gistack.sm.sjztmd.service.IAttAdBaseService;
import cn.gistack.sm.sjztmd.vo.AttAdBaseVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
 
import java.util.List;
import java.util.Map;
 
/**
 * @ClassName AttAdBaseController
 * @Description TODO
 * @Author aix
 * @Date 2023/4/21 20:09
 * @Version 1.0
 */
@Slf4j
@Api(tags = "中台行政区划")
@RestController
@RequestMapping("/sjztmd/attad")
@AllArgsConstructor
public class AttAdBaseController extends BladeController {
 
    private final IAttAdBaseService attAdBaseService;
 
    @ApiOperation(value = "中台行政区划-分页列表查询", notes = "中台行政区划-分页列表查询")
    @GetMapping(value = "/list")
    public R queryPageList(AttAdBase attAdBase, Query query) {
        IPage<AttAdBase> pageList = attAdBaseService.page(Condition.getPage(query), Condition.getQueryWrapper(attAdBase));
        return R.data(pageList);
    }
 
    /**
     * 懒加载列表 懒加载待优化
     */
    @GetMapping("/lazy-tree")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "code", value = "区划编号", paramType = "query", dataType = "string"),
        @ApiImplicitParam(name = "name", value = "区划名称", paramType = "query", dataType = "string")
    })
    @ApiOperation(value = "懒加载列表", notes = "传入code")
    public R<List<AttAdBaseVO>> lazyTree(String parentCode, @ApiIgnore @RequestParam Map<String, Object> obj) {
        List<AttAdBaseVO> list = attAdBaseService.lazyTree(parentCode, obj);
        return R.data(listNodeLazyVO(list));
    }
 
    private List<AttAdBaseVO> listNodeLazyVO(List<AttAdBaseVO> list) {
        return ForestNodeMerger.merge(list);
    }
 
}