|
@@ -6,6 +6,7 @@ import org.jeecg.modules.oa.entity.AssetIn;
|
|
|
import org.jeecg.modules.oa.entity.AssetInDetail;
|
|
|
import org.jeecg.modules.oa.mapper.AssetInDetailMapper;
|
|
|
import org.jeecg.modules.oa.mapper.AssetInMapper;
|
|
|
+import org.jeecg.modules.oa.mapper.AssetMapper;
|
|
|
import org.jeecg.modules.oa.service.IAssetInService;
|
|
|
import org.jeecg.modules.oa.service.IAssetService;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -33,6 +34,8 @@ public class AssetInServiceImpl extends ServiceImpl<AssetInMapper, AssetIn> impl
|
|
|
|
|
|
@Autowired
|
|
|
private IAssetService assetService;
|
|
|
+ @Autowired
|
|
|
+ private AssetMapper assetMapper;
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -61,12 +64,21 @@ public class AssetInServiceImpl extends ServiceImpl<AssetInMapper, AssetIn> impl
|
|
|
|
|
|
//1.先删除子表数据
|
|
|
assetInDetailMapper.deleteByMainId(assetIn.getId());
|
|
|
+
|
|
|
+ assetMapper.deleteByAssetInId(assetIn.getId());
|
|
|
|
|
|
//2.子表数据重新插入
|
|
|
if(assetInDetailList!=null && assetInDetailList.size()>0) {
|
|
|
for(AssetInDetail entity:assetInDetailList) {
|
|
|
//外键设置
|
|
|
entity.setCdAssetInId(assetIn.getId());
|
|
|
+ entity.setOperator(assetIn.getOperator());
|
|
|
+ entity.setOperatorDept(assetIn.getOperatorDept());
|
|
|
+ entity.setOperatorDate(assetIn.getOperatorDate());
|
|
|
+
|
|
|
+ Asset asset = new Asset();
|
|
|
+ BeanUtils.copyProperties(entity, asset);
|
|
|
+ this.assetService.save(asset);
|
|
|
assetInDetailMapper.insert(entity);
|
|
|
}
|
|
|
}
|
|
@@ -76,6 +88,7 @@ public class AssetInServiceImpl extends ServiceImpl<AssetInMapper, AssetIn> impl
|
|
|
@Transactional
|
|
|
public void delMain(String id) {
|
|
|
assetInDetailMapper.deleteByMainId(id);
|
|
|
+ assetMapper.deleteByAssetInId(id);
|
|
|
assetInMapper.deleteById(id);
|
|
|
}
|
|
|
|
|
@@ -84,6 +97,7 @@ public class AssetInServiceImpl extends ServiceImpl<AssetInMapper, AssetIn> impl
|
|
|
public void delBatchMain(Collection<? extends Serializable> idList) {
|
|
|
for(Serializable id:idList) {
|
|
|
assetInDetailMapper.deleteByMainId(id.toString());
|
|
|
+ assetMapper.deleteByAssetInId(id.toString());
|
|
|
assetInMapper.deleteById(id);
|
|
|
}
|
|
|
}
|