|
@@ -1,5 +1,7 @@
|
|
|
package org.jeecg.modules.system.app.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
@@ -13,6 +15,7 @@ import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.modules.system.app.dto.AppSiteDTO;
|
|
|
import org.jeecg.modules.system.app.dto.AppSitePageDTO;
|
|
|
import org.jeecg.modules.system.app.entity.AppSite;
|
|
|
+import org.jeecg.modules.system.app.entity.AppSitePriceRules;
|
|
|
import org.jeecg.modules.system.app.mapper.AppSiteMapper;
|
|
|
import org.jeecg.modules.system.app.mapper.AppSitePriceRulesMapper;
|
|
|
import org.jeecg.modules.system.app.service.IAppSiteService;
|
|
@@ -23,10 +26,8 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import static org.jeecg.common.constant.CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
|
|
|
|
|
@@ -90,26 +91,19 @@ public class AppSiteServiceImpl extends ServiceImpl<AppSiteMapper, AppSite> impl
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean editSite(AppSiteDTO siteCuDTO) {
|
|
|
-// String id = siteCuDTO.getId();
|
|
|
-// if (StrUtil.isNotBlank(id)) {
|
|
|
-// AppSite oldSite = baseMapper.selectById(id);
|
|
|
-// //比较运动类目,做新增删除修改
|
|
|
-// if (!oldSite.getCategoryId().equals(siteCuDTO.getCategoryId())) {
|
|
|
-// List<String> oldList = Arrays.stream(oldSite.getCategoryId().split(",")).collect(Collectors.toList());
|
|
|
-// List<String> newList = Arrays.stream(siteCuDTO.getCategoryId().split(",")).collect(Collectors.toList());
|
|
|
-// List<String> diffList = listCompare(oldList, newList);
|
|
|
-// if (ObjectUtils.isNotEmpty(diffList)) {
|
|
|
-// //删除
|
|
|
-// priceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSitePlaceId, id).in(AppSitePriceRules::getCategoryId, diffList));
|
|
|
-// //新增
|
|
|
-// for (String categoryId : newList) {
|
|
|
-// AppSitePriceRules priceRules = new AppSitePriceRules();
|
|
|
-// priceRules.setSiteId(id);
|
|
|
-// priceRules.setCategoryId(categoryId);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
+ String id = siteCuDTO.getId();
|
|
|
+ if (StrUtil.isNotBlank(id)) {
|
|
|
+ AppSite oldSite = baseMapper.selectById(id);
|
|
|
+ //比较运动类目,做新增删除修改
|
|
|
+ if (ObjectUtil.isNotNull(oldSite.getCategoryId()) && !siteCuDTO.getCategoryId().equals(oldSite.getCategoryId())) {
|
|
|
+ List<String> oldList = Arrays.stream(oldSite.getCategoryId().split(",")).collect(Collectors.toList());
|
|
|
+ List<String> newList = Arrays.stream(siteCuDTO.getCategoryId().split(",")).collect(Collectors.toList());
|
|
|
+ List<String> diffList = listCompare(oldList, newList);
|
|
|
+ if (ObjectUtils.isNotEmpty(diffList)) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
AppSite site = new AppSite();
|
|
|
BeanUtils.copyProperties(siteCuDTO, site);
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|