package com.usky.system.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.system.domain.HceCategory;
import com.usky.system.service.HceCategoryService;
import com.usky.system.service.vo.HceCategoryListVO;
import com.usky.system.service.vo.HceCategoryVO;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 * 帮助中心_栏目管理 前端控制器
 * </p>
 *
 * @author han
 * @since 2023-08-29
 */
@RestController
@RequestMapping("/hceCategory")
public class HceCategoryController {

    @Autowired
    private HceCategoryService hceCategoryService;

    /**
     * 帮助中心-栏目管理列表
     *
     * @param hceCategoryVO
     * @return
     */
    @PostMapping("page")
    public ApiResult<List<HceCategoryListVO>> page(@RequestBody HceCategoryVO hceCategoryVO){
        return ApiResult.success(hceCategoryService.page(hceCategoryVO));
    }

    /**
     * 帮助中心-栏目管理列表白名单
     *
     * @param hceCategoryVO
     * @return
     */
    @PostMapping("pageWhite")
    public ApiResult<List<HceCategoryListVO>> pageWhite(@RequestBody HceCategoryVO hceCategoryVO){
        return ApiResult.success(hceCategoryService.pageWhite(hceCategoryVO));
    }

    /**
     * 帮助中心-栏目管理新增
     * @param hceCategory
     * @return
     */
    @PostMapping
    ApiResult<Void> add(@RequestBody HceCategory hceCategory){
        hceCategoryService.add(hceCategory);
        return ApiResult.success();
    }

    /**
     * 帮助中心-栏目管理更新
     * @param hceCategory
     * @return
     */
    @PutMapping
    ApiResult<Void> update(@RequestBody HceCategory hceCategory){
        hceCategoryService.update(hceCategory);
        return ApiResult.success();
    }

    /**
     * 帮助中心-栏目管理删除
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    ApiResult<Void> remove(@PathVariable("id") Integer id){
        hceCategoryService.remove(id);
        return ApiResult.success();
    }

}

