package com.hc.web.controller.browser.app;

import com.hc.business.service.ZccmAreaDistrictService;
import com.hc.core.utils.result.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * (AreaDistrict)表控制层
 *
 * @author java
 * @since 2020-11-20 16:06:50
 */

@RestController
@RequestMapping("/new//api/app/areaDistrict")
public class AppAreaDistrictController {

    /**
     * 服务对象
     */
    private final ZccmAreaDistrictService areaDistrictService;

    public AppAreaDistrictController(ZccmAreaDistrictService areaDistrictService) {
        this.areaDistrictService = areaDistrictService;
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "依据主键获取 AreaDistrict", response = Result.class)
    public Result selectAppAreaDistrict(@PathVariable("id") Integer id) {
        return Result.success(areaDistrictService.queryById(id));
    }

    @GetMapping("/list")
    @ApiOperation(value = "获取 AreaDistrict列表(分页)", response = Result.class)
    public Result listAppAreaDistrict(@RequestParam(defaultValue = "0") Integer page,
                                      @RequestParam(defaultValue = "0") Integer size) {
        return Result.success(areaDistrictService.queryAllByLimit(page, size));
    }

}