package com.flossom.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.flossom.common.core.domain.entity.WxInstrumentTag;
import com.flossom.common.core.domain.req.WxInstrumentTagReq;
import com.flossom.common.core.utils.poi.ExcelUtil;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.domain.AjaxResult;
import com.flossom.common.core.web.page.TableDataInfo;
import com.flossom.common.log.annotation.Log;
import com.flossom.common.log.enums.BusinessType;
import com.flossom.common.security.annotation.RequiresPermissions;
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.flossom.system.service.IWxInstrumentTagService;

/**
 * 仪器标签关联Controller
 *
 * @author flossom
 * @date 2024-01-24
 */
@RestController
@RequestMapping("/instrumentTag")
public class WxInstrumentTagController extends BaseController {

    @Autowired
    private IWxInstrumentTagService wxInstrumentTagService;

    /**
     * 查询仪器标签关联列表
     */
    @RequiresPermissions("system:tag:list")
    @GetMapping("/list")
    public AjaxResult list(WxInstrumentTag wxInstrumentTag) {
        return AjaxResult.success(wxInstrumentTagService.selectWxInstrumentTagList(wxInstrumentTag));
    }

    /**
     * 新增仪器标签关联
     */
    @PostMapping("/add")
    public AjaxResult addInstrumentTag(@RequestBody WxInstrumentTagReq wxInstrumentTagReq) {
        return toAjax(wxInstrumentTagService.addInstrumentTag(wxInstrumentTagReq));
    }

    /**
     * 删除仪器标签关联
     */
    @RequiresPermissions("system:tag:remove")
    @Log(title = "仪器标签关联", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(wxInstrumentTagService.deleteWxInstrumentTagByIds(ids));
    }
}
