package com.ruoyi.app.order; import java.util.List; import jakarta.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.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.system.domain.PosFreight; import com.ruoyi.system.service.IPosFreightService; import com.ruoyi.common.utils.MessageUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * freightController * * @author ruoyi * @date 2023-07-15 */ @RestController @RequestMapping("/system/freight") public class PosFreightController extends BaseController { @Autowired private IPosFreightService posFreightService; /** * 查询freight列表 */ @PreAuthorize("@ss.hasPermi('system:freight:list')") @GetMapping("/list") public TableDataInfo list(PosFreight posFreight) { startPage(); List list = posFreightService.selectPosFreightList(posFreight); return getDataTable(list); } /** * 导出freight列表 */ @PreAuthorize("@ss.hasPermi('system:freight:export')") @Log(title = "freight", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, PosFreight posFreight) { List list = posFreightService.selectPosFreightList(posFreight); ExcelUtil util = new ExcelUtil(PosFreight.class); util.exportExcel(response, list, MessageUtils.message("no.export.excel.freight")); } /** * 获取freight详细信息 */ @PreAuthorize("@ss.hasPermi('system:freight:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(posFreightService.selectPosFreightById(id)); } /** * 新增freight */ @PreAuthorize("@ss.hasPermi('system:freight:add')") @Log(title = "freight", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody PosFreight posFreight) { return toAjax(posFreightService.insertPosFreight(posFreight)); } /** * 修改freight */ @PreAuthorize("@ss.hasPermi('system:freight:edit')") @Log(title = "freight", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody PosFreight posFreight) { return toAjax(posFreightService.updatePosFreight(posFreight)); } /** * 删除freight */ @PreAuthorize("@ss.hasPermi('system:freight:remove')") @Log(title = "freight", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(posFreightService.deletePosFreightByIds(ids)); } }