Compare commits
2 Commits
1e0ad7bdfb
...
186b5a1453
| Author | SHA256 | Date | |
|---|---|---|---|
| 186b5a1453 | |||
| 43d819b9f5 |
@ -56,6 +56,9 @@ public class EbikeBatteryInfoController {
|
||||
if (batteryInfo == null) {
|
||||
throw new EbikeException("电池ID错误");
|
||||
}
|
||||
if (batteryInfo.getStatus() == BatteryStatus.BIND) {
|
||||
throw new EbikeException("该电池已绑定");
|
||||
}
|
||||
batteryInfo.setStatus(BatteryStatus.BIND);
|
||||
ebikeBatteryInfoService.updateById(batteryInfo);
|
||||
return JsonResult.success();
|
||||
@ -69,6 +72,13 @@ public class EbikeBatteryInfoController {
|
||||
*/
|
||||
@GetMapping("batchBind")
|
||||
public JsonResult<?> batchBind(@RequestBody EbikeBatteryInfoIdVo ids) {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.where(EBIKE_BATTERY_INFO.BATTERY_ID.in(ids.getBatteryIds()))
|
||||
.where(EBIKE_BATTERY_INFO.STATUS.eq(BatteryStatus.BIND));
|
||||
long count = ebikeBatteryInfoService.count(queryWrapper);
|
||||
if (count > 0) {
|
||||
throw new EbikeException("选择电池集合中包含已绑定电池");
|
||||
}
|
||||
UpdateChain.of(EbikeBatteryInfo.class)
|
||||
.set(EbikeBatteryInfo::getStatus, BatteryStatus.BIND)
|
||||
.where(EbikeBatteryInfo::getBatteryId).in(ids.getBatteryIds());
|
||||
@ -81,7 +91,7 @@ public class EbikeBatteryInfoController {
|
||||
* @param batteryId 主键
|
||||
* @return {@code true} 删除成功,{@code false} 删除失败
|
||||
*/
|
||||
@PostMapping("remove")
|
||||
@GetMapping("remove")
|
||||
public JsonResult<?> remove(@RequestParam(value = "batteryId") Long batteryId) {
|
||||
ebikeBatteryInfoService.removeById(batteryId);
|
||||
return JsonResult.success();
|
||||
|
||||
@ -75,6 +75,7 @@ public class EbikeEcuInfoController {
|
||||
return JsonResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有中控基本信息。
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user