This commit is contained in:
高云鹏 2024-10-17 09:47:39 +08:00
commit c6a2ef2c43
4 changed files with 12 additions and 4 deletions

View File

@ -32,7 +32,8 @@ public interface SysEquipmentMapper extends BaseMapperPlus<SysEquipment, SysEqui
// 获取设备的动作信息 // 获取设备的动作信息
List<BaseImptabmappingVo> getEquipmentServiceInfo(Long equipmentId); List<BaseImptabmappingVo> getEquipmentServiceInfo(Long equipmentId);
int queryEquipmentByCode(@Param("code")String code); int queryEquipmentByCode(@Param("code")String code);
SysEquipmentVo queryEquipmentInfoByCode(@Param("code")String code);
} }

View File

@ -83,9 +83,12 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
SysEquipment sysEquipment = new SysEquipment(); SysEquipment sysEquipment = new SysEquipment();
BeanCopyUtils.copy(sysEquipmentDto, sysEquipment); BeanCopyUtils.copy(sysEquipmentDto, sysEquipment);
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY); SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
SysEquipmentVo oldSysEquipment = sysEquipmentMapper.queryEquipmentInfoByCode(sysEquipmentDto.getCode());
// 判断设备编码是否存在 // 判断设备编码是否存在
if (sysEquipmentMapper.queryEquipmentByCode(sysEquipment.getCode()) > 0) { if (sysEquipmentMapper.queryEquipmentByCode(sysEquipment.getCode()) > 0) {
throw new RuntimeException("设备编码已存在"); if (!oldSysEquipment.getId().equals(sysEquipmentDto.getId())) {
throw new RuntimeException("设备编码已存在");
}
} }
sysEquipment.setUpdatedTime(new Date()); sysEquipment.setUpdatedTime(new Date());
sysEquipment.setUpdatedBy(sysUserVo.getAccount()); sysEquipment.setUpdatedBy(sysUserVo.getAccount());

View File

@ -137,4 +137,8 @@
select count(1) from sys_equipment where code = #{code} select count(1) from sys_equipment where code = #{code}
</select> </select>
<select id="queryEquipmentInfoByCode" resultMap="SysEquipmentMap">
select * from sys_equipment where code = #{code}
</select>
</mapper> </mapper>

View File

@ -203,7 +203,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item :label="editDeviceData.objectType == '风电场' ? '装机容量:' : '额定容量:'"> <el-form-item :label="editDeviceData.objectType == '风电场' ? '装机容量(MW):' : '额定容量(MW):'">
<el-input-number <el-input-number
style="width: 200px" style="width: 200px"
:controls="false" :controls="false"
@ -374,7 +374,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item :label="editAddDeviceData.objectType == '风电场' ? '装机容量:' : '额定容量:'"> <el-form-item :label="editAddDeviceData.objectType == '风电场' ? '装机容量(MW):' : '额定容量(MW):'">
<el-input-number <el-input-number
style="width: 200px" style="width: 200px"
:controls="false" :controls="false"