|  |  | 
 |  |  | package com.dy.pipIrrIrrigate.irrigateGroup; | 
 |  |  |  | 
 |  |  | import com.dy.common.webUtil.QueryResultVo; | 
 |  |  | import com.dy.pipIrrGlobal.daoIr.IrGroupClientMapper; | 
 |  |  | import com.dy.pipIrrGlobal.daoIr.IrGroupUnitMapper; | 
 |  |  | import com.dy.pipIrrGlobal.daoIr.IrIrrigateGroupMapper; | 
 |  |  | import com.dy.pipIrrGlobal.pojoIr.IrGroupClient; | 
 |  |  | import com.dy.pipIrrGlobal.pojoIr.IrGroupUnit; | 
 |  |  | import com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup; | 
 |  |  | import com.dy.pipIrrGlobal.voIr.VoGroup; | 
 |  |  | 
 |  |  | @Slf4j | 
 |  |  | @Service | 
 |  |  | public class IrrigateGroupSv { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private IrIrrigateGroupMapper irIrrigateGroupMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private IrGroupUnitMapper irGroupUnitMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private IrGroupClientMapper irGroupClientMapper; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 创建轮灌组 | 
 |  |  | 
 |  |  |      */ | 
 |  |  |     public Integer addGroupUnit(IrGroupUnit po) { | 
 |  |  |         po.setOperateDt(new Date()); | 
 |  |  |         po.setDeleted((byte) 0); | 
 |  |  |         int rows = irGroupUnitMapper.insertSelective(po); | 
 |  |  |         if (rows == 0) { | 
 |  |  |             return 0; | 
 |  |  | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public Integer deleteGroupUnit(IrGroupUnit po) { | 
 |  |  |         po.setOperateDt(new Date()); | 
 |  |  |         int rows = irGroupUnitMapper.deleteByUnitIdGroupId(po); | 
 |  |  |         if (rows == 0) { | 
 |  |  |             return 0; | 
 |  |  |         } | 
 |  |  |         return 1; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 查一个轮灌组绑定的灌溉单元id | 
 |  |  |      * @param groupId | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public List<Long> getGroupBindUnits(Long groupId) { | 
 |  |  |         List<Long> groupBindUnits = irGroupUnitMapper.getGroupBindUnits(groupId); | 
 |  |  |         return groupBindUnits; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      *     //查未绑定轮灌组的灌溉单元id | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public List<Long> getNotBindUnits() { | 
 |  |  |         List<Long> notBindUnits = irGroupUnitMapper.getNotBindUnits(); | 
 |  |  |         return notBindUnits; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     //轮灌组关联农户 | 
 |  |  |     public Long addGroupClient(IrGroupClient po) { | 
 |  |  |         irGroupClientMapper.insert(po); | 
 |  |  |         return po.getId(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 删除轮灌组与农户管理 | 
 |  |  |      * @param id | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public Integer deleteGroupClient (Long id) { | 
 |  |  |         return irGroupClientMapper.deleteByPrimaryKey(id); | 
 |  |  |     } | 
 |  |  | } |