Compare commits

..

No commits in common. "186b5a1453181da2a4fa35e4d772912842721d1736c3a6246b12b7b1281bc086" and "1e0ad7bdfb8a07f50ab26e43d734b70d9ea754357268117b3cb2442bad7e25e8" have entirely different histories.

2 changed files with 5 additions and 16 deletions

View File

@ -56,9 +56,6 @@ public class EbikeBatteryInfoController {
if (batteryInfo == null) { if (batteryInfo == null) {
throw new EbikeException("电池ID错误"); throw new EbikeException("电池ID错误");
} }
if (batteryInfo.getStatus() == BatteryStatus.BIND) {
throw new EbikeException("该电池已绑定");
}
batteryInfo.setStatus(BatteryStatus.BIND); batteryInfo.setStatus(BatteryStatus.BIND);
ebikeBatteryInfoService.updateById(batteryInfo); ebikeBatteryInfoService.updateById(batteryInfo);
return JsonResult.success(); return JsonResult.success();
@ -72,13 +69,6 @@ public class EbikeBatteryInfoController {
*/ */
@GetMapping("batchBind") @GetMapping("batchBind")
public JsonResult<?> batchBind(@RequestBody EbikeBatteryInfoIdVo ids){ 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) UpdateChain.of(EbikeBatteryInfo.class)
.set(EbikeBatteryInfo::getStatus, BatteryStatus.BIND) .set(EbikeBatteryInfo::getStatus, BatteryStatus.BIND)
.where(EbikeBatteryInfo::getBatteryId).in(ids.getBatteryIds()); .where(EbikeBatteryInfo::getBatteryId).in(ids.getBatteryIds());
@ -91,7 +81,7 @@ public class EbikeBatteryInfoController {
* @param batteryId 主键 * @param batteryId 主键
* @return {@code true} 删除成功{@code false} 删除失败 * @return {@code true} 删除成功{@code false} 删除失败
*/ */
@GetMapping("remove") @PostMapping("remove")
public JsonResult<?> remove(@RequestParam(value = "batteryId") Long batteryId) { public JsonResult<?> remove(@RequestParam(value = "batteryId") Long batteryId) {
ebikeBatteryInfoService.removeById(batteryId); ebikeBatteryInfoService.removeById(batteryId);
return JsonResult.success(); return JsonResult.success();

View File

@ -75,7 +75,6 @@ public class EbikeEcuInfoController {
return JsonResult.success(); return JsonResult.success();
} }
/** /**
* 查询所有中控基本信息 * 查询所有中控基本信息
* *