package com.sqx.modules.industry.controller;


import com.sqx.common.utils.Result;
import com.sqx.modules.industry.entity.Industry;
import com.sqx.modules.industry.service.IndustryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;

/**
 * <p>
 * 行业管理
 * </p>
 *
 * @author wuchang
 * @since 2023-01-14
 */
@RestController
@RequestMapping("/admin/industry/")
public class AdminIndustryController {

    @Autowired
    private IndustryService industryService;

    @ApiOperation("添加行业")
    @PostMapping("addIndustry")
    public Result addIndustry(Industry industry) {
        return industryService.addIndustry(industry);
    }

    @ApiOperation("修改行业")
    @PostMapping("updateIndustry")
    public Result updateIndustry(Industry industry) {
        return industryService.updateIndustry(industry);
    }

    @ApiOperation("获取行业列表")
    @GetMapping("adminGetIndustryList")
    public Result adminGetIndustryList(Integer page,Integer limit, Industry industry) {
        return Result.success().put("data", industryService.adminGetIndustryList(page,limit,industry));
    }

    @ApiOperation("删除行业")
    @PostMapping("deleteIndustry")
    public Result deleteIndustry(Long industryId) {
        return industryService.deleteIndustry(industryId);
    }


    @ApiOperation("获取行业列表")
    @GetMapping("getIndustryList")
    public Result getIndustryList(Industry industry) {
        return Result.success().put("data", industryService.getIndustryList(industry));
    }
}

