套餐设置bug

This commit is contained in:
19173159168
2025-09-25 00:23:39 +08:00
parent 08fb39db7e
commit cdbc6aef58

View File

@ -112,7 +112,7 @@ public class ZcRentCarRuleController extends BaseController
@Log(title = "租车计费规则", businessType = BusinessType.INSERT) @Log(title = "租车计费规则", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(@RequestParam("batteryRules") List<Long> batteryRuleIds, ZcRentCarRule zcRentCarRule) public AjaxResult addSave(@RequestParam(value = "batteryRules",required = false) List<Long> batteryRuleIds, ZcRentCarRule zcRentCarRule)
{ {
// 如果是按天租,验证选择的租电套餐支持天数是否一致 // 如果是按天租,验证选择的租电套餐支持天数是否一致
if("3".equals(zcRentCarRule.getRentalType())){ if("3".equals(zcRentCarRule.getRentalType())){
@ -131,6 +131,7 @@ public class ZcRentCarRuleController extends BaseController
int flag = zcRentCarRuleService.insertZcRentCarRule(zcRentCarRule); int flag = zcRentCarRuleService.insertZcRentCarRule(zcRentCarRule);
if (batteryRuleIds != null && !batteryRuleIds.isEmpty()) {
// 保存关联表 ZcRentCarRuleBattery 数据 // 保存关联表 ZcRentCarRuleBattery 数据
List<ZcRentCarRuleBattery> ruleBatteryList = new ArrayList<>(); List<ZcRentCarRuleBattery> ruleBatteryList = new ArrayList<>();
for (Long batteryRuleId : batteryRuleIds) { for (Long batteryRuleId : batteryRuleIds) {
@ -143,6 +144,7 @@ public class ZcRentCarRuleController extends BaseController
if (!ruleBatteryList.isEmpty()) { if (!ruleBatteryList.isEmpty()) {
zcRentCarRuleBatteryService.batchInsert(ruleBatteryList); zcRentCarRuleBatteryService.batchInsert(ruleBatteryList);
} }
}
return toAjax(flag); return toAjax(flag);
} }