package com.huijy.web.controller.management;

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.huijy.common.annotation.Log;
import com.huijy.common.core.controller.BaseController;
import com.huijy.common.core.domain.AjaxResult;
import com.huijy.common.enums.BusinessType;
import com.huijy.management.domain.MarkerContent;
import com.huijy.management.service.IMarkerContentService;
import com.huijy.common.utils.poi.ExcelUtil;
import com.huijy.common.core.page.TableDataInfo;

/**
 * 标记物内容中间Controller
 *
 * @author luobo
 * @date 2021-10-10
 */
@RestController
@RequestMapping("/management/markerContent")
public class MarkerContentController extends BaseController
{
    @Autowired
    private IMarkerContentService markerContentService;

    /**
     * 查询标记物内容中间列表
     */
    @PreAuthorize("@ss.hasPermi('management:markerContent:list')")
    @GetMapping("/list")
    public TableDataInfo list(MarkerContent markerContent)
    {
        startPage();
        List<MarkerContent> list = markerContentService.selectMarkerContentList(markerContent);
        return getDataTable(list);
    }

    /**
     * 导出标记物内容中间列表
     */
    @PreAuthorize("@ss.hasPermi('management:markerContent:export')")
    @Log(title = "标记物内容中间", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(MarkerContent markerContent)
    {
        List<MarkerContent> list = markerContentService.selectMarkerContentList(markerContent);
        ExcelUtil<MarkerContent> util = new ExcelUtil<MarkerContent>(MarkerContent.class);
        return util.exportExcel(list, "标记物内容中间数据");
    }

    /**
     * 获取标记物内容中间详细信息
     */
    @PreAuthorize("@ss.hasPermi('management:markerContent:query')")
    @GetMapping(value = "/{markerContent}")
    public AjaxResult getInfo(@PathVariable("markerContent") Long markerContent)
    {
        return AjaxResult.success(markerContentService.selectMarkerContentByMarkerContent(markerContent));
    }

    /**
     * 新增标记物内容中间
     */
    @PreAuthorize("@ss.hasPermi('management:markerContent:add')")
    @Log(title = "标记物内容中间", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MarkerContent markerContent)
    {
        return toAjax(markerContentService.insertMarkerContent(markerContent));
    }

    /**
     * 修改标记物内容中间
     */
    @PreAuthorize("@ss.hasPermi('management:markerContent:edit')")
    @Log(title = "标记物内容中间", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MarkerContent markerContent)
    {
        return toAjax(markerContentService.updateMarkerContent(markerContent));
    }

    /**
     * 删除标记物内容中间
     */
    @PreAuthorize("@ss.hasPermi('management:markerContent:remove')")
    @Log(title = "标记物内容中间", businessType = BusinessType.DELETE)
	@DeleteMapping("/{markerContents}")
    public AjaxResult remove(@PathVariable Long[] markerContents)
    {
        return toAjax(markerContentService.deleteMarkerContentByMarkerContents(markerContents));
    }
}
