|
|
@@ -43,10 +43,22 @@ public class DietMealConfigService {
|
|
|
}
|
|
|
|
|
|
public void saveConfig(Long familyId, Map<String, Object> request) {
|
|
|
- String dateType = request.get("date_type").toString();
|
|
|
- String mealType = request.get("meal_type").toString();
|
|
|
- String participantMemberIds = request.get("participant_member_ids").toString();
|
|
|
- String notes = request.containsKey("notes") ? request.get("notes").toString() : null;
|
|
|
+ String dateType = request.get("date_type") != null ? request.get("date_type").toString() : null;
|
|
|
+ String mealType = request.get("meal_type") != null ? request.get("meal_type").toString() : null;
|
|
|
+ String participantMemberIds = request.get("participant_member_ids") != null
|
|
|
+ ? request.get("participant_member_ids").toString() : null;
|
|
|
+ String notes = request.containsKey("notes") && request.get("notes") != null
|
|
|
+ ? request.get("notes").toString() : null;
|
|
|
+
|
|
|
+ if (dateType == null || dateType.isEmpty()) {
|
|
|
+ throw new IllegalArgumentException("缺少必填参数: date_type");
|
|
|
+ }
|
|
|
+ if (mealType == null || mealType.isEmpty()) {
|
|
|
+ throw new IllegalArgumentException("缺少必填参数: meal_type");
|
|
|
+ }
|
|
|
+ if (participantMemberIds == null) {
|
|
|
+ throw new IllegalArgumentException("缺少必填参数: participant_member_ids");
|
|
|
+ }
|
|
|
|
|
|
LambdaQueryWrapper<MealConfig> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(MealConfig::getFamilyId, familyId)
|