class ProjectController {

    @RequestMapping(value = "/syncdb")
    public ServiceResult<String> syncdb(@Validated(AddProject.class) @RequestBody Project project, @CurrentUser LoginUser user, Errors errors) throws Exception {
        DasGroup dasGroup = groupDao.getGroupByName(project.getGroupName());
        if (dasGroup == null) {
            return ServiceResult.fail("请先同步组！" + project.getGroupName());
        }
        List<DatabaseSet> list = databaseSetDao.getAllDatabaseSetByNames(StringUtil.toList(project.getDbsetNamees()));
        if (CollectionUtils.isEmpty(list)) {
            return ServiceResult.fail("请先同步逻辑库！" + project.getDbsetNamees());
        }
        String dbSetNames = project.getDbsetNamees();
        if (dbSetNames.contains(",") && list.size() < dbSetNames.split(",").length) {
            return ServiceResult.fail("请先同步全部的逻辑库！" + project.getDbsetNamees());
        }
        List<Item> items = list.stream().map(i -> new Item(i.getId(), i.getName())).collect(Collectors.toList());
        project.setDal_group_id(dasGroup.getId());
        project.setItems(items);
        return addProject(project, user, errors);
    }

}