package com.zehong.web.controller.track;

import java.util.List;

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.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.track.TProductMarkDetail;
import com.zehong.system.service.track.ITProductMarkDetailService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;

/**
 * 装配详情Controller
 * 
 * @author zehong
 * @date 2024-08-24
 */
@RestController
@RequestMapping("/track/detail")
public class TProductMarkDetailController extends BaseController
{
    @Autowired
    private ITProductMarkDetailService tProductMarkDetailService;

    /**
     * 查询装配详情列表
     */
   // @PreAuthorize("@ss.hasPermi('system:detail:list')")
    @GetMapping("/list")
    public TableDataInfo list(TProductMarkDetail tProductMarkDetail)
    {
        startPage();
        List<TProductMarkDetail> list = tProductMarkDetailService.selectTProductMarkDetailList(tProductMarkDetail);
        return getDataTable(list);
    }

    /**
     * 导出装配详情列表
     */
    //@PreAuthorize("@ss.hasPermi('system:detail:export')")
    @Log(title = "装配详情", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TProductMarkDetail tProductMarkDetail)
    {
        List<TProductMarkDetail> list = tProductMarkDetailService.selectTProductMarkDetailList(tProductMarkDetail);
        ExcelUtil<TProductMarkDetail> util = new ExcelUtil<TProductMarkDetail>(TProductMarkDetail.class);
        return util.exportExcel(list, "装配详情数据");
    }

    /**
     * 获取装配详情详细信息
     */
    //@PreAuthorize("@ss.hasPermi('system:detail:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tProductMarkDetailService.selectTProductMarkDetailById(id));
    }

    /**
     * 新增装配详情
     */
    //@PreAuthorize("@ss.hasPermi('system:detail:add')")
    @Log(title = "装配详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TProductMarkDetail tProductMarkDetail)
    {
        return toAjax(tProductMarkDetailService.insertTProductMarkDetail(tProductMarkDetail));
    }

    /**
     * 修改装配详情
     */
    //@PreAuthorize("@ss.hasPermi('system:detail:edit')")
    @Log(title = "装配详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TProductMarkDetail tProductMarkDetail)
    {
        return toAjax(tProductMarkDetailService.updateTProductMarkDetail(tProductMarkDetail));
    }

    /**
     * 删除装配详情
     */
    //@PreAuthorize("@ss.hasPermi('system:detail:remove')")
    @Log(title = "装配详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tProductMarkDetailService.deleteTProductMarkDetailByIds(ids));
    }
}
