套餐设置bug
This commit is contained in:
@ -112,7 +112,7 @@ public class ZcRentCarRuleController extends BaseController
|
||||
@Log(title = "租车计费规则", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@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())){
|
||||
@ -131,17 +131,19 @@ public class ZcRentCarRuleController extends BaseController
|
||||
int flag = zcRentCarRuleService.insertZcRentCarRule(zcRentCarRule);
|
||||
|
||||
|
||||
// 保存关联表 ZcRentCarRuleBattery 数据
|
||||
List<ZcRentCarRuleBattery> ruleBatteryList = new ArrayList<>();
|
||||
for (Long batteryRuleId : batteryRuleIds) {
|
||||
ZcRentCarRuleBattery ruleBattery = new ZcRentCarRuleBattery();
|
||||
ruleBattery.setCarRuleId(zcRentCarRule.getId());
|
||||
ruleBattery.setBatteryRuleId(batteryRuleId);
|
||||
ruleBattery.setCreateTime(new Date());
|
||||
ruleBatteryList.add(ruleBattery);
|
||||
}
|
||||
if (!ruleBatteryList.isEmpty()) {
|
||||
zcRentCarRuleBatteryService.batchInsert(ruleBatteryList);
|
||||
if (batteryRuleIds != null && !batteryRuleIds.isEmpty()) {
|
||||
// 保存关联表 ZcRentCarRuleBattery 数据
|
||||
List<ZcRentCarRuleBattery> ruleBatteryList = new ArrayList<>();
|
||||
for (Long batteryRuleId : batteryRuleIds) {
|
||||
ZcRentCarRuleBattery ruleBattery = new ZcRentCarRuleBattery();
|
||||
ruleBattery.setCarRuleId(zcRentCarRule.getId());
|
||||
ruleBattery.setBatteryRuleId(batteryRuleId);
|
||||
ruleBattery.setCreateTime(new Date());
|
||||
ruleBatteryList.add(ruleBattery);
|
||||
}
|
||||
if (!ruleBatteryList.isEmpty()) {
|
||||
zcRentCarRuleBatteryService.batchInsert(ruleBatteryList);
|
||||
}
|
||||
}
|
||||
return toAjax(flag);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user