迁移 pad 配置

This commit is contained in:
GYJ 2025-03-13 13:45:47 +08:00
parent b9c2436822
commit 9238d42f45
2 changed files with 12 additions and 13 deletions

View File

@ -10,7 +10,6 @@ import com.czg.mergedata.cur.mapper.CurPadLayoutMapper;
import com.czg.mergedata.cur.mapper.CurPadProductCategoryDetailMapper;
import com.czg.mergedata.cur.mapper.CurPadProductCategoryMapper;
import com.czg.mergedata.cur.service.CurPadLayoutService;
import com.czg.mergedata.cur.service.CurShopIdRelationService;
import com.czg.mergedata.old.entity.OldPadLayout;
import com.czg.mergedata.old.entity.OldPadProductCategory;
import com.czg.mergedata.old.entity.OldPadProductCategoryDetail;
@ -25,7 +24,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Pad商品布局版式 服务层实现
@ -35,10 +33,6 @@ import java.util.Map;
*/
@Service
public class CurPadLayoutServiceImpl extends ServiceImpl<CurPadLayoutMapper, CurPadLayout> implements CurPadLayoutService {
@Resource
private CurShopIdRelationService curShopIdRelationService;
@Resource
private CurPadProductCategoryMapper curPadProductCategoryMapper;
@ -61,10 +55,8 @@ public class CurPadLayoutServiceImpl extends ServiceImpl<CurPadLayoutMapper, Cur
curPadProductCategoryMapper.truncateTable();
curPadProductCategoryDetailMapper.truncateTable();
Map<Long, Long> oldAndCurShopIdMap = curShopIdRelationService.getOldShopIdRelation();
execPadLayout();
execPadProductCategory(oldAndCurShopIdMap);
execPadProductCategory();
execPadProductCategoryDetail();
return CzgResult.success("迁移成功");
@ -80,11 +72,11 @@ public class CurPadLayoutServiceImpl extends ServiceImpl<CurPadLayoutMapper, Cur
}
}
private void execPadProductCategory(Map<Long, Long> oldAndCurShopIdMap) {
private void execPadProductCategory() {
Page<OldPadProductCategory> page = oldPadProductCategoryService.page(PageUtils.buildPage());
while (!page.getRecords().isEmpty()) {
savePadProductCategory(page.getRecords(), oldAndCurShopIdMap);
savePadProductCategory(page.getRecords());
page = oldPadProductCategoryService.page(PageUtils.buildPage(page.getPageNumber() + 1));
}
}
@ -109,12 +101,12 @@ public class CurPadLayoutServiceImpl extends ServiceImpl<CurPadLayoutMapper, Cur
saveBatch(curPadLayoutList);
}
private void savePadProductCategory(List<OldPadProductCategory> oldPadProductCategoryList, Map<Long, Long> oldAndCurShopIdMap) {
private void savePadProductCategory(List<OldPadProductCategory> oldPadProductCategoryList) {
List<CurPadProductCategory> curPadProductCategoryList = new ArrayList<>();
for (OldPadProductCategory oldPadProductCategory : oldPadProductCategoryList) {
CurPadProductCategory curPadProductCategory = BeanUtil.toBean(oldPadProductCategory, CurPadProductCategory.class);
curPadProductCategory.setShopId(oldAndCurShopIdMap.get(oldPadProductCategory.getShopId()));
curPadProductCategory.setShopId(oldPadProductCategory.getShopId());
curPadProductCategoryList.add(curPadProductCategory);
}

View File

@ -111,5 +111,12 @@
- tb_prod_group 表
- tb_prod_group_relation 表
### 16. Pad 配置管理
> /merge/pad/mergePad
#### 执行表
- tb_pad_layout 表
- tb_pad_product_category 表
- tb_pad_product_category_detail 表