-- Active: 1751960213665@@192.1.2.61@5236@EQM_CESHI



#对比项通道关联表
SELECT *
FROM tACACompareItemRoad;


SELECT *
FROM tServiceSetInfo;


#对比项表
SELECT *
FROM tACACompareItems;

#获取所有的对比项信息
SELECT *
FROM tACACompareItems
LEFT JOIN tACACompareItemRoad ON tACACompareItems.ItemID = tACACompareItemRoad.ItemID;

#只获取对比项信息
SELECT *
FROM tACACompareItems;

#获取对比项的通道信息
SELECT *
FROM tACACompareItemRoad;


#插入一条对比项信息
INSERT INTO tACACompareItems 
    (   ItemID, ItemName, ItemEnable, RoadCount, 
        SilentEnable, SilentThreshold, SilentDuration, SilentSensitivity, 
        OverloadEnable, OverloadThreshold, OverloadDuration, OverloadSensitivity, 
        PhaseEnable, PhaseThreshold, PhaseDuration, PhaseSensitivity )
VALUES
    ( @itemID, @itemName, @itemEnable, @roadCount, 
      @silentEnable, @silentThreshold, @silentDuration, @silentSensitivity, 
      @overloadEnable, @overloadThreshold, @overloadDuration, @overloadSensitivity, 
      @phaseEnable, @phaseThreshold, @phaseDuration, @phaseSensitivity );

#通过ID更新对比项信息
UPDATE tACACompareItems
SET ItemName = @itemName, 
    ItemEnable = @itemEnable,
    RoadCount = @roadCount,
    SilentEnable = @silentEnable,
    SilentThreshold = @silentThreshold,
    SilentDuration = @silentDuration,
    SilentSensitivity = @silentSensitivity,
    OverloadEnable = @overloadEnable,
    OverloadThreshold = @overloadThreshold,
    OverloadDuration = @overloadDuration,
    OverloadSensitivity = @overloadSensitivity,
    PhaseEnable = @phaseEnable,
    PhaseThreshold = @phaseThreshold,
    PhaseDuration = @phaseDuration,
    PhaseSensitivity = @phaseSensitivity
WHERE ItemID = 1;


#插入一条对比项通道信息
INSERT INTO tACACompareItemRoad 
    ( ItemID, RoadNum, RoadName, RoadRecordEnable, SoundCardNum, 
      SoundCardID, SoundCardName, SoundCardRoadNum, ChannelID, ChannelName )
VALUES
    ( @itemID, @roadNum, @roadName, @roadRecordEnable, @soundCardNum, 
      @soundCardID, @soundCardName, @soundCardRoadNum, @channelID, @channelName );


#通过ItemID和RoadNum更新对比项通道信息
UPDATE tACACompareItemRoad
SET RoadName = @roadName,
    RoadRecordEnable = @roadRecordEnable,
    SoundCardNum = @soundCardNum,
    SoundCardID = @soundCardID,
    SoundCardName = @soundCardName,
    SoundCardRoadNum = @soundCardRoadNum,
    ChannelID = @channelID,
    ChannelName = @channelName
WHERE ItemID = 1 AND RoadNum = 1;


