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.TankInfo;
|
import com.ruoyi.basic.service.ITankInfoService;
|
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/tankInfo")
|
@AllArgsConstructor
|
public class TankInfoController {
|
private ITankInfoService tankInfoService;
|
|
/**
|
* 分页查询储罐信息列表
|
*/
|
@GetMapping("/list")
|
public R list(Page<TankInfo> page, TankInfo tankInfo) {
|
IPage<TankInfo> result = tankInfoService.selectTankInfoList(page, tankInfo);
|
return R.ok(result);
|
}
|
|
/**
|
* 查询全部储罐信息(供下拉选择)
|
*/
|
@GetMapping("/all")
|
public R all() {
|
return R.ok(tankInfoService.selectAll());
|
}
|
|
/**
|
* 获取储罐信息详细信息
|
*/
|
@GetMapping(value = "/{id}")
|
public R getInfo(@PathVariable("id") Long id) {
|
return R.ok(tankInfoService.selectTankInfoById(id));
|
}
|
|
/**
|
* 新增储罐信息
|
*/
|
@Log(title = "储罐信息", businessType = BusinessType.INSERT)
|
@PostMapping("/add")
|
public R add(@RequestBody TankInfo tankInfo) {
|
return R.ok(tankInfoService.insertTankInfo(tankInfo));
|
}
|
|
/**
|
* 修改储罐信息
|
*/
|
@Log(title = "储罐信息", businessType = BusinessType.UPDATE)
|
@PostMapping("/update")
|
public R edit(@RequestBody TankInfo tankInfo) {
|
return R.ok(tankInfoService.updateTankInfo(tankInfo));
|
}
|
|
/**
|
* 删除储罐信息
|
*/
|
@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(tankInfoService.deleteTankInfoByIds(ids));
|
}
|
}
|