|
@@ -2,9 +2,13 @@ package com.iotechn.unimall.admin.api.tourism.impl;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import com.iotechn.unimall.data.domain.CommonUserInfo;
|
|
|
|
+import com.iotechn.unimall.data.domain.FoodGroupDetailInfo;
|
|
|
|
+import com.iotechn.unimall.data.mapper.FoodGroupDetailInfoMapper;
|
|
import org.apache.ibatis.session.RowBounds;
|
|
import org.apache.ibatis.session.RowBounds;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
@@ -28,13 +32,26 @@ import org.springframework.transaction.annotation.Transactional;
|
|
public class FoodGroupInfoServiceImpl implements IFoodGroupInfoService{
|
|
public class FoodGroupInfoServiceImpl implements IFoodGroupInfoService{
|
|
@Autowired
|
|
@Autowired
|
|
private FoodGroupInfoMapper foodGroupInfoMapper;
|
|
private FoodGroupInfoMapper foodGroupInfoMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private FoodGroupDetailInfoMapper foodGroupDetailInfoMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Boolean add(FoodGroupInfo foodGroupInfo) throws ServiceException {
|
|
public Boolean add(FoodGroupInfo foodGroupInfo) throws ServiceException {
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
- foodGroupInfo.setGmtCreate(now);
|
|
|
|
- foodGroupInfo.setGmtUpdate(now);
|
|
|
|
- return foodGroupInfoMapper.insert(foodGroupInfo)>0;
|
|
|
|
|
|
+ FoodGroupInfo foodGroupInfo1=new FoodGroupInfo();
|
|
|
|
+ foodGroupInfo1.setGmtCreate(now);
|
|
|
|
+ foodGroupInfo1.setGmtUpdate(now);
|
|
|
|
+ foodGroupInfoMapper.insert(foodGroupInfo1);
|
|
|
|
+ foodGroupInfo1=foodGroupInfoMapper.selectById(foodGroupInfo1.getId());
|
|
|
|
+ if (!CollectionUtils.isEmpty(foodGroupInfo.getFoodGroupDetailInfoList())){
|
|
|
|
+ for (FoodGroupDetailInfo foodGroupDetailInfo:foodGroupInfo.getFoodGroupDetailInfoList()){
|
|
|
|
+ foodGroupDetailInfo.setGroupId(foodGroupInfo1.getId());
|
|
|
|
+ foodGroupDetailInfo.setGmtCreate(now);
|
|
|
|
+ foodGroupDetailInfo.setGmtUpdate(now);
|
|
|
|
+ return foodGroupDetailInfoMapper.insert(foodGroupDetailInfo)>0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|