package com.ylx.servicecategory.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ylx.common.core.domain.R;
import com.ylx.servicecategory.domain.ServiceCategory;
import com.ylx.servicecategory.domain.vo.ClientServiceCategoryVO;
import com.ylx.servicecategory.service.ServiceCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@RestController
@Api(tags = {"服务类目管理"})
@RequestMapping("/customer/service/category")
public class CustomerServiceCategoryController {

    @Resource
    private ServiceCategoryService serviceCategoryService;

    @PostMapping("page")
    @ApiOperation("客户端首页分页查询服务类目数据")
    public R<Page<ClientServiceCategoryVO>> page(Page<ServiceCategory> page) {
        Page<ClientServiceCategoryVO> pageData = this.serviceCategoryService.page(page);
        return R.ok(pageData);
    }

    @ApiOperation("客户端获取服务类目集合数据,用于更多、同城搭子页面")
    @GetMapping("/list")
    public R<List<ClientServiceCategoryVO>> listServiceCategory() {
        List<ClientServiceCategoryVO> list = this.serviceCategoryService.listServiceCategory();
        return R.ok(list);
    }
}
