90 lines
2.3 KiB
Java
90 lines
2.3 KiB
Java
|
|
package com.cdzy.operations.controller;
|
|||
|
|
|
|||
|
|
import com.cdzy.operations.model.entity.EbikeBatteryInfo;
|
|||
|
|
import com.cdzy.operations.service.EbikeBatteryInfoService;
|
|||
|
|
import com.mybatisflex.core.paginate.Page;
|
|||
|
|
import jakarta.annotation.Resource;
|
|||
|
|
import org.springframework.web.bind.annotation.*;
|
|||
|
|
|
|||
|
|
import java.util.List;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 电池基本信息 控制层。
|
|||
|
|
*
|
|||
|
|
* @author attiya
|
|||
|
|
* @since 2025-09-15
|
|||
|
|
*/
|
|||
|
|
@RestController
|
|||
|
|
@RequestMapping("/ebikeBatteryInfo")
|
|||
|
|
public class EbikeBatteryInfoController {
|
|||
|
|
|
|||
|
|
@Resource
|
|||
|
|
private EbikeBatteryInfoService ebikeBatteryInfoService;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 添加电池基本信息。
|
|||
|
|
*
|
|||
|
|
* @param ebikeBatteryInfo 电池基本信息
|
|||
|
|
* @return {@code true} 添加成功,{@code false} 添加失败
|
|||
|
|
*/
|
|||
|
|
@PostMapping("save")
|
|||
|
|
public boolean save(@RequestBody EbikeBatteryInfo ebikeBatteryInfo) {
|
|||
|
|
return ebikeBatteryInfoService.save(ebikeBatteryInfo);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 根据主键删除电池基本信息。
|
|||
|
|
*
|
|||
|
|
* @param id 主键
|
|||
|
|
* @return {@code true} 删除成功,{@code false} 删除失败
|
|||
|
|
*/
|
|||
|
|
@DeleteMapping("remove/{id}")
|
|||
|
|
public boolean remove(@PathVariable Long id) {
|
|||
|
|
return ebikeBatteryInfoService.removeById(id);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 根据主键更新电池基本信息。
|
|||
|
|
*
|
|||
|
|
* @param ebikeBatteryInfo 电池基本信息
|
|||
|
|
* @return {@code true} 更新成功,{@code false} 更新失败
|
|||
|
|
*/
|
|||
|
|
@PutMapping("update")
|
|||
|
|
public boolean update(@RequestBody EbikeBatteryInfo ebikeBatteryInfo) {
|
|||
|
|
return ebikeBatteryInfoService.updateById(ebikeBatteryInfo);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 查询所有电池基本信息。
|
|||
|
|
*
|
|||
|
|
* @return 所有数据
|
|||
|
|
*/
|
|||
|
|
@GetMapping("list")
|
|||
|
|
public List<EbikeBatteryInfo> list() {
|
|||
|
|
return ebikeBatteryInfoService.list();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 根据电池基本信息主键获取详细信息。
|
|||
|
|
*
|
|||
|
|
* @param id 电池基本信息主键
|
|||
|
|
* @return 电池基本信息详情
|
|||
|
|
*/
|
|||
|
|
@GetMapping("getInfo/{id}")
|
|||
|
|
public EbikeBatteryInfo getInfo(@PathVariable Long id) {
|
|||
|
|
return ebikeBatteryInfoService.getById(id);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 分页查询电池基本信息。
|
|||
|
|
*
|
|||
|
|
* @param page 分页对象
|
|||
|
|
* @return 分页对象
|
|||
|
|
*/
|
|||
|
|
@GetMapping("page")
|
|||
|
|
public Page<EbikeBatteryInfo> page(Page<EbikeBatteryInfo> page) {
|
|||
|
|
return ebikeBatteryInfoService.page(page);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|