@Test public void testSaveItems() throws Exception { }
public CommonResult saveItems(CollectionTemplateParam collectionTemplateParam, ProjectTemplateParam projectTemplateParam, String item){ int count = 0; Integer type = collectionTemplateParam.getType(); Integer projectId = projectTemplateParam.getProjectId(); if(type == 1){ InspectionTemplate inspectionTemplate = new InspectionTemplate(); inspectionTemplate.setName(collectionTemplateParam.getNewName()); inspectionTemplate.setProjectId(projectId); inspectionTemplate.setItemId(item); inspectionTemplate.setRoleId(collectionTemplateParam.getRoleId()); Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); inspectionTemplate.setDepartmentId(departmentId); inspectionTemplate.setScope(collectionTemplateParam.getScope()); inspectionTemplate.setRequirement(projectTemplateParam.getRequirement()); inspectionTemplate.setGoal(projectTemplateParam.getGoal()); count = inspectionTemplateMapper.insertSelective(inspectionTemplate); } else if(type == 2) { ExaminationTemplate examinationTemplate = new ExaminationTemplate(); examinationTemplate.setName(collectionTemplateParam.getNewName()); examinationTemplate.setProjectId(projectId); examinationTemplate.setItemId(item); examinationTemplate.setRoleId(collectionTemplateParam.getRoleId()); Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); examinationTemplate.setDepartmentId(departmentId); examinationTemplate.setScope(collectionTemplateParam.getScope()); examinationTemplate.setRequirement(projectTemplateParam.getRequirement()); examinationTemplate.setGoal(projectTemplateParam.getGoal()); count = examinationTemplateMapper.insertSelective(examinationTemplate); } else if(type == 3){ TreatmentTemplate treatmentTemplate = new TreatmentTemplate(); treatmentTemplate.setName(collectionTemplateParam.getNewName()); treatmentTemplate.setProjectId(projectId); treatmentTemplate.setRoleId(collectionTemplateParam.getRoleId()); Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); treatmentTemplate.setDepartmentId(departmentId); treatmentTemplate.setScope(collectionTemplateParam.getScope()); treatmentTemplate.setGoal(projectTemplateParam.getGoal()); treatmentTemplate.setRequirement(projectTemplateParam.getRequirement()); count = treatmentTemplateMapper.insertSelective(treatmentTemplate); } if(count <= 0) return CommonResult.fail(ResultCode.E_802); return CommonResult.success(count); }
ProjectCollectionTemplateServiceImpl implements ProjectCollectionTemplateService { public CommonResult saveItems(CollectionTemplateParam collectionTemplateParam, ProjectTemplateParam projectTemplateParam, String item){ int count = 0; Integer type = collectionTemplateParam.getType(); Integer projectId = projectTemplateParam.getProjectId(); if(type == 1){ InspectionTemplate inspectionTemplate = new InspectionTemplate(); inspectionTemplate.setName(collectionTemplateParam.getNewName()); inspectionTemplate.setProjectId(projectId); inspectionTemplate.setItemId(item); inspectionTemplate.setRoleId(collectionTemplateParam.getRoleId()); Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); inspectionTemplate.setDepartmentId(departmentId); inspectionTemplate.setScope(collectionTemplateParam.getScope()); inspectionTemplate.setRequirement(projectTemplateParam.getRequirement()); inspectionTemplate.setGoal(projectTemplateParam.getGoal()); count = inspectionTemplateMapper.insertSelective(inspectionTemplate); } else if(type == 2) { ExaminationTemplate examinationTemplate = new ExaminationTemplate(); examinationTemplate.setName(collectionTemplateParam.getNewName()); examinationTemplate.setProjectId(projectId); examinationTemplate.setItemId(item); examinationTemplate.setRoleId(collectionTemplateParam.getRoleId()); Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); examinationTemplate.setDepartmentId(departmentId); examinationTemplate.setScope(collectionTemplateParam.getScope()); examinationTemplate.setRequirement(projectTemplateParam.getRequirement()); examinationTemplate.setGoal(projectTemplateParam.getGoal()); count = examinationTemplateMapper.insertSelective(examinationTemplate); } else if(type == 3){ TreatmentTemplate treatmentTemplate = new TreatmentTemplate(); treatmentTemplate.setName(collectionTemplateParam.getNewName()); treatmentTemplate.setProjectId(projectId); treatmentTemplate.setRoleId(collectionTemplateParam.getRoleId()); Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); treatmentTemplate.setDepartmentId(departmentId); treatmentTemplate.setScope(collectionTemplateParam.getScope()); treatmentTemplate.setGoal(projectTemplateParam.getGoal()); treatmentTemplate.setRequirement(projectTemplateParam.getRequirement()); count = treatmentTemplateMapper.insertSelective(treatmentTemplate); } if(count <= 0) return CommonResult.fail(ResultCode.E_802); return CommonResult.success(count); } }
ProjectCollectionTemplateServiceImpl implements ProjectCollectionTemplateService { public CommonResult saveItems(CollectionTemplateParam collectionTemplateParam, ProjectTemplateParam projectTemplateParam, String item){ int count = 0; Integer type = collectionTemplateParam.getType(); Integer projectId = projectTemplateParam.getProjectId(); if(type == 1){ InspectionTemplate inspectionTemplate = new InspectionTemplate(); inspectionTemplate.setName(collectionTemplateParam.getNewName()); inspectionTemplate.setProjectId(projectId); inspectionTemplate.setItemId(item); inspectionTemplate.setRoleId(collectionTemplateParam.getRoleId()); Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); inspectionTemplate.setDepartmentId(departmentId); inspectionTemplate.setScope(collectionTemplateParam.getScope()); inspectionTemplate.setRequirement(projectTemplateParam.getRequirement()); inspectionTemplate.setGoal(projectTemplateParam.getGoal()); count = inspectionTemplateMapper.insertSelective(inspectionTemplate); } else if(type == 2) { ExaminationTemplate examinationTemplate = new ExaminationTemplate(); examinationTemplate.setName(collectionTemplateParam.getNewName()); examinationTemplate.setProjectId(projectId); examinationTemplate.setItemId(item); examinationTemplate.setRoleId(collectionTemplateParam.getRoleId()); Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); examinationTemplate.setDepartmentId(departmentId); examinationTemplate.setScope(collectionTemplateParam.getScope()); examinationTemplate.setRequirement(projectTemplateParam.getRequirement()); examinationTemplate.setGoal(projectTemplateParam.getGoal()); count = examinationTemplateMapper.insertSelective(examinationTemplate); } else if(type == 3){ TreatmentTemplate treatmentTemplate = new TreatmentTemplate(); treatmentTemplate.setName(collectionTemplateParam.getNewName()); treatmentTemplate.setProjectId(projectId); treatmentTemplate.setRoleId(collectionTemplateParam.getRoleId()); Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); treatmentTemplate.setDepartmentId(departmentId); treatmentTemplate.setScope(collectionTemplateParam.getScope()); treatmentTemplate.setGoal(projectTemplateParam.getGoal()); treatmentTemplate.setRequirement(projectTemplateParam.getRequirement()); count = treatmentTemplateMapper.insertSelective(treatmentTemplate); } if(count <= 0) return CommonResult.fail(ResultCode.E_802); return CommonResult.success(count); }  }
ProjectCollectionTemplateServiceImpl implements ProjectCollectionTemplateService { public CommonResult saveItems(CollectionTemplateParam collectionTemplateParam, ProjectTemplateParam projectTemplateParam, String item){ int count = 0; Integer type = collectionTemplateParam.getType(); Integer projectId = projectTemplateParam.getProjectId(); if(type == 1){ InspectionTemplate inspectionTemplate = new InspectionTemplate(); inspectionTemplate.setName(collectionTemplateParam.getNewName()); inspectionTemplate.setProjectId(projectId); inspectionTemplate.setItemId(item); inspectionTemplate.setRoleId(collectionTemplateParam.getRoleId()); Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); inspectionTemplate.setDepartmentId(departmentId); inspectionTemplate.setScope(collectionTemplateParam.getScope()); inspectionTemplate.setRequirement(projectTemplateParam.getRequirement()); inspectionTemplate.setGoal(projectTemplateParam.getGoal()); count = inspectionTemplateMapper.insertSelective(inspectionTemplate); } else if(type == 2) { ExaminationTemplate examinationTemplate = new ExaminationTemplate(); examinationTemplate.setName(collectionTemplateParam.getNewName()); examinationTemplate.setProjectId(projectId); examinationTemplate.setItemId(item); examinationTemplate.setRoleId(collectionTemplateParam.getRoleId()); Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); examinationTemplate.setDepartmentId(departmentId); examinationTemplate.setScope(collectionTemplateParam.getScope()); examinationTemplate.setRequirement(projectTemplateParam.getRequirement()); examinationTemplate.setGoal(projectTemplateParam.getGoal()); count = examinationTemplateMapper.insertSelective(examinationTemplate); } else if(type == 3){ TreatmentTemplate treatmentTemplate = new TreatmentTemplate(); treatmentTemplate.setName(collectionTemplateParam.getNewName()); treatmentTemplate.setProjectId(projectId); treatmentTemplate.setRoleId(collectionTemplateParam.getRoleId()); Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); treatmentTemplate.setDepartmentId(departmentId); treatmentTemplate.setScope(collectionTemplateParam.getScope()); treatmentTemplate.setGoal(projectTemplateParam.getGoal()); treatmentTemplate.setRequirement(projectTemplateParam.getRequirement()); count = treatmentTemplateMapper.insertSelective(treatmentTemplate); } if(count <= 0) return CommonResult.fail(ResultCode.E_802); return CommonResult.success(count); }  @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 saveItems(CollectionTemplateParam collectionTemplateParam, ProjectTemplateParam projectTemplateParam, String item){ int count = 0; Integer type = collectionTemplateParam.getType(); Integer projectId = projectTemplateParam.getProjectId(); if(type == 1){ InspectionTemplate inspectionTemplate = new InspectionTemplate(); inspectionTemplate.setName(collectionTemplateParam.getNewName()); inspectionTemplate.setProjectId(projectId); inspectionTemplate.setItemId(item); inspectionTemplate.setRoleId(collectionTemplateParam.getRoleId()); Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); inspectionTemplate.setDepartmentId(departmentId); inspectionTemplate.setScope(collectionTemplateParam.getScope()); inspectionTemplate.setRequirement(projectTemplateParam.getRequirement()); inspectionTemplate.setGoal(projectTemplateParam.getGoal()); count = inspectionTemplateMapper.insertSelective(inspectionTemplate); } else if(type == 2) { ExaminationTemplate examinationTemplate = new ExaminationTemplate(); examinationTemplate.setName(collectionTemplateParam.getNewName()); examinationTemplate.setProjectId(projectId); examinationTemplate.setItemId(item); examinationTemplate.setRoleId(collectionTemplateParam.getRoleId()); Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); examinationTemplate.setDepartmentId(departmentId); examinationTemplate.setScope(collectionTemplateParam.getScope()); examinationTemplate.setRequirement(projectTemplateParam.getRequirement()); examinationTemplate.setGoal(projectTemplateParam.getGoal()); count = examinationTemplateMapper.insertSelective(examinationTemplate); } else if(type == 3){ TreatmentTemplate treatmentTemplate = new TreatmentTemplate(); treatmentTemplate.setName(collectionTemplateParam.getNewName()); treatmentTemplate.setProjectId(projectId); treatmentTemplate.setRoleId(collectionTemplateParam.getRoleId()); Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); treatmentTemplate.setDepartmentId(departmentId); treatmentTemplate.setScope(collectionTemplateParam.getScope()); treatmentTemplate.setGoal(projectTemplateParam.getGoal()); treatmentTemplate.setRequirement(projectTemplateParam.getRequirement()); count = treatmentTemplateMapper.insertSelective(treatmentTemplate); } if(count <= 0) return CommonResult.fail(ResultCode.E_802); return CommonResult.success(count); }  @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);  }