@Test public void testModifyCollectionTemplate() throws Exception { }
@Override public CommonResult modifyCollectionTemplate(CollectionTemplateParam collectionTemplateParam){ Integer roleId = collectionTemplateParam.getRoleId(); String pastName = collectionTemplateParam.getName(); String newName = collectionTemplateParam.getNewName(); Integer type = collectionTemplateParam.getType(); if(roleId == null || pastName == null || newName == null) return CommonResult.fail(ResultCode.E_801); if(!newName.equals(pastName)){ if(type == 1 && 0 != inspectionTemplateMapper.getByRIdAndName(roleId, newName).size()) return CommonResult.fail(ResultCode.E_806); else if(type == 2 && 0 != examinationTemplateMapper.getByRIdAndName(roleId, newName).size()) return CommonResult.fail(ResultCode.E_806); else if(type == 3 && 0 != treatmentTemplateMapper.getByRIdAndName(roleId, newName).size()) return CommonResult.fail(ResultCode.E_806); else if(type != 1 && type != 2 && type != 3) return CommonResult.fail(ResultCode.E_801); } if (200 != deleteCollectionTemplate(collectionTemplateParam).getCode()) return CommonResult.fail(); return insertCollectionTemplate(collectionTemplateParam); }
ProjectCollectionTemplateServiceImpl implements ProjectCollectionTemplateService { @Override public CommonResult modifyCollectionTemplate(CollectionTemplateParam collectionTemplateParam){ Integer roleId = collectionTemplateParam.getRoleId(); String pastName = collectionTemplateParam.getName(); String newName = collectionTemplateParam.getNewName(); Integer type = collectionTemplateParam.getType(); if(roleId == null || pastName == null || newName == null) return CommonResult.fail(ResultCode.E_801); if(!newName.equals(pastName)){ if(type == 1 && 0 != inspectionTemplateMapper.getByRIdAndName(roleId, newName).size()) return CommonResult.fail(ResultCode.E_806); else if(type == 2 && 0 != examinationTemplateMapper.getByRIdAndName(roleId, newName).size()) return CommonResult.fail(ResultCode.E_806); else if(type == 3 && 0 != treatmentTemplateMapper.getByRIdAndName(roleId, newName).size()) return CommonResult.fail(ResultCode.E_806); else if(type != 1 && type != 2 && type != 3) return CommonResult.fail(ResultCode.E_801); } if (200 != deleteCollectionTemplate(collectionTemplateParam).getCode()) return CommonResult.fail(); return insertCollectionTemplate(collectionTemplateParam); } }
ProjectCollectionTemplateServiceImpl implements ProjectCollectionTemplateService { @Override public CommonResult modifyCollectionTemplate(CollectionTemplateParam collectionTemplateParam){ Integer roleId = collectionTemplateParam.getRoleId(); String pastName = collectionTemplateParam.getName(); String newName = collectionTemplateParam.getNewName(); Integer type = collectionTemplateParam.getType(); if(roleId == null || pastName == null || newName == null) return CommonResult.fail(ResultCode.E_801); if(!newName.equals(pastName)){ if(type == 1 && 0 != inspectionTemplateMapper.getByRIdAndName(roleId, newName).size()) return CommonResult.fail(ResultCode.E_806); else if(type == 2 && 0 != examinationTemplateMapper.getByRIdAndName(roleId, newName).size()) return CommonResult.fail(ResultCode.E_806); else if(type == 3 && 0 != treatmentTemplateMapper.getByRIdAndName(roleId, newName).size()) return CommonResult.fail(ResultCode.E_806); else if(type != 1 && type != 2 && type != 3) return CommonResult.fail(ResultCode.E_801); } if (200 != deleteCollectionTemplate(collectionTemplateParam).getCode()) return CommonResult.fail(); return insertCollectionTemplate(collectionTemplateParam); }  }
ProjectCollectionTemplateServiceImpl implements ProjectCollectionTemplateService { @Override public CommonResult modifyCollectionTemplate(CollectionTemplateParam collectionTemplateParam){ Integer roleId = collectionTemplateParam.getRoleId(); String pastName = collectionTemplateParam.getName(); String newName = collectionTemplateParam.getNewName(); Integer type = collectionTemplateParam.getType(); if(roleId == null || pastName == null || newName == null) return CommonResult.fail(ResultCode.E_801); if(!newName.equals(pastName)){ if(type == 1 && 0 != inspectionTemplateMapper.getByRIdAndName(roleId, newName).size()) return CommonResult.fail(ResultCode.E_806); else if(type == 2 && 0 != examinationTemplateMapper.getByRIdAndName(roleId, newName).size()) return CommonResult.fail(ResultCode.E_806); else if(type == 3 && 0 != treatmentTemplateMapper.getByRIdAndName(roleId, newName).size()) return CommonResult.fail(ResultCode.E_806); else if(type != 1 && type != 2 && type != 3) return CommonResult.fail(ResultCode.E_801); } if (200 != deleteCollectionTemplate(collectionTemplateParam).getCode()) return CommonResult.fail(); return insertCollectionTemplate(collectionTemplateParam); }  @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 { @Override public CommonResult modifyCollectionTemplate(CollectionTemplateParam collectionTemplateParam){ Integer roleId = collectionTemplateParam.getRoleId(); String pastName = collectionTemplateParam.getName(); String newName = collectionTemplateParam.getNewName(); Integer type = collectionTemplateParam.getType(); if(roleId == null || pastName == null || newName == null) return CommonResult.fail(ResultCode.E_801); if(!newName.equals(pastName)){ if(type == 1 && 0 != inspectionTemplateMapper.getByRIdAndName(roleId, newName).size()) return CommonResult.fail(ResultCode.E_806); else if(type == 2 && 0 != examinationTemplateMapper.getByRIdAndName(roleId, newName).size()) return CommonResult.fail(ResultCode.E_806); else if(type == 3 && 0 != treatmentTemplateMapper.getByRIdAndName(roleId, newName).size()) return CommonResult.fail(ResultCode.E_806); else if(type != 1 && type != 2 && type != 3) return CommonResult.fail(ResultCode.E_801); } if (200 != deleteCollectionTemplate(collectionTemplateParam).getCode()) return CommonResult.fail(); return insertCollectionTemplate(collectionTemplateParam); }  @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);  }