|
@@ -156,18 +156,25 @@ public class PoTetherServiceImpl extends ServiceImpl<PoTetherMapper,PoTether> im
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void insertPoTetherWithCollection(TetherVo tetherVo) {
|
|
|
- //保存套系的基本数据到套系表tether
|
|
|
- this.poTetherMapper.insertPoTether(tetherVo);
|
|
|
- //套系包含藏品
|
|
|
- //保存藏品数据到中间表 批量增加
|
|
|
- System.out.println(tetherVo.getPoTetherandcollections().size());
|
|
|
- for (int i = 0 ; i < tetherVo.getPoTetherandcollections().size();i++) {
|
|
|
- System.out.println(tetherVo.getPoTetherandcollections().get(i).getCollectionTitle());
|
|
|
- PoTetherandcollection poTetherandcollection1 = new PoTetherandcollection();
|
|
|
- poTetherandcollection1.setCollectionTitle(tetherVo.getPoTetherandcollections().get(i).getCollectionTitle());
|
|
|
- poTetherandcollection1.setCollectionType(tetherVo.getPoTetherandcollections().get(i).getCollectionType());
|
|
|
- poTetherandcollection1.setTetherId(tetherVo.getTetherId());
|
|
|
- poTetherandcollectionService.insertPoTetherandcollection(poTetherandcollection1);
|
|
|
+ if (tetherVo.getPoTetherandcollections() == null){
|
|
|
+ //保存套系的基本数据到套系表tether
|
|
|
+ this.poTetherMapper.insertPoTether(tetherVo);
|
|
|
+ }else {
|
|
|
+
|
|
|
+ this.poTetherMapper.insertPoTether(tetherVo);
|
|
|
+ //套系包含藏品
|
|
|
+ //保存藏品数据到中间表 批量增加
|
|
|
+ System.out.println(tetherVo.getPoTetherandcollections().size());
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 0; i < tetherVo.getPoTetherandcollections().size(); i++) {
|
|
|
+ System.out.println(tetherVo.getPoTetherandcollections().get(i).getCollectionTitle());
|
|
|
+ PoTetherandcollection poTetherandcollection1 = new PoTetherandcollection();
|
|
|
+ poTetherandcollection1.setCollectionTitle(tetherVo.getPoTetherandcollections().get(i).getCollectionTitle());
|
|
|
+ poTetherandcollection1.setCollectionType(tetherVo.getPoTetherandcollections().get(i).getCollectionType());
|
|
|
+ poTetherandcollection1.setTetherId(tetherVo.getTetherId());
|
|
|
+ poTetherandcollectionService.insertPoTetherandcollection(poTetherandcollection1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
@@ -194,24 +201,28 @@ public class PoTetherServiceImpl extends ServiceImpl<PoTetherMapper,PoTether> im
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void updatePoTetherWithCollection(TetherVo tetherVo) {
|
|
|
- //更新po_tether表基本信息
|
|
|
- this.poTetherMapper.updatePoTether(tetherVo);
|
|
|
- //清理po_collection表数据
|
|
|
- LambdaQueryWrapper<PoTetherandcollection> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- lambdaQueryWrapper.eq(PoTetherandcollection::getTetherId,tetherVo.getTetherId());
|
|
|
- poTetherandcollectionService.remove(lambdaQueryWrapper);
|
|
|
-// //添加当前提交过来的藏品数据--po_Tetherandcollection表的insert操作
|
|
|
+ if (tetherVo.getPoTetherandcollections() == null){
|
|
|
+ //更新po_tether表基本信息
|
|
|
+ this.poTetherMapper.updatePoTether(tetherVo);
|
|
|
+ }
|
|
|
+ else {
|
|
|
|
|
|
- for (int i = 0 ; i < tetherVo.getPoTetherandcollections().size();i++) {
|
|
|
+ this.poTetherMapper.updatePoTether(tetherVo);
|
|
|
+ //清理po_collection表数据
|
|
|
+ LambdaQueryWrapper<PoTetherandcollection> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(PoTetherandcollection::getTetherId, tetherVo.getTetherId());
|
|
|
+ poTetherandcollectionService.remove(lambdaQueryWrapper);
|
|
|
+// //添加当前提交过来的藏品数据--po_Tetherandcollection表的insert操作
|
|
|
|
|
|
- System.out.println(tetherVo.getPoTetherandcollections().get(i).getCollectionTitle());
|
|
|
- PoTetherandcollection poTetherandcollection1 = new PoTetherandcollection();
|
|
|
- poTetherandcollection1.setCollectionTitle(tetherVo.getPoTetherandcollections().get(i).getCollectionTitle());
|
|
|
- poTetherandcollection1.setCollectionType(tetherVo.getPoTetherandcollections().get(i).getCollectionType());
|
|
|
- poTetherandcollection1.setTetherId(tetherVo.getTetherId());
|
|
|
- poTetherandcollectionService.insertPoTetherandcollection(poTetherandcollection1);
|
|
|
+ for (int i = 0; i < tetherVo.getPoTetherandcollections().size(); i++) {
|
|
|
+ System.out.println(tetherVo.getPoTetherandcollections().get(i).getCollectionTitle());
|
|
|
+ PoTetherandcollection poTetherandcollection1 = new PoTetherandcollection();
|
|
|
+ poTetherandcollection1.setCollectionTitle(tetherVo.getPoTetherandcollections().get(i).getCollectionTitle());
|
|
|
+ poTetherandcollection1.setCollectionType(tetherVo.getPoTetherandcollections().get(i).getCollectionType());
|
|
|
+ poTetherandcollection1.setTetherId(tetherVo.getTetherId());
|
|
|
+ poTetherandcollectionService.insertPoTetherandcollection(poTetherandcollection1);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|