package com.ruoyi.mall.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
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.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.mall.domain.MallLinkIndustryCareer;
import com.ruoyi.mall.service.IMallLinkIndustryCareerService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 行业与职业关联Controller
 * 
 * @author LCL
 * @date 2023-10-20
 */
@RestController
@RequestMapping("/mall/mallLinkIndustryCareer")
public class MallLinkIndustryCareerController extends BaseController
{
    @Autowired
    private IMallLinkIndustryCareerService mallLinkIndustryCareerService;

    /**
     * 查询行业与职业关联列表
     */
    @PreAuthorize("@ss.hasPermi('mall:mallLinkIndustryCareer:list')")
    @GetMapping("/list")
    public TableDataInfo list(MallLinkIndustryCareer mallLinkIndustryCareer)
    {
        startPage();
        List<MallLinkIndustryCareer> list = mallLinkIndustryCareerService.selectMallLinkIndustryCareerList(mallLinkIndustryCareer);
        return getDataTable(list);
    }

    /**
     * 导出行业与职业关联列表
     */
    @PreAuthorize("@ss.hasPermi('mall:mallLinkIndustryCareer:export')")
    @Log(title = "行业与职业关联", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MallLinkIndustryCareer mallLinkIndustryCareer)
    {
        List<MallLinkIndustryCareer> list = mallLinkIndustryCareerService.selectMallLinkIndustryCareerList(mallLinkIndustryCareer);
        ExcelUtil<MallLinkIndustryCareer> util = new ExcelUtil<MallLinkIndustryCareer>(MallLinkIndustryCareer.class);
        util.exportExcel(response, list, "行业与职业关联数据");
    }

    /**
     * 获取行业与职业关联详细信息
     */
    @PreAuthorize("@ss.hasPermi('mall:mallLinkIndustryCareer:query')")
    @GetMapping(value = "/{linkId}")
    public AjaxResult getInfo(@PathVariable("linkId") Long linkId)
    {
        return AjaxResult.success(mallLinkIndustryCareerService.selectMallLinkIndustryCareerByLinkId(linkId));
    }

    /**
     * 新增行业与职业关联
     */
    @PreAuthorize("@ss.hasPermi('mall:mallLinkIndustryCareer:add')")
    @Log(title = "行业与职业关联", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MallLinkIndustryCareer mallLinkIndustryCareer)
    {
        return toAjax(mallLinkIndustryCareerService.insertMallLinkIndustryCareer(mallLinkIndustryCareer));
    }

    /**
     * 修改行业与职业关联
     */
    @PreAuthorize("@ss.hasPermi('mall:mallLinkIndustryCareer:edit')")
    @Log(title = "行业与职业关联", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MallLinkIndustryCareer mallLinkIndustryCareer)
    {
        return toAjax(mallLinkIndustryCareerService.updateMallLinkIndustryCareer(mallLinkIndustryCareer));
    }

    /**
     * 删除行业与职业关联
     */
    @PreAuthorize("@ss.hasPermi('mall:mallLinkIndustryCareer:remove')")
    @Log(title = "行业与职业关联", businessType = BusinessType.DELETE)
	@DeleteMapping("/{linkIds}")
    public AjaxResult remove(@PathVariable Long[] linkIds)
    {
        return toAjax(mallLinkIndustryCareerService.deleteMallLinkIndustryCareerByLinkIds(linkIds));
    }
}
