|  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据轮灌组名称查询是否存在(添加轮灌组时使用) | 
 |  |  |      * @param groupCode 轮灌组名称 | 
 |  |  |      * @return 是否存在 | 
 |  |  |      */ | 
 |  |  |     public boolean existsByGroupCode(String groupCode) { | 
 |  |  |         if (groupCode == null || "".equals(groupCode.trim())) { | 
 |  |  |             return false; | 
 |  |  |         } | 
 |  |  |         return irIrrigateGroupMapper.countByGroupCode(groupCode) > 0; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据轮灌组名称查询是否存在(修改轮灌组时使用,排除当前ID) | 
 |  |  |      * @param groupCode 轮灌组名称 | 
 |  |  |      * @param excludeId 需要排除的ID | 
 |  |  |      * @return 是否存在 | 
 |  |  |      */ | 
 |  |  |     public boolean existsByGroupCodeExcludeId(String groupCode, Long excludeId) { | 
 |  |  |         if (groupCode == null || "".equals(groupCode.trim())) { | 
 |  |  |             return false; | 
 |  |  |         } | 
 |  |  |         return irIrrigateGroupMapper.countByGroupCodeExcludeId(groupCode, excludeId) > 0; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 删除轮灌组与农户管理 | 
 |  |  |      * @param id | 
 |  |  |      * @return | 
 |  |  | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public Map updateIrrigateGroup(IrrigateGroup po) { | 
 |  |  |         // 修改轮灌组 | 
 |  |  |         IrIrrigateGroup irrigateGroup = new IrIrrigateGroup(); | 
 |  |  |         irrigateGroup.setId(po.getGroupId()); | 
 |  |  |         irrigateGroup.setGroupCode(po.getGroupCode()); | 
 |  |  |         irrigateGroup.setDefaultDuration(po.getDefaultDuration()); | 
 |  |  |         irrigateGroup.setOperator(po.getOperator()); | 
 |  |  |         irrigateGroup.setOperateTime(new Date()); | 
 |  |  |         irrigateGroup.setDeleted((byte) 0); | 
 |  |  |         irIrrigateGroupMapper.updateByPrimaryKeySelective(irrigateGroup); | 
 |  |  |  | 
 |  |  |         // 删除轮灌组与取水口关联 | 
 |  |  |         Long groupId = po.getGroupId(); | 
 |  |  |         Map map_deleteGroup = deleteGroup(groupId); | 
 |  |  |         if(map_deleteGroup.get("success").equals(false)) { | 
 |  |  |             Map map = new HashMap<>(); | 
 |  |  |             map.put("success", false); | 
 |  |  |             map.put("msg", map_deleteGroup.get("msg").toString()); | 
 |  |  |             map.put("content", null); | 
 |  |  |             return map; | 
 |  |  |         } | 
 |  |  |         irGroupIntakeMapper.deleteByGroupId(groupId); | 
 |  |  |  | 
 |  |  |         Map map_addGroup = addIrrigateGroup(po); | 
 |  |  |         if(map_addGroup.get("success").equals(false)) { | 
 |  |  |             Map map = new HashMap<>(); | 
 |  |  |             map.put("success", false); | 
 |  |  |             map.put("msg", map_addGroup.get("msg").toString()); | 
 |  |  |             map.put("content", null); | 
 |  |  |             return map; | 
 |  |  |         } | 
 |  |  |         // 添加轮灌组与取水口关联 | 
 |  |  |         String[] intakeArr = po.getIntakes().split(","); | 
 |  |  |         Integer sort = 1; | 
 |  |  |         for(String intekeId : intakeArr) { | 
 |  |  |             String trimmed = intekeId.trim(); | 
 |  |  |             if(trimmed.isEmpty()) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |             try { | 
 |  |  |                 Long intakeIdLong = Long.parseLong(trimmed); | 
 |  |  |                 IrGroupIntake irGroupIntake = new IrGroupIntake(); | 
 |  |  |                 irGroupIntake.setGroupId(groupId); | 
 |  |  |                 irGroupIntake.setIntakeId(intakeIdLong); | 
 |  |  |                 irGroupIntakeMapper.insert(irGroupIntake); | 
 |  |  |             } catch (NumberFormatException  e) { | 
 |  |  |                 Map map = new HashMap<>(); | 
 |  |  |                 map.put("success", false); | 
 |  |  |                 map.put("msg", "取水口ID格式错误"); | 
 |  |  |                 map.put("content", null); | 
 |  |  |                 return map; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |         Map map = new HashMap<>(); | 
 |  |  |         map.put("success", true); | 
 |  |  |         map.put("msg", "修改轮灌组成功"); | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 获取项目下轮灌组 | 
 |  |  |      * @param queryVo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public List<VoGroupSimple> getGroupsByProjectId(QoGroup queryVo) { | 
 |  |  |         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); | 
 |  |  |         return irIrrigateGroupMapper.getSimpleGroups(params); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 查询全部轮灌组 | 
 |  |  |      * @return | 
 |  |  |      */ |