package com.sckw.system.controller;

import com.sckw.core.web.response.HttpResult;
import com.sckw.system.model.vo.req.FindAreaTreeReqVo;
import com.sckw.system.service.SysAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 行政区域
 * @author zk
 * @date 2023-05-30
 */
@RestController
@RequestMapping("/sysArea")
public class SysAreaController {

    @Autowired
    private SysAreaService sysAreaService;

    /**
     * @param params {pcode:父级编码}
     * @return
     * @description 查询
     * @author zk
     * @date 2023/5/30
     **/
    @PostMapping("/findList")
    public HttpResult findList(@RequestBody HashMap params) {
        List<Map<String, Object>> list = sysAreaService.findList(params);
        return HttpResult.ok(list);
    }

    /**
     * @param reqVo 当前区域code
     * @return HttpResult
     * @desc: 查区域树
     * @author: czh
     * @date: 2023/7/31
     */
    @PostMapping("/findTree")
    public HttpResult findTree(@RequestBody FindAreaTreeReqVo reqVo) {
        return HttpResult.ok(sysAreaService.findTree(reqVo));
    }

}
