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

import com.hc.business.service.AreaDistrictService;
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/front/areaDistrict")
public class FrontAreaDistrictController {

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

    public FrontAreaDistrictController(AreaDistrictService areaDistrictService) {
        this.areaDistrictService = areaDistrictService;
    }

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

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

}