| package com.dy.pipIrrBase.rtuUpgrade.task; | 
|   | 
| import com.dy.common.webUtil.QueryResultVo; | 
| import com.dy.pipIrrGlobal.daoRm.UgRtuControllerMapper; | 
| import com.dy.pipIrrGlobal.pojoUg.UgRtuController; | 
| import com.dy.pipIrrGlobal.voPr.VoController; | 
| 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 org.springframework.transaction.annotation.Transactional; | 
|   | 
| import java.util.List; | 
| import java.util.Map; | 
|   | 
| /** | 
|  * @Author: liurunyu | 
|  * @Date: 2024/11/7 14:50 | 
|  * @Description | 
|  */ | 
| @Slf4j | 
| @Service | 
| public class UgRtuControllerSv { | 
|   | 
|     @Autowired | 
|     private UgRtuControllerMapper dao ; | 
|   | 
|   | 
|     /** | 
|      * 分页查询一个升级任务的所有控制器 | 
|      * @return 一些控制器信息 | 
|      */ | 
|     public QueryResultVo<List<VoController>> selectSome(QueryControllerVo queryVo){ | 
|         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ; | 
|         Long itemTotal = this.dao.selectRecordCount(params) ; | 
|   | 
|         QueryResultVo<List<VoController>> rsVo = new QueryResultVo<>() ; | 
|         rsVo.pageSize = queryVo.pageSize ; | 
|         rsVo.pageCurr = queryVo.pageCurr ; | 
|         rsVo.calculateAndSet(itemTotal, params); | 
|         rsVo.obj = this.dao.selectControllers(params) ; | 
|   | 
|         return rsVo ; | 
|     } | 
|   | 
|     /** | 
|      * 查询一个升级任务所有控制器 | 
|      * @return 一些一些控制器信息 | 
|      */ | 
|     public List<UgRtuController> selectAllConByTask(Long taskId){ | 
|         List<UgRtuController> list = this.dao.selectAllConByTask(taskId) ; | 
|         return list ; | 
|     } | 
|   | 
|     /** | 
|      * 判断是否存在 | 
|      * @param taskId 任务id | 
|      * @param controllerId 控制器ID | 
|      * @return 存在否 | 
|      */ | 
|     public boolean exist(Long taskId, Long controllerId){ | 
|         Long count = this.dao.selectCountByTaskAndCon(taskId, controllerId) ; | 
|         if(count== null || count == 0){ | 
|             return false ; | 
|         }else{ | 
|             return true ; | 
|         } | 
|     } | 
|   | 
|     /** | 
|      * 新增 | 
|      * @param po 实体 | 
|      * @return 数量 | 
|      */ | 
|     @Transactional | 
|     public int save(UgRtuController po){ | 
|         return this.dao.insertSelective(po) ; | 
|     } | 
|   | 
|     /** | 
|      * 删除所有 | 
|      * @param taskId 任务主键 | 
|      * @return 数量 | 
|      */ | 
|     @Transactional | 
|     public int deleteAll(Long taskId){ | 
|         return this.dao.deleteByTaskId(taskId) ; | 
|     } | 
|     /** | 
|      * 删除 | 
|      * @param id 主键 | 
|      * @return 数量 | 
|      */ | 
|     @Transactional | 
|     public int deleteOne(Long id){ | 
|         return this.dao.deleteByPrimaryKey(id) ; | 
|     } | 
| } |