File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed
main/java/org/mybatis/dynamic/sql/insert/render
test/java/org/mybatis/dynamic/sql Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ public String getInsertStatementSQL() {
5656 }
5757
5858 public List <T > getRecords () {
59- return Collections . unmodifiableList ( records ) ;
59+ return records ;
6060 }
6161
6262 public static <T > Builder <T > withRecords (List <T > records ) {
Original file line number Diff line number Diff line change @@ -48,12 +48,43 @@ public String orderByName() {
4848
4949 @ Override
5050 public boolean isDescending () {
51- return true ;
51+ return false ;
5252 }
5353 };
5454
5555 OrderByModel model = OrderByModel .of (List .of (ss ));
5656
57+ RenderingContext renderingContext = RenderingContext
58+ .withRenderingStrategy (RenderingStrategies .MYBATIS3 )
59+ .withTableAliasCalculator (TableAliasCalculator .empty ())
60+ .withStatementConfiguration (new StatementConfiguration ())
61+ .build ();
62+ OrderByRenderer renderer = new OrderByRenderer (renderingContext );
63+ FragmentAndParameters fp = renderer .render (model );
64+ assertThat (fp .fragment ()).isEqualTo ("order by id" );
65+ }
66+
67+ @ Test
68+ void bothMethodsExistDescending () {
69+ SortSpecification ss = new SortSpecification () {
70+ @ Override
71+ public SortSpecification descending () {
72+ return this ;
73+ }
74+
75+ @ Override
76+ public String orderByName () {
77+ return "id" ;
78+ }
79+
80+ @ Override
81+ public boolean isDescending () {
82+ return true ;
83+ }
84+ };
85+
86+ OrderByModel model = OrderByModel .of (List .of (ss ));
87+
5788 RenderingContext renderingContext = RenderingContext
5889 .withRenderingStrategy (RenderingStrategies .MYBATIS3 )
5990 .withTableAliasCalculator (TableAliasCalculator .empty ())
You can’t perform that action at this time.
0 commit comments