ProjectService { public ServiceResult<String> insertProject(Project project) throws SQLException { boolean isSussess = projectDao.getDasClient().execute(() -> { Long id = projectDao.insertProject(project); if (id <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } project.setId(id); List<ProjectDbsetRelation> list = toProjectDbsetRelations(project); if (CollectionUtils.isNotEmpty(list)) { int[] ids = projectDbsetRelationDao.insertRelationList(list); if (ids.length <= 0) { throw new TransactionException(message.db_message_add_operation_failed); } } List<UserProject> userProjects = toUserProjects(project); if (CollectionUtils.isNotEmpty(userProjects)) { int[] ids = userProjectDao.insertUserProjectList(userProjects); if (ids.length <= 0) { throw new TransactionException(message.db_message_add_operation_failed); } } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail("insertProject fail : " + project.toString()); }  ValidatorChain validatePermision(LoginUser user, Project project, Errors errors); ServiceResult<String> insertProject(Project project); ServiceResult<String> updateProject(Project project); ServiceResult deleteCheck(Long projectId); ServiceResult<String> deleteProject(Project project); ListResult<ProjectView> findProjectPageList(Paging<ProjectModel> paging); boolean isExistByAppId(String appid); boolean isNotExistByAppId(Project project); boolean isNotExistByName(Project project); ServiceResult generateProjectXml(LoginUser user, Long projectId, String codeGenFilePath); ServiceResult<String> addDataCenter(LoginUser user, Project project); ServiceResult<String> updateDataCenter(LoginUser user, Project oldProject, ProjectView oldProjectView, Project newProject); ServiceResult<String> deleteDataCenter(LoginUser user, Project projec); ServiceResult<String> syncProject(LoginUser user, Project project); ConfigCkeckResult<List<ConfigDataResponse>> getCheckData(LoginUser user, Project project); ServiceResult getProjectButton(LoginUser user);  }
@Test public void insertProjectTest() throws SQLException { Project project = Project.builder().id(1L).name("name").build(); Assert.assertTrue(projectService.insertProject(project).getCode() == ServiceResult.SUCCESS); }