package com.pj.project.tb_district;


import com.pj.utils.sg.AjaxJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * Controller: tb_district -- 全国地区表
 *
 * @author qzyReal
 */
@RestController
@RequestMapping("/TbDistrict/")
public class TbDistrictController {

    /**
     * 底层 Service 对象
     */
    @Autowired
    TbDistrictService tbDistrictService;


    /**
     * 查 - 根据id
     */
    @RequestMapping("getById")
    public AjaxJson getById(Integer id) {
        TbDistrict t = tbDistrictService.getById(id);
        return AjaxJson.getSuccessData(t);
    }

    @RequestMapping(value = "getTreeData")
    public AjaxJson getTreeData() {
        List<TbDistrict> list = tbDistrictService.getTreeData();
        return AjaxJson.getSuccessData(list);
    }

    // ------------------------- 前端接口 -------------------------





}
