|  |  |  | 
|---|
|  |  |  | package com.dy.pipIrrIrrigate.irrigateUnit; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.dy.common.webUtil.QueryResultVo; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.daoIr.IrGroupUnitMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.daoIr.IrIrrigateUnitMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.daoIr.IrProjectMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.daoIr.IrUnitClientMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoIr.IrProject; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoProject; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoProjectOne; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoIr.IrUnitClient; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoUnit; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoUnitOne; | 
|---|
|  |  |  | import com.dy.pipIrrIrrigate.irrigateUnit.QueryVo; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.apache.dubbo.common.utils.PojoUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | @Service | 
|---|
|  |  |  | public class IrrigateUnitSv { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private IrIrrigateUnitMapper irIrrigateUnitMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private IrGroupUnitMapper irGroupUnitMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private IrUnitClientMapper irUnitClientMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 创建灌溉单元 | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public Integer deleteUnit(Long id) { | 
|---|
|  |  |  | int rows = irIrrigateUnitMapper.deleteLogicById(id); | 
|---|
|  |  |  | irGroupUnitMapper.deleteByUnitId(id); | 
|---|
|  |  |  | if (rows == 0) { | 
|---|
|  |  |  | return 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | rsVo.obj = irIrrigateUnitMapper.getUnits(params); | 
|---|
|  |  |  | return rsVo; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //灌溉单元分配(农户租地) | 
|---|
|  |  |  | public Long addUnitClient(IrUnitClient po) { | 
|---|
|  |  |  | irUnitClientMapper.insert(po); | 
|---|
|  |  |  | return po.getId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 删除灌溉单元与农户关联 | 
|---|
|  |  |  | * @param id | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public Integer deleteUnitClient(Long id) { | 
|---|
|  |  |  | return irUnitClientMapper.deleteByPrimaryKey(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|