pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/UgRtuProgramMapper.java
@@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoRm.UgRtuProgram; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; @@ -71,6 +72,12 @@ * @return 实体集合 * */ List<UgRtuProgram> selectAll() ; /** * 查询数据库,是否存在给定升级文件名称 * @param programFileName 文件名称 * @return bool */ Long selectByFileName(@Param("programFileName") String programFileName) ; /** * update record selective pipIrr-platform/pipIrr-global/src/main/resources/mapper/UgRtuProgramMapper.xml
@@ -74,6 +74,17 @@ where bd.deleted != 1 order by bd.id DESC </select> <select id="selectByFileName" parameterType="java.lang.String" resultType="java.lang.Long"> select count(*) from ug_rtu_program bd where bd.deleted != 1 <trim prefix="and" suffixOverrides="and"> <if test="programFileName != null and programFileName != ''"> bd.hex_file_name = #{programFileName ,jdbcType=VARCHAR} </if> </trim> </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <!--@mbg.generated--> pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/program/UgRtuProgramCtrl.java
@@ -151,6 +151,10 @@ if(vo.file == null){ return BaseResponseUtils.buildFail("RTU程序文件必须上传") ; } String fileName = vo.file.getOriginalFilename() ; if(this.sv.existFileName(fileName)){ return BaseResponseUtils.buildFail("RTU程序文件名已存在") ; } HexFileVo fileVo = null ; byte[] fileBytes = null ; @@ -166,7 +170,7 @@ } if(fileVo != null){ UgRtuProgram po = new UgRtuProgram(); po.hexFileName = vo.file.getOriginalFilename() ; po.hexFileName = fileName ; po.programCalculateBytes = (int)fileVo.calculateBytes ; po.programCrc16 = fileVo.bytesCrc16 ; po.programBytes = fileVo.bytes; pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/program/UgRtuProgramSv.java
@@ -59,6 +59,19 @@ 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 ; } } /** * 新增保存分水口实体