临时提交
This commit is contained in:
@@ -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 (" +
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user