2025-09-15 15:48:54 +08:00
|
|
|
|
package com.cdzy.operations.controller;
|
|
|
|
|
|
|
|
|
|
|
|
import com.cdzy.common.model.request.PageParam;
|
|
|
|
|
|
import com.cdzy.common.model.response.JsonResult;
|
|
|
|
|
|
import com.cdzy.operations.model.entity.EbikeEcuInfo;
|
2025-10-15 15:18:46 +08:00
|
|
|
|
import com.cdzy.operations.model.vo.EbikeEcuInfoBatchVo;
|
2025-09-15 15:48:54 +08:00
|
|
|
|
import com.cdzy.operations.model.vo.EbikeEcuInfoVo;
|
|
|
|
|
|
import com.cdzy.operations.service.EbikeEcuInfoService;
|
|
|
|
|
|
import com.mybatisflex.core.paginate.Page;
|
|
|
|
|
|
import jakarta.annotation.Resource;
|
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 中控基本信息 控制层。
|
|
|
|
|
|
*
|
|
|
|
|
|
* @author attiya
|
|
|
|
|
|
* @since 2025-09-15
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RestController
|
|
|
|
|
|
@RequestMapping("/ebikeEcuInfo")
|
|
|
|
|
|
@Validated
|
|
|
|
|
|
public class EbikeEcuInfoController {
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
private EbikeEcuInfoService ebikeEcuInfoService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 中控入库。
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param ebikeEcuInfo 中控基本信息
|
|
|
|
|
|
* @return {@code true} 添加成功,{@code false} 添加失败
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("save")
|
|
|
|
|
|
public JsonResult<?> saveEcu(@Validated @RequestBody EbikeEcuInfoVo ebikeEcuInfo) {
|
|
|
|
|
|
ebikeEcuInfoService.saveEcu(ebikeEcuInfo);
|
|
|
|
|
|
return JsonResult.success();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-15 15:18:46 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 批量入库。
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param batchVo 中控信息
|
|
|
|
|
|
* @return {@code true} 添加成功,{@code false} 添加失败
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("batchSave")
|
|
|
|
|
|
public JsonResult<?> batchSave(@Validated @RequestBody EbikeEcuInfoBatchVo batchVo) {
|
|
|
|
|
|
ebikeEcuInfoService.batchSave(batchVo);
|
|
|
|
|
|
return JsonResult.success();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-15 15:48:54 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 根据主键删除中控基本信息。
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param ecuId 主键
|
|
|
|
|
|
* @return {@code true} 删除成功,{@code false} 删除失败
|
|
|
|
|
|
*/
|
|
|
|
|
|
@GetMapping("remove")
|
|
|
|
|
|
public JsonResult<?> remove(@RequestParam("ecuId") Long ecuId) {
|
|
|
|
|
|
ebikeEcuInfoService.removeById(ecuId);
|
|
|
|
|
|
return JsonResult.success();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据主键更新中控基本信息。
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param ebikeEcuInfo 中控基本信息
|
|
|
|
|
|
* @return {@code true} 更新成功,{@code false} 更新失败
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("update")
|
|
|
|
|
|
public JsonResult<?> update(@RequestBody EbikeEcuInfo ebikeEcuInfo) {
|
|
|
|
|
|
ebikeEcuInfoService.updateById(ebikeEcuInfo);
|
|
|
|
|
|
return JsonResult.success();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询所有中控基本信息。
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return 所有数据
|
|
|
|
|
|
*/
|
|
|
|
|
|
@GetMapping("list")
|
|
|
|
|
|
public JsonResult<?> list() {
|
|
|
|
|
|
List<EbikeEcuInfo> list = ebikeEcuInfoService.list();
|
|
|
|
|
|
return JsonResult.success(list);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据中控基本信息主键获取详细信息。
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param ecuId 中控基本信息主键
|
|
|
|
|
|
* @return 中控基本信息详情
|
|
|
|
|
|
*/
|
|
|
|
|
|
@GetMapping("getInfo")
|
|
|
|
|
|
public JsonResult<?> getInfo(@RequestParam("ecuId") Long ecuId) {
|
|
|
|
|
|
EbikeEcuInfo info = ebikeEcuInfoService.getById(ecuId);
|
|
|
|
|
|
return JsonResult.success(info);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 分页查询中控基本信息。
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param pageParam 分页对象
|
|
|
|
|
|
* @return 分页对象
|
|
|
|
|
|
*/
|
|
|
|
|
|
@GetMapping("page")
|
|
|
|
|
|
public JsonResult<?> page(PageParam pageParam) {
|
|
|
|
|
|
Page<EbikeEcuInfo> paged = ebikeEcuInfoService.page(pageParam.getPage());
|
|
|
|
|
|
return JsonResult.success(paged);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|