package com.ruoyi.traceability.controller; import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.traceability.domain.ProMqUpload; import com.ruoyi.traceability.service.IProMqUploadService; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 模切数据上传Controller * * @author wenjy * @date 2022-11-18 */ @Controller @RequestMapping("/traceability/mqupload") public class ProMqUploadController extends BaseController { private String prefix = "traceability/mqupload"; @Autowired private IProMqUploadService proMqUploadService; @RequiresPermissions("traceability:mqupload:view") @GetMapping() public String mqupload() { return prefix + "/mqupload"; } /** * 查询模切数据上传列表 */ @RequiresPermissions("traceability:mqupload:list") @PostMapping("/list") @ResponseBody public TableDataInfo list(ProMqUpload proMqUpload) { startPage(); List list = proMqUploadService.selectProMqUploadList(proMqUpload); return getDataTable(list); } /** * 导出模切数据上传列表 */ @RequiresPermissions("traceability:mqupload:export") @Log(title = "模切数据上传", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody public AjaxResult export(ProMqUpload proMqUpload) { List list = proMqUploadService.selectProMqUploadList(proMqUpload); ExcelUtil util = new ExcelUtil(ProMqUpload.class); return util.exportExcel(list, "模切数据上传数据"); } /** * 新增模切数据上传 */ @GetMapping("/add") public String add() { return prefix + "/add"; } /** * 新增保存模切数据上传 */ @RequiresPermissions("traceability:mqupload:add") @Log(title = "模切数据上传", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(ProMqUpload proMqUpload) { return toAjax(proMqUploadService.insertProMqUpload(proMqUpload)); } /** * 修改模切数据上传 */ @RequiresPermissions("traceability:mqupload:edit") @GetMapping("/edit/{id}") public String edit(@PathVariable("id") Long id, ModelMap mmap) { ProMqUpload proMqUpload = proMqUploadService.selectProMqUploadById(id); mmap.put("proMqUpload", proMqUpload); return prefix + "/edit"; } /** * 修改保存模切数据上传 */ @RequiresPermissions("traceability:mqupload:edit") @Log(title = "模切数据上传", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(ProMqUpload proMqUpload) { return toAjax(proMqUploadService.updateProMqUpload(proMqUpload)); } /** * 删除模切数据上传 */ @RequiresPermissions("traceability:mqupload:remove") @Log(title = "模切数据上传", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids) { return toAjax(proMqUploadService.deleteProMqUploadByIds(ids)); } }