File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed
src/SmartSql/Configuration/Tags Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 22 <PropertyGroup >
33 <VersionMajor >4</VersionMajor >
44 <VersionMinor >0</VersionMinor >
5- <VersionPatch >58 </VersionPatch >
5+ <VersionPatch >59 </VersionPatch >
66 <VersionPrefix >$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix >
77 </PropertyGroup >
88</Project >
Original file line number Diff line number Diff line change @@ -8,29 +8,39 @@ public class Switch : Tag
88 public override bool IsCondition ( AbstractRequestContext context )
99 {
1010 EnsurePropertyValue ( context ) ;
11- return true ;
11+ var matchedTag = GetMatchedTag ( context ) ;
12+ return matchedTag != null ;
1213 }
14+
1315 public override void BuildSql ( AbstractRequestContext context )
16+ {
17+ var matchedTag = GetMatchedTag ( context ) ;
18+ matchedTag ? . BuildSql ( context ) ;
19+ }
20+
21+ private ITag GetMatchedTag ( AbstractRequestContext context )
1422 {
1523 var matchedTag = ChildTags . FirstOrDefault ( tag =>
1624 {
1725 if ( tag is Case caseTag )
1826 {
1927 return caseTag . IsCondition ( context ) ;
2028 }
29+
2130 return false ;
2231 } ) ?? ChildTags . FirstOrDefault ( tag => tag is Default ) ;
23-
24- matchedTag ? . BuildSql ( context ) ;
25-
32+ return matchedTag ;
2633 }
2734
2835 public class Case : StringCompareTag
2936 {
3037 public override bool IsCondition ( AbstractRequestContext context )
3138 {
3239 var reqVal = EnsurePropertyValue ( context ) ;
33- if ( reqVal == null ) { return false ; }
40+ if ( reqVal == null )
41+ {
42+ return false ;
43+ }
3444
3545 var reqValStr = reqVal is Enum ? Convert . ToInt64 ( reqVal ) . ToString ( ) : reqVal . ToString ( ) ;
3646 return reqValStr . Equals ( CompareValue ) ;
@@ -45,4 +55,4 @@ public override bool IsCondition(AbstractRequestContext context)
4555 }
4656 }
4757 }
48- }
58+ }
You can’t perform that action at this time.
0 commit comments