package com.dy.pipIrrIrrigate.irrigateScheduling; 
 | 
  
 | 
import com.dy.common.webUtil.QueryResultVo; 
 | 
import com.dy.pipIrrGlobal.daoIr.IrIrrigateSchedulingMapper; 
 | 
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateScheduling; 
 | 
import com.dy.pipIrrGlobal.voIr.VoScheduling; 
 | 
import com.dy.pipIrrGlobal.voIr.VoSchedulingOne; 
 | 
import lombok.extern.slf4j.Slf4j; 
 | 
import org.apache.dubbo.common.utils.PojoUtils; 
 | 
import org.springframework.beans.factory.annotation.Autowired; 
 | 
import org.springframework.stereotype.Service; 
 | 
  
 | 
import java.util.Date; 
 | 
import java.util.List; 
 | 
import java.util.Map; 
 | 
  
 | 
/** 
 | 
 * @author :WuZeYu 
 | 
 * @Date :2024/5/27  10:12 
 | 
 * @LastEditTime :2024/5/27  10:12 
 | 
 * @Description 
 | 
 */ 
 | 
@Slf4j 
 | 
@Service 
 | 
public class IrIrrigateSchedulingSv { 
 | 
  
 | 
    @Autowired 
 | 
    private IrIrrigateSchedulingMapper irIrrigateSchedulingMapper; 
 | 
  
 | 
    /** 
 | 
     * 添加作物灌溉制度 
 | 
     * 
 | 
     * @param po 
 | 
     * @return 
 | 
     */ 
 | 
    public Integer addScheduling(IrIrrigateScheduling po) { 
 | 
        po.setDeleted((byte) 0); 
 | 
        po.setOperateDt(new Date()); 
 | 
        int rows = irIrrigateSchedulingMapper.insertSelective(po); 
 | 
        if (rows == 0) { 
 | 
            return 0; 
 | 
        } 
 | 
        return 1; 
 | 
    } 
 | 
    /** 
 | 
     * 删除作物灌溉制度 
 | 
     * 
 | 
     * @param id 
 | 
     */ 
 | 
    public Integer deleteScheduling(Long id) { 
 | 
        int rows = irIrrigateSchedulingMapper.deleteLogicById(id); 
 | 
        if (rows == 0) { 
 | 
            return 0; 
 | 
        } 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 修改作物灌溉制度 
 | 
     * @param po 
 | 
     * @return 
 | 
     */ 
 | 
    public Integer updateScheduling(IrIrrigateScheduling po){ 
 | 
        int rows = irIrrigateSchedulingMapper.updateByPrimaryKeySelective(po); 
 | 
        if (rows == 0){ 
 | 
            return 0; 
 | 
        } 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 分页查询作物灌溉制度 
 | 
     * @param queryVo 
 | 
     * @return 
 | 
     */ 
 | 
    public QueryResultVo<List<VoScheduling>> getSchedulings(QueryVo queryVo){ 
 | 
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); 
 | 
        Long itemTotal = irIrrigateSchedulingMapper.getRecordCount(params); 
 | 
  
 | 
        QueryResultVo<List<VoScheduling>> rsVo = new QueryResultVo<>(); 
 | 
        rsVo.pageSize = queryVo.pageSize; 
 | 
        rsVo.pageCurr = queryVo.pageCurr; 
 | 
        rsVo.calculateAndSet(itemTotal, params); 
 | 
        rsVo.obj = irIrrigateSchedulingMapper.getSchedulings(params); 
 | 
        return rsVo; 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 获取一个作物灌溉制度数据 
 | 
     * @param id 
 | 
     * @return 
 | 
     */ 
 | 
    public VoSchedulingOne selectById(Long id){ 
 | 
        VoSchedulingOne irCrop = irIrrigateSchedulingMapper.selectById(id); 
 | 
        return irCrop; 
 | 
    } 
 | 
} 
 |