临时提交

This commit is contained in:
lin
2025-10-20 22:16:03 +08:00
parent 62d3a958ad
commit 86266acb15
5 changed files with 42 additions and 193 deletions

View File

@@ -20,7 +20,7 @@ public interface CommonGBChannelMapper {
@SelectProvider(type = ChannelProvider.class, method = "queryByDeviceId")
CommonGBChannel queryByDeviceId(@Param("gbDeviceId") String gbDeviceId);
List<CommonGBChannel> queryByDeviceId(@Param("gbDeviceId") String gbDeviceId);
@Insert(" <script>" +
"INSERT INTO wvp_device_channel (" +

View File

@@ -53,7 +53,12 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Override
public CommonGBChannel queryByDeviceId(String gbDeviceId) {
return commonGBChannelMapper.queryByDeviceId(gbDeviceId);
List<CommonGBChannel> commonGBChannels = commonGBChannelMapper.queryByDeviceId(gbDeviceId);
if (commonGBChannels.isEmpty()) {
return null;
}else {
return commonGBChannels.get(0);
}
}
@Override
@@ -129,6 +134,10 @@ public class GbChannelServiceImpl implements IGbChannelService {
log.warn("[更新通道] 未找到数据库ID更新失败 {}({})", commonGBChannel.getGbName(), commonGBChannel.getGbDeviceId());
return 0;
}
// 确定编号是否重复
if (commonGBChannelMapper.queryByDeviceId(commonGBChannel.getGbDeviceId()).size() > 1) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "国标编号重复,请修改编号后保存");
}
commonGBChannel.setUpdateTime(DateUtil.getNow());
int result = commonGBChannelMapper.update(commonGBChannel);
if (result > 0) {

View File

@@ -604,9 +604,11 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
@Override
public List<Platform> queryByPlatformBySharChannelId(String channelDeviceId) {
CommonGBChannel commonGBChannel = commonGBChannelMapper.queryByDeviceId(channelDeviceId);
List<CommonGBChannel> commonGBChannels = commonGBChannelMapper.queryByDeviceId(channelDeviceId);
ArrayList<Integer> ids = new ArrayList<>();
ids.add(commonGBChannel.getGbId());
for (CommonGBChannel commonGBChannel : commonGBChannels) {
ids.add(commonGBChannel.getGbId());
}
return platformChannelMapper.queryPlatFormListByChannelList(ids);
}
}