package com.spider.quartz.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.spider.common.annotation.Log;
import com.spider.common.core.controller.BaseController;
import com.spider.common.core.domain.AjaxResult;
import com.spider.common.enums.BusinessType;
import com.spider.quartz.domain.UsUnqualifiedGoodsZh;
import com.spider.quartz.service.IUsUnqualifiedGoodsZhService;
import com.spider.common.utils.poi.ExcelUtil;
import com.spider.common.core.page.TableDataInfo;

/**
 * 美国不合格商品展示-翻译Controller
 * 
 * @author ruoyi
 * @date 2025-12-05
 */
@RestController
@RequestMapping("/bus/uszh")
public class UsUnqualifiedGoodsZhController extends BaseController
{
    @Autowired
    private IUsUnqualifiedGoodsZhService usUnqualifiedGoodsZhService;

    /**
     * 查询美国不合格商品展示-翻译列表
     */
    @PreAuthorize("@ss.hasPermi('bus:uszh:list')")
    @GetMapping("/list")
    public TableDataInfo list(UsUnqualifiedGoodsZh usUnqualifiedGoodsZh)
    {
        startPage();
        List<UsUnqualifiedGoodsZh> list = usUnqualifiedGoodsZhService.selectUsUnqualifiedGoodsZhList(usUnqualifiedGoodsZh);
        return getDataTable(list);
    }

    /**
     * 导出美国不合格商品展示-翻译列表
     */
    @PreAuthorize("@ss.hasPermi('bus:uszh:export')")
    @Log(title = "美国不合格商品展示-翻译", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, UsUnqualifiedGoodsZh usUnqualifiedGoodsZh)
    {
        List<UsUnqualifiedGoodsZh> list = usUnqualifiedGoodsZhService.selectUsUnqualifiedGoodsZhList(usUnqualifiedGoodsZh);
        ExcelUtil<UsUnqualifiedGoodsZh> util = new ExcelUtil<UsUnqualifiedGoodsZh>(UsUnqualifiedGoodsZh.class);
        util.exportExcel(response, list, "美国不合格商品展示-翻译数据");
    }

    /**
     * 获取美国不合格商品展示-翻译详细信息
     */
    @PreAuthorize("@ss.hasPermi('bus:uszh:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(usUnqualifiedGoodsZhService.selectUsUnqualifiedGoodsZhById(id));
    }

    /**
     * 新增美国不合格商品展示-翻译
     */
    @PreAuthorize("@ss.hasPermi('bus:uszh:add')")
    @Log(title = "美国不合格商品展示-翻译", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody UsUnqualifiedGoodsZh usUnqualifiedGoodsZh)
    {
        return toAjax(usUnqualifiedGoodsZhService.insertUsUnqualifiedGoodsZh(usUnqualifiedGoodsZh));
    }

    /**
     * 修改美国不合格商品展示-翻译
     */
    @PreAuthorize("@ss.hasPermi('bus:uszh:edit')")
    @Log(title = "美国不合格商品展示-翻译", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody UsUnqualifiedGoodsZh usUnqualifiedGoodsZh)
    {
        return toAjax(usUnqualifiedGoodsZhService.updateUsUnqualifiedGoodsZh(usUnqualifiedGoodsZh));
    }

    /**
     * 删除美国不合格商品展示-翻译
     */
    @PreAuthorize("@ss.hasPermi('bus:uszh:remove')")
    @Log(title = "美国不合格商品展示-翻译", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(usUnqualifiedGoodsZhService.deleteUsUnqualifiedGoodsZhByIds(ids));
    }
}
