Commit 0e12b330 authored by chase's avatar chase

修改模板删除为物理删除

parent 86211194
...@@ -260,23 +260,26 @@ public class TemplateServiceImpl extends AbstractService { ...@@ -260,23 +260,26 @@ public class TemplateServiceImpl extends AbstractService {
String path = ""; String path = "";
if (templateDb != null) { if (templateDb != null) {
TemplateExample example = new TemplateExample(); // TemplateExample example = new TemplateExample();
example.createCriteria().andCodeEqualTo(templateDb.getCode()).andIdEqualTo(templateDb.getId()).andIsActiveAssociationEqualTo(false); // example.createCriteria().andCodeEqualTo(templateDb.getCode()).andIdEqualTo(templateDb.getId()).andIsActiveAssociationEqualTo(false);
long count = templateMapper.countByExample(example);
if (count > 0) {
path = templateDb.getPath();
//物理删除
deleteIsAtiveAssociation(templateDb);
} else {
if (param.isDeletePermanent() && !templateDb.getIsSystemType()) {
path = templateDb.getPath(); path = templateDb.getPath();
//物理删除 //物理删除
deleteIsAtiveAssociation(templateDb); deleteIsAtiveAssociation(templateDb);
} else { // long count = templateMapper.countByExample(example);
//逻辑删除 // if (count > 0) {
logicDeleteIsActiveAssociation(templateDb); // path = templateDb.getPath();
} // //物理删除
} // deleteIsAtiveAssociation(templateDb);
// } else {
// if (param.isDeletePermanent() && !templateDb.getIsSystemType()) {
// path = templateDb.getPath();
// //物理删除
// deleteIsAtiveAssociation(templateDb);
// } else {
// //逻辑删除
// logicDeleteIsActiveAssociation(templateDb);
// }
// }
} }
result.setResult(true); result.setResult(true);
...@@ -406,10 +409,16 @@ public class TemplateServiceImpl extends AbstractService { ...@@ -406,10 +409,16 @@ public class TemplateServiceImpl extends AbstractService {
} }
private void deleteIsAtiveAssociation(Template templateDb) { private void deleteIsAtiveAssociation(Template templateDb) {
if(templateDb.getId() == null){
return;
}
cellTemplateConfigMapper.deleteCellTemplateConfigByCellTemplate(templateDb.getId()); cellTemplateConfigMapper.deleteCellTemplateConfigByCellTemplate(templateDb.getId());
keyValueReferenceMapper.deleteKeyValueReferenceByCellTemplate(templateDb.getId()); keyValueReferenceMapper.deleteKeyValueReferenceByCellTemplate(templateDb.getId());
CellTemplateExample example = new CellTemplateExample(); CellTemplateExample example = new CellTemplateExample();
example.createCriteria().andReportTemplateIdEqualTo(templateDb.getId()); example.createCriteria().andReportTemplateIdEqualTo(templateDb.getId());
cellTemplateMapper.deleteByExample(example); cellTemplateMapper.deleteByExample(example);
TemplateExample templateExample = new TemplateExample();
templateExample.createCriteria().andIdEqualTo(templateDb.getId());
templateMapper.deleteByExample(templateExample);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment