@Test public void deleteProjectTest() throws SQLException { Project project = Project.builder().id(1L).name("name").build(); Assert.assertTrue(projectService.deleteProject(project).getCode() == ServiceResult.SUCCESS); }
public ServiceResult<String> deleteProject(Project project) throws SQLException { boolean isSussess = projectDao.getDasClient().execute(() -> { int id = projectDao.deleteProject(project); if (id <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } id = selectEntityDao.deleteByProjectId(project.getId()); if (id < 0) { throw new TransactionException(message.db_message_delete_operation_failed); } id = selectEntityDao.deleteByProjectId(project.getId()); if (id < 0) { throw new TransactionException(message.db_message_delete_operation_failed); } id = projectDbsetRelationDao.deleteByProjectId(project.getId()); if (id < 0) { throw new TransactionException(message.db_message_delete_operation_failed); } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail("deleteProject fail : " + project.toString()); }
ProjectService { public ServiceResult<String> deleteProject(Project project) throws SQLException { boolean isSussess = projectDao.getDasClient().execute(() -> { int id = projectDao.deleteProject(project); if (id <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } id = selectEntityDao.deleteByProjectId(project.getId()); if (id < 0) { throw new TransactionException(message.db_message_delete_operation_failed); } id = selectEntityDao.deleteByProjectId(project.getId()); if (id < 0) { throw new TransactionException(message.db_message_delete_operation_failed); } id = projectDbsetRelationDao.deleteByProjectId(project.getId()); if (id < 0) { throw new TransactionException(message.db_message_delete_operation_failed); } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail("deleteProject fail : " + project.toString()); } }
ProjectService { public ServiceResult<String> deleteProject(Project project) throws SQLException { boolean isSussess = projectDao.getDasClient().execute(() -> { int id = projectDao.deleteProject(project); if (id <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } id = selectEntityDao.deleteByProjectId(project.getId()); if (id < 0) { throw new TransactionException(message.db_message_delete_operation_failed); } id = selectEntityDao.deleteByProjectId(project.getId()); if (id < 0) { throw new TransactionException(message.db_message_delete_operation_failed); } id = projectDbsetRelationDao.deleteByProjectId(project.getId()); if (id < 0) { throw new TransactionException(message.db_message_delete_operation_failed); } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail("deleteProject fail : " + project.toString()); }  }
ProjectService { public ServiceResult<String> deleteProject(Project project) throws SQLException { boolean isSussess = projectDao.getDasClient().execute(() -> { int id = projectDao.deleteProject(project); if (id <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } id = selectEntityDao.deleteByProjectId(project.getId()); if (id < 0) { throw new TransactionException(message.db_message_delete_operation_failed); } id = selectEntityDao.deleteByProjectId(project.getId()); if (id < 0) { throw new TransactionException(message.db_message_delete_operation_failed); } id = projectDbsetRelationDao.deleteByProjectId(project.getId()); if (id < 0) { throw new TransactionException(message.db_message_delete_operation_failed); } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail("deleteProject 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); }
ProjectService { public ServiceResult<String> deleteProject(Project project) throws SQLException { boolean isSussess = projectDao.getDasClient().execute(() -> { int id = projectDao.deleteProject(project); if (id <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } id = selectEntityDao.deleteByProjectId(project.getId()); if (id < 0) { throw new TransactionException(message.db_message_delete_operation_failed); } id = selectEntityDao.deleteByProjectId(project.getId()); if (id < 0) { throw new TransactionException(message.db_message_delete_operation_failed); } id = projectDbsetRelationDao.deleteByProjectId(project.getId()); if (id < 0) { throw new TransactionException(message.db_message_delete_operation_failed); } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail("deleteProject 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);  }