javacodeadmin/ruoyi-system/src/main/java/com/ruoyi/system/controller/SiteDeliveryController.java

118 lines
4.1 KiB
Java

package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.system.domain.ServiceCate;
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.SiteDelivery;
import com.ruoyi.system.service.ISiteDeliveryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 快递公司Controller
*
* @author ruoyi
* @date 2025-05-13
*/
@RestController
@RequestMapping("/system/SiteDelivery")
public class SiteDeliveryController extends BaseController
{
@Autowired
private ISiteDeliveryService siteDeliveryService;
/**
* 查询快递公司列表
*/
@PreAuthorize("@ss.hasPermi('system:SiteDelivery:list')")
@GetMapping("/list")
public TableDataInfo list(SiteDelivery siteDelivery)
{
startPage();
List<SiteDelivery> list = siteDeliveryService.selectSiteDeliveryList(siteDelivery);
return getDataTable(list);
}
/**
* 导出快递公司列表
*/
@PreAuthorize("@ss.hasPermi('system:SiteDelivery:export')")
@Log(title = "快递公司", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SiteDelivery siteDelivery)
{
List<SiteDelivery> list = siteDeliveryService.selectSiteDeliveryList(siteDelivery);
ExcelUtil<SiteDelivery> util = new ExcelUtil<SiteDelivery>(SiteDelivery.class);
util.exportExcel(response, list, "快递公司数据");
}
/**
* 获取快递公司详细信息
*/
@PreAuthorize("@ss.hasPermi('system:SiteDelivery:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(siteDeliveryService.selectSiteDeliveryById(id));
}
/**
* 定时任务状态修改
*/
@PreAuthorize("@ss.hasPermi('system:SiteDelivery:changeStatus')")
@Log(title = "修改状态", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SiteDelivery siteDelivery)
{
SiteDelivery newSiteDelivery = siteDeliveryService.selectSiteDeliveryById(siteDelivery.getId());
newSiteDelivery.setStatus(siteDelivery.getStatus());
return toAjax(siteDeliveryService.updateSiteDelivery(newSiteDelivery));
}
/**
* 新增快递公司
*/
@PreAuthorize("@ss.hasPermi('system:SiteDelivery:add')")
@Log(title = "快递公司", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SiteDelivery siteDelivery)
{
return toAjax(siteDeliveryService.insertSiteDelivery(siteDelivery));
}
/**
* 修改快递公司
*/
@PreAuthorize("@ss.hasPermi('system:SiteDelivery:edit')")
@Log(title = "快递公司", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SiteDelivery siteDelivery)
{
return toAjax(siteDeliveryService.updateSiteDelivery(siteDelivery));
}
/**
* 删除快递公司
*/
@PreAuthorize("@ss.hasPermi('system:SiteDelivery:remove')")
@Log(title = "快递公司", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(siteDeliveryService.deleteSiteDeliveryByIds(ids));
}
}