package com.ruoyi.basic.controller;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ruoyi.basic.pojo.OilDepot;
|
import com.ruoyi.basic.service.IOilDepotService;
|
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.framework.web.domain.R;
|
import lombok.AllArgsConstructor;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
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.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
/**
|
* 油库信息Controller
|
*
|
* @author ruoyi
|
* @date 2026-09-10
|
*/
|
@RestController
|
@RequestMapping("/basic/oilDepot")
|
@AllArgsConstructor
|
public class OilDepotController {
|
private IOilDepotService oilDepotService;
|
|
/**
|
* 分页查询油库信息列表
|
*/
|
@GetMapping("/list")
|
public R list(Page<OilDepot> page, OilDepot oilDepot) {
|
IPage<OilDepot> result = oilDepotService.selectOilDepotList(page, oilDepot);
|
return R.ok(result);
|
}
|
|
/**
|
* 查询全部油库信息(供下拉选择)
|
*/
|
@GetMapping("/all")
|
public R all() {
|
return R.ok(oilDepotService.selectAll());
|
}
|
|
/**
|
* 获取油库信息详细信息
|
*/
|
@GetMapping(value = "/{id}")
|
public R getInfo(@PathVariable("id") Long id) {
|
return R.ok(oilDepotService.selectOilDepotById(id));
|
}
|
|
/**
|
* 新增油库信息
|
*/
|
@Log(title = "油库信息", businessType = BusinessType.INSERT)
|
@PostMapping("/add")
|
public R add(@RequestBody OilDepot oilDepot) {
|
return R.ok(oilDepotService.insertOilDepot(oilDepot));
|
}
|
|
/**
|
* 修改油库信息
|
*/
|
@Log(title = "油库信息", businessType = BusinessType.UPDATE)
|
@PostMapping("/update")
|
public R edit(@RequestBody OilDepot oilDepot) {
|
return R.ok(oilDepotService.updateOilDepot(oilDepot));
|
}
|
|
/**
|
* 删除油库信息
|
*/
|
@Log(title = "油库信息", businessType = BusinessType.DELETE)
|
@DeleteMapping("/del")
|
public R remove(@RequestBody Long[] ids) {
|
if (ids == null || ids.length == 0) {
|
return R.fail("请传入要删除的ID");
|
}
|
return R.ok(oilDepotService.deleteOilDepotByIds(ids));
|
}
|
}
|