package com.ruoyi.web.controller.system; 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.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.TbOrders; import com.ruoyi.system.service.ITbOrdersService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * ordersController * * @author wzp * @date 2025-05-01 */ @RestController @RequestMapping("/system/orders") public class TbOrdersController extends BaseController { @Autowired private ITbOrdersService tbOrdersService; /** * 查询orders列表 */ @PreAuthorize("@ss.hasPermi('system:orders:list')") @GetMapping("/list") public TableDataInfo list(TbOrders tbOrders) { startPage(); List list = tbOrdersService.selectTbOrdersList(tbOrders); return getDataTable(list); } /** * 导出orders列表 */ @PreAuthorize("@ss.hasPermi('system:orders:export')") @Log(title = "orders", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, TbOrders tbOrders) { List list = tbOrdersService.selectTbOrdersList(tbOrders); ExcelUtil util = new ExcelUtil(TbOrders.class); util.exportExcel(response, list, "orders数据"); } /** * 获取orders详细信息 */ @PreAuthorize("@ss.hasPermi('system:orders:query')") @GetMapping(value = "/{OrderID}") public AjaxResult getInfo(@PathVariable("OrderID") Long OrderID) { return success(tbOrdersService.selectTbOrdersByOrderID(OrderID)); } /** * 新增orders */ @PreAuthorize("@ss.hasPermi('system:orders:add')") @Log(title = "orders", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody TbOrders tbOrders) { return toAjax(tbOrdersService.insertTbOrders(tbOrders)); } /** * 修改orders */ @PreAuthorize("@ss.hasPermi('system:orders:edit')") @Log(title = "orders", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody TbOrders tbOrders) { return toAjax(tbOrdersService.updateTbOrders(tbOrders)); } /** * 删除orders */ @PreAuthorize("@ss.hasPermi('system:orders:remove')") @Log(title = "orders", businessType = BusinessType.DELETE) @DeleteMapping("/{OrderIDs}") public AjaxResult remove(@PathVariable Long[] OrderIDs) { return toAjax(tbOrdersService.deleteTbOrdersByOrderIDs(OrderIDs)); } }