迁移 pad 配置
This commit is contained in:
@@ -10,7 +10,6 @@ import com.czg.mergedata.cur.mapper.CurPadLayoutMapper;
|
|||||||
import com.czg.mergedata.cur.mapper.CurPadProductCategoryDetailMapper;
|
import com.czg.mergedata.cur.mapper.CurPadProductCategoryDetailMapper;
|
||||||
import com.czg.mergedata.cur.mapper.CurPadProductCategoryMapper;
|
import com.czg.mergedata.cur.mapper.CurPadProductCategoryMapper;
|
||||||
import com.czg.mergedata.cur.service.CurPadLayoutService;
|
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.OldPadLayout;
|
||||||
import com.czg.mergedata.old.entity.OldPadProductCategory;
|
import com.czg.mergedata.old.entity.OldPadProductCategory;
|
||||||
import com.czg.mergedata.old.entity.OldPadProductCategoryDetail;
|
import com.czg.mergedata.old.entity.OldPadProductCategoryDetail;
|
||||||
@@ -25,7 +24,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pad商品布局版式 服务层实现。
|
* Pad商品布局版式 服务层实现。
|
||||||
@@ -35,10 +33,6 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class CurPadLayoutServiceImpl extends ServiceImpl<CurPadLayoutMapper, CurPadLayout> implements CurPadLayoutService {
|
public class CurPadLayoutServiceImpl extends ServiceImpl<CurPadLayoutMapper, CurPadLayout> implements CurPadLayoutService {
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CurShopIdRelationService curShopIdRelationService;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private CurPadProductCategoryMapper curPadProductCategoryMapper;
|
private CurPadProductCategoryMapper curPadProductCategoryMapper;
|
||||||
|
|
||||||
@@ -61,10 +55,8 @@ public class CurPadLayoutServiceImpl extends ServiceImpl<CurPadLayoutMapper, Cur
|
|||||||
curPadProductCategoryMapper.truncateTable();
|
curPadProductCategoryMapper.truncateTable();
|
||||||
curPadProductCategoryDetailMapper.truncateTable();
|
curPadProductCategoryDetailMapper.truncateTable();
|
||||||
|
|
||||||
Map<Long, Long> oldAndCurShopIdMap = curShopIdRelationService.getOldShopIdRelation();
|
|
||||||
|
|
||||||
execPadLayout();
|
execPadLayout();
|
||||||
execPadProductCategory(oldAndCurShopIdMap);
|
execPadProductCategory();
|
||||||
execPadProductCategoryDetail();
|
execPadProductCategoryDetail();
|
||||||
|
|
||||||
return CzgResult.success("迁移成功");
|
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());
|
Page<OldPadProductCategory> page = oldPadProductCategoryService.page(PageUtils.buildPage());
|
||||||
|
|
||||||
while (!page.getRecords().isEmpty()) {
|
while (!page.getRecords().isEmpty()) {
|
||||||
savePadProductCategory(page.getRecords(), oldAndCurShopIdMap);
|
savePadProductCategory(page.getRecords());
|
||||||
page = oldPadProductCategoryService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
page = oldPadProductCategoryService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,12 +101,12 @@ public class CurPadLayoutServiceImpl extends ServiceImpl<CurPadLayoutMapper, Cur
|
|||||||
saveBatch(curPadLayoutList);
|
saveBatch(curPadLayoutList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void savePadProductCategory(List<OldPadProductCategory> oldPadProductCategoryList, Map<Long, Long> oldAndCurShopIdMap) {
|
private void savePadProductCategory(List<OldPadProductCategory> oldPadProductCategoryList) {
|
||||||
List<CurPadProductCategory> curPadProductCategoryList = new ArrayList<>();
|
List<CurPadProductCategory> curPadProductCategoryList = new ArrayList<>();
|
||||||
|
|
||||||
for (OldPadProductCategory oldPadProductCategory : oldPadProductCategoryList) {
|
for (OldPadProductCategory oldPadProductCategory : oldPadProductCategoryList) {
|
||||||
CurPadProductCategory curPadProductCategory = BeanUtil.toBean(oldPadProductCategory, CurPadProductCategory.class);
|
CurPadProductCategory curPadProductCategory = BeanUtil.toBean(oldPadProductCategory, CurPadProductCategory.class);
|
||||||
curPadProductCategory.setShopId(oldAndCurShopIdMap.get(oldPadProductCategory.getShopId()));
|
curPadProductCategory.setShopId(oldPadProductCategory.getShopId());
|
||||||
|
|
||||||
curPadProductCategoryList.add(curPadProductCategory);
|
curPadProductCategoryList.add(curPadProductCategory);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,5 +111,12 @@
|
|||||||
- tb_prod_group 表
|
- tb_prod_group 表
|
||||||
- tb_prod_group_relation 表
|
- tb_prod_group_relation 表
|
||||||
|
|
||||||
|
### 16. Pad 配置管理
|
||||||
|
> /merge/pad/mergePad
|
||||||
|
#### 执行表
|
||||||
|
- tb_pad_layout 表
|
||||||
|
- tb_pad_product_category 表
|
||||||
|
- tb_pad_product_category_detail 表
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user