New file |
| | |
| | | package com.dy.pipIrrBase.rtuUpgrade.program; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoRm.UgRtuProgramMapper; |
| | | import com.dy.pipIrrGlobal.pojoUg.UgRtuProgram; |
| | | 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/5 8:33 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class UgRtuProgramSv { |
| | | |
| | | @Autowired |
| | | private UgRtuProgramMapper dao ; |
| | | |
| | | /** |
| | | * 得到一个一些升级程序 |
| | | * @param id 一些升级程序ID |
| | | * @return 一些升级程序实体 |
| | | */ |
| | | public UgRtuProgram selectById(Long id){ |
| | | return this.dao.selectByPrimaryKey(id) ; |
| | | } |
| | | |
| | | /** |
| | | * 得到一些升级程序 |
| | | * @return 一些升级程序 |
| | | */ |
| | | public QueryResultVo<List<UgRtuProgram>> selectSome(QueryVo queryVo){ |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ; |
| | | Long itemTotal = this.dao.selectTotal(params) ; |
| | | |
| | | QueryResultVo<List<UgRtuProgram>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = this.dao.selectSome(params) ; |
| | | |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 得到所有升级程序记录ID和文件名称 |
| | | * @return 一些升级程序 |
| | | */ |
| | | public QueryResultVo<List<UgRtuProgram>> selectAll(){ |
| | | QueryResultVo<List<UgRtuProgram>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.obj = this.dao.selectAll() ; |
| | | return rsVo ; |
| | | } |
| | | /** |
| | | * 查询数据库,是否存在给定升级文件名称 |
| | | * @param programFileName 文件名称 |
| | | * @return bool |
| | | */ |
| | | public boolean existFileName(String programFileName){ |
| | | Long count = this.dao.selectByFileName(programFileName) ; |
| | | if(count != null && count > 0){ |
| | | return true ; |
| | | }else{ |
| | | return false ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 新增保存分水口实体 |
| | | * @param po 实体 |
| | | * @return 数量 |
| | | */ |
| | | @Transactional |
| | | public int save(UgRtuProgram po){ |
| | | return this.dao.insertSelective(po) ; |
| | | } |
| | | /** |
| | | * 保存修改实体 |
| | | * @param po 实体 |
| | | * @return 数量 |
| | | */ |
| | | @Transactional |
| | | public int update(UgRtuProgram po){ |
| | | return this.dao.updateByPrimaryKeySelective(po) ; |
| | | } |
| | | |
| | | /** |
| | | * 逻辑删除实体 |
| | | * @param id 实体ID |
| | | * @return 数量 |
| | | */ |
| | | @Transactional |
| | | public int delete(Long id){ |
| | | return this.dao.deleteLogicById(id) ; |
| | | } |
| | | |
| | | } |