@Test public void testDeleteCollectionTemplate() throws Exception { }
public CommonResult deleteCollectionTemplate(CollectionTemplateParam collectionTemplateParam){ Integer roleId = collectionTemplateParam.getRoleId(); String name = collectionTemplateParam.getName(); Integer type = collectionTemplateParam.getType(); if(roleId == null || name == null || (type != 1 && type != 2 && type !=3)) return CommonResult.fail(ResultCode.E_801); if (type == 1) { if(0 == inspectionTemplateMapper.getByRIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_807); inspectionTemplateMapper.deleteTemplateByRoleIdAndName(roleId, name); } else if(type == 2) { if(0 == examinationTemplateMapper.getByRIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_807); examinationTemplateMapper.deleteTemplateByRoleIdAndName(roleId, name); } else if(type == 3) { if(0 == treatmentTemplateMapper.getByRIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_807); treatmentTemplateMapper.deleteTemplateByRoleIdAndName(roleId, name); } else return CommonResult.fail(ResultCode.E_801); return CommonResult.success(0); }
ProjectCollectionTemplateServiceImpl implements ProjectCollectionTemplateService { public CommonResult deleteCollectionTemplate(CollectionTemplateParam collectionTemplateParam){ Integer roleId = collectionTemplateParam.getRoleId(); String name = collectionTemplateParam.getName(); Integer type = collectionTemplateParam.getType(); if(roleId == null || name == null || (type != 1 && type != 2 && type !=3)) return CommonResult.fail(ResultCode.E_801); if (type == 1) { if(0 == inspectionTemplateMapper.getByRIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_807); inspectionTemplateMapper.deleteTemplateByRoleIdAndName(roleId, name); } else if(type == 2) { if(0 == examinationTemplateMapper.getByRIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_807); examinationTemplateMapper.deleteTemplateByRoleIdAndName(roleId, name); } else if(type == 3) { if(0 == treatmentTemplateMapper.getByRIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_807); treatmentTemplateMapper.deleteTemplateByRoleIdAndName(roleId, name); } else return CommonResult.fail(ResultCode.E_801); return CommonResult.success(0); } }
ProjectCollectionTemplateServiceImpl implements ProjectCollectionTemplateService { public CommonResult deleteCollectionTemplate(CollectionTemplateParam collectionTemplateParam){ Integer roleId = collectionTemplateParam.getRoleId(); String name = collectionTemplateParam.getName(); Integer type = collectionTemplateParam.getType(); if(roleId == null || name == null || (type != 1 && type != 2 && type !=3)) return CommonResult.fail(ResultCode.E_801); if (type == 1) { if(0 == inspectionTemplateMapper.getByRIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_807); inspectionTemplateMapper.deleteTemplateByRoleIdAndName(roleId, name); } else if(type == 2) { if(0 == examinationTemplateMapper.getByRIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_807); examinationTemplateMapper.deleteTemplateByRoleIdAndName(roleId, name); } else if(type == 3) { if(0 == treatmentTemplateMapper.getByRIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_807); treatmentTemplateMapper.deleteTemplateByRoleIdAndName(roleId, name); } else return CommonResult.fail(ResultCode.E_801); return CommonResult.success(0); }  }
ProjectCollectionTemplateServiceImpl implements ProjectCollectionTemplateService { public CommonResult deleteCollectionTemplate(CollectionTemplateParam collectionTemplateParam){ Integer roleId = collectionTemplateParam.getRoleId(); String name = collectionTemplateParam.getName(); Integer type = collectionTemplateParam.getType(); if(roleId == null || name == null || (type != 1 && type != 2 && type !=3)) return CommonResult.fail(ResultCode.E_801); if (type == 1) { if(0 == inspectionTemplateMapper.getByRIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_807); inspectionTemplateMapper.deleteTemplateByRoleIdAndName(roleId, name); } else if(type == 2) { if(0 == examinationTemplateMapper.getByRIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_807); examinationTemplateMapper.deleteTemplateByRoleIdAndName(roleId, name); } else if(type == 3) { if(0 == treatmentTemplateMapper.getByRIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_807); treatmentTemplateMapper.deleteTemplateByRoleIdAndName(roleId, name); } else return CommonResult.fail(ResultCode.E_801); return CommonResult.success(0); }  @Override CommonResult insertCollectionTemplate(CollectionTemplateParam collectionTemplateParam); CommonResult saveItems(CollectionTemplateParam collectionTemplateParam,
                                  ProjectTemplateParam projectTemplateParam, String item); Boolean isAvailable(Integer roleId, String name, Integer type); @Override CommonResult listCollectionTemplate(Integer roleId, Integer type); CommonResult deleteCollectionTemplate(CollectionTemplateParam collectionTemplateParam); @Override CommonResult modifyCollectionTemplate(CollectionTemplateParam collectionTemplateParam); }
ProjectCollectionTemplateServiceImpl implements ProjectCollectionTemplateService { public CommonResult deleteCollectionTemplate(CollectionTemplateParam collectionTemplateParam){ Integer roleId = collectionTemplateParam.getRoleId(); String name = collectionTemplateParam.getName(); Integer type = collectionTemplateParam.getType(); if(roleId == null || name == null || (type != 1 && type != 2 && type !=3)) return CommonResult.fail(ResultCode.E_801); if (type == 1) { if(0 == inspectionTemplateMapper.getByRIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_807); inspectionTemplateMapper.deleteTemplateByRoleIdAndName(roleId, name); } else if(type == 2) { if(0 == examinationTemplateMapper.getByRIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_807); examinationTemplateMapper.deleteTemplateByRoleIdAndName(roleId, name); } else if(type == 3) { if(0 == treatmentTemplateMapper.getByRIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_807); treatmentTemplateMapper.deleteTemplateByRoleIdAndName(roleId, name); } else return CommonResult.fail(ResultCode.E_801); return CommonResult.success(0); }  @Override CommonResult insertCollectionTemplate(CollectionTemplateParam collectionTemplateParam); CommonResult saveItems(CollectionTemplateParam collectionTemplateParam,
                                  ProjectTemplateParam projectTemplateParam, String item); Boolean isAvailable(Integer roleId, String name, Integer type); @Override CommonResult listCollectionTemplate(Integer roleId, Integer type); CommonResult deleteCollectionTemplate(CollectionTemplateParam collectionTemplateParam); @Override CommonResult modifyCollectionTemplate(CollectionTemplateParam collectionTemplateParam);  }