package com.fs.qw.controller;

import java.util.List;
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.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.enums.BusinessType;
import com.fs.qw.domain.QwAppMiniProgramRelation;
import com.fs.qw.service.IQwAppMiniProgramRelationService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 应用-小程序关系Controller
 * 
 * @author fs
 * @date 2026-01-13
 */
@RestController
@RequestMapping("/qw/qwAppMiniProgramRelation")
public class QwAppMiniProgramRelationController extends BaseController
{
    @Autowired
    private IQwAppMiniProgramRelationService qwAppMiniProgramRelationService;

    /**
     * 查询应用-小程序关系列表
     */
    @PreAuthorize("@ss.hasPermi('qw:qwAppMiniProgramRelation:list')")
    @GetMapping("/list")
    public TableDataInfo list(QwAppMiniProgramRelation qwAppMiniProgramRelation)
    {
        startPage();
        List<QwAppMiniProgramRelation> list = qwAppMiniProgramRelationService.selectQwAppMiniProgramRelationList(qwAppMiniProgramRelation);
        return getDataTable(list);
    }

    /**
     * 导出应用-小程序关系列表
     */
    @PreAuthorize("@ss.hasPermi('qw:qwAppMiniProgramRelation:export')")
    @Log(title = "应用-小程序关系", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(QwAppMiniProgramRelation qwAppMiniProgramRelation)
    {
        List<QwAppMiniProgramRelation> list = qwAppMiniProgramRelationService.selectQwAppMiniProgramRelationList(qwAppMiniProgramRelation);
        ExcelUtil<QwAppMiniProgramRelation> util = new ExcelUtil<QwAppMiniProgramRelation>(QwAppMiniProgramRelation.class);
        return util.exportExcel(list, "应用-小程序关系数据");
    }

    /**
     * 获取应用-小程序关系详细信息
     */
    @PreAuthorize("@ss.hasPermi('qw:qwAppMiniProgramRelation:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(qwAppMiniProgramRelationService.selectQwAppMiniProgramRelationById(id));
    }

    /**
     * 新增应用-小程序关系
     */
    @PreAuthorize("@ss.hasPermi('qw:qwAppMiniProgramRelation:add')")
    @Log(title = "应用-小程序关系", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QwAppMiniProgramRelation qwAppMiniProgramRelation)
    {
        return toAjax(qwAppMiniProgramRelationService.insertQwAppMiniProgramRelation(qwAppMiniProgramRelation));
    }

    /**
     * 修改应用-小程序关系
     */
    @PreAuthorize("@ss.hasPermi('qw:qwAppMiniProgramRelation:edit')")
    @Log(title = "应用-小程序关系", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QwAppMiniProgramRelation qwAppMiniProgramRelation)
    {
        return toAjax(qwAppMiniProgramRelationService.updateQwAppMiniProgramRelation(qwAppMiniProgramRelation));
    }

    /**
     * 删除应用-小程序关系
     */
    @PreAuthorize("@ss.hasPermi('qw:qwAppMiniProgramRelation:remove')")
    @Log(title = "应用-小程序关系", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(qwAppMiniProgramRelationService.deleteQwAppMiniProgramRelationByIds(ids));
    }
}
