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