Java代码示例:验证项目信息必填项
// 如果项目名称为空,则抛出异常:"项目名称不能为空!" if(StringHelper.isEmpty(item.getProjectName())) throw new RuntimeException("项目名称不能为空!");
// 如果项目类型为空,则抛出异常:"请选择项目类型!" if(StringHelper.isEmpty(item.getProjectType())) throw new RuntimeException("请选择项目类型!");
// 如果项目建设内容为空,则抛出异常:"项目建设内容不能为空!" if(StringHelper.isEmpty(item.getProjectContent())) throw new RuntimeException("项目建设内容不能为空!");
// 如果启动时间为空,则抛出异常:"启动时间不能为空!" if(StringHelper.isEmpty(item.getBeginTime())) throw new RuntimeException("启动时间不能为空!");
// 如果预计竣工时间为空,则抛出异常:"预计竣工时间不能为空!" if(StringHelper.isEmpty(item.getPlanTime())) throw new RuntimeException("预计竣工时间不能为空!");
// 如果项目负责职能部门为空,则抛出异常:"请选择项目负责职能部门!" if(StringHelper.isEmpty(item.getDept())) throw new RuntimeException("请选择项目负责职能部门!");
// 如果部门负责人为空,则抛出异常:"部门负责人不能为空!" if(StringHelper.isEmpty(item.getProjectPerson())) throw new RuntimeException("部门负责人不能为空!");
// 如果落实后续管护机制为空,则抛出异常:"落实后续管护机制不能为空!" if(StringHelper.isEmpty(item.getProtect())) throw new RuntimeException("落实后续管护机制不能为空!");
// 如果行政村为空,则抛出异常:"行政村不能为空!" if(item.getVilid() == null) throw new RuntimeException("行政村不能为空!");
// 如果自然村为空,则抛出异常:"自然村不能为空!" if(item.getNatid() == null) throw new RuntimeException("自然村不能为空!");
原文地址: https://www.cveoy.top/t/topic/p2rd 著作权归作者所有。请勿转载和采集!