package com.ruoyi.basedata.controller; import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.ruoyi.util.AllNumberUtil; 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.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.basedata.domain.Empwgtdata; import com.ruoyi.basedata.service.IEmpwgtdataService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 皮重库Controller * * @author ruoyi * @date 2025-06-11 */ @RestController @RequestMapping("/measurement/basedata/empwgtdata") public class EmpwgtdataController extends BaseController { @Autowired private IEmpwgtdataService empwgtdataService; @Autowired private AllNumberUtil allNumberUtil; /** * 查询皮重库列表 */ @PreAuthorize("@ss.hasPermi('measurement/basedata:empwgtdata:list')") @GetMapping("/list") public TableDataInfo list(Empwgtdata empwgtdata) { startPage(); List list = empwgtdataService.selectEmpwgtdataList(empwgtdata); return getDataTable(list); } /** * 导出皮重库列表 */ @PreAuthorize("@ss.hasPermi('measurement/basedata:empwgtdata:export')") @Log(title = "皮重库", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, Empwgtdata empwgtdata) { List list = empwgtdataService.selectEmpwgtdataList(empwgtdata); ExcelUtil util = new ExcelUtil(Empwgtdata.class); util.exportExcel(response, list, "皮重库数据"); } /** * 获取一个流水ID */ @PreAuthorize("@ss.hasPermi('measurement/basedata:empwgtdata:query')") @GetMapping(value = "/getNumber") public AjaxResult getNumber() { return success((Object) allNumberUtil.generateDefaultSerial(Empwgtdata.NUMBER_PROFIX)); } /** * 获取皮重库详细信息 */ @PreAuthorize("@ss.hasPermi('measurement/basedata:empwgtdata:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") String id) { return success(empwgtdataService.getById(id)); } /** * 新增皮重库 */ @PreAuthorize("@ss.hasPermi('measurement/basedata:empwgtdata:add')") @Log(title = "皮重库", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody Empwgtdata empwgtdata) { return toAjax( empwgtdataService.insertEmpwgtdata(empwgtdata) ); } /** * 修改皮重库 */ @PreAuthorize("@ss.hasPermi('measurement/basedata:empwgtdata:edit')") @Log(title = "皮重库", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody Empwgtdata empwgtdata) { return toAjax(empwgtdataService.updateEmpwgtdata(empwgtdata)); } /** * 删除皮重库 */ @PreAuthorize("@ss.hasPermi('measurement/basedata:empwgtdata:remove')") @Log(title = "皮重库", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable String[] ids) { return toAjax(empwgtdataService.removeByIds(Arrays.asList(ids))); } @PreAuthorize("@ss.hasPermi('measurement/basedata:empwgtdata:query')") @GetMapping(value = "/getCarnoEmpwgtData/{carno}") public AjaxResult getCarnoEmpwgtData(@PathVariable("carno") String carno) { return success(empwgtdataService.getCarnoEmpwgtData(carno)); } @PreAuthorize("@ss.hasPermi('measurement/basedata:empwgtdata:query')") @GetMapping(value = "/getCarnoEmpwgtDataStatus/{carno}") public AjaxResult getCarnoEmpwgtDataStatus(@PathVariable("carno") String carno) { return success(empwgtdataService.getCarnoEmpwgtDataStatus(carno)); } }