ISNULL直接替换时会删掉表头,故需要Weather = ISNULL(Weather,'')
ISNULL(变量,需要替换的值),判定:如果变量为null值,则将值替换为后面的值
<Statement Id="QueryGlitchInfo">
SELECT top (@limit)
Id
,OrganizationName
,GroupName
,SubstationName
,LineName
,Weather = ISNULL(Weather,'')
,GlitchType = ISNULL(GlitchType,'')
,TripType = ISNULL(TripType,'')
,TripSwitchName = ISNULL(TripSwitchName,'')
,TripSwitchType = ISNULL(TripSwitchType,'')
,PowerDownTime = ISNULL(PowerDownTime,'')
,PowerUpTime = ISNULL(PowerUpTime,'')
,Coincidence = ISNULL(Coincidence,'')
,FAStart = ISNULL(FAStart,'')
,FASelfHealing = ISNULL(FASelfHealing,'')
,Times = ISNULL(Times,0)
,DownTime = ISNULL(DownTime,'')
,Gongbian = ISNULL(Gongbian,0)
,Zhuanbian = ISNULL(Zhuanbian,0)
,DownCounts
,Description = ISNULL(Description,'')
,Reason1 = ISNULL(Reason1,'')
,Reason2 = ISNULL(Reason2,'')
,Problem1 = ISNULL(Problem1,'')
,FailureReason = ISNULL(FailureReason,'')
,Reason3 = ISNULL(Reason3,'')
,Problem2 = ISNULL(Problem2,'')
,Verified = ISNULL(Verified,'')
,Appeal = ISNULL(Appeal,'')
,Corrective = ISNULL(Corrective,'')
,Implement = ISNULL(Implement,'')
,CompleteTime = ISNULL(CompleteTime,'')
,Evaluate = ISNULL(Evaluate,'')
,Assessment = ISNULL(Assessment,'')
from (select row_number()
over(order by vg.PowerDownTime desc) as rownumber,*
from dbo.[VglitchView] vg
<Where>
vg.OrganizationName in(
<For Prepend="" Property="organization" Separator="," >
@organization
</For>
)
<IsNotEmpty Prepend="And" Property="groupName">
vg.GroupName LIKE '%'+@groupName+'%'
</IsNotEmpty>
<IsNotEmpty Prepend="And" Property="substationName">
vg.SubstationName LIKE '%'+@substationName+'%'
</IsNotEmpty>
<IsNotEmpty Prepend="And" Property="lineName">
vg.LineName LIKE '%'+@lineName+'%'
</IsNotEmpty>
<IsNotEmpty Prepend="And" Property="start">
vg.PowerDownTime <![CDATA[ >= ]]> @start
</IsNotEmpty>
<IsNotEmpty Prepend="And" Property="end">
vg.PowerDownTime <![CDATA[ <= ]]> @end
</IsNotEmpty>
<IsNotEmpty Prepend="And" Property="glitchType">
vg.GlitchType = @glitchType
</IsNotEmpty>
<IsNotEmpty Prepend="And" Property="tripType">
vg.TripType LIKE '%'+@tripType+'%'
</IsNotEmpty>
<IsNotEmpty Prepend="And" Property="coincidence">
vg.Coincidence = @coincidence
</IsNotEmpty>
<IsNotEmpty Prepend="And" Property="faSelfHealing">
vg.FASelfHealing = @faSelfHealing
</IsNotEmpty>
<IsNotEmpty Prepend="And" Property="perorganization">
vg.OrganizationName = @perorganization
</IsNotEmpty>
</Where>
) temp_row
<Where>
rownumber > ((@page-1)*@limit)
</Where>
</Statement>