shikeying
2024-01-11 3b67e947e36133e2a40eb2737b15ea375e157ea0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
package com.walker.jdbc;
 
//import com.walker.common.SplitPageInfo;
import com.walker.db.Sorts;
import com.walker.db.page.GenericPager;
import com.walker.db.page.MapPager;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
 
import java.util.List;
import java.util.Map;
 
/**
 * 数据库访问DAO接口
 *
 * @author 时克英
 * @date 2017年3月1日
 */
public interface BaseDao {
    /**
     * <pre>
     * 根据sql和条件对象查询PO数组
     * 例如:
     *   List&lt;User&gt; list = selectSplit("select * from user where name like ?", new Object[]{"%admin"}, new SplitPageInfo(6), User.ROW_MAPPER))
     * </pre>
     *
     * @param sql           查询语句
     * @param parameters    参数对象
//     * @param splitPageInfo 分页对象
     * @param rowMapper     resultset转PO对象
     * @param <T>           RowMapper 或 BasePo 子类
     * @return PO数组
     * @throws DataAccessException 数据访问异常
     */
    <T> GenericPager<T> selectSplit(String sql, Object[] parameters, int currentPage, int pageSize, RowMapper<T> rowMapper) throws DataAccessException;
 
    // 2023-07-27 添加排序参数
    <T> GenericPager<T> selectSplit(String sql, Object[] parameters, int currentPage, int pageSize, RowMapper<T> rowMapper, Sorts.Sort srot) throws DataAccessException;
 
    /**
     *
     * @param sql
     * @param parameters
     * @param po
     * @param <T>
     * @return
     * @throws DataAccessException
     */
    <T extends BasePo<T>> GenericPager<T> selectSplit(String sql, Object[] parameters, int currentPage, int pageSize, T po) throws DataAccessException;
 
    /**
     * 插入数据
     *
     * @param po  需要插入的表PO
     * @param <T> BasePo子类
     * @return 成功插入的记录数
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> int insert(T po) throws DataAccessException;
 
    /**
     * 插入一组PO
     *
     * @param poList 需要插入的表PO数组
     * @param <T>    BasePo子类
     * @return 成功插入的记录数
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> int insert(List<T> poList) throws DataAccessException;
 
    /**
     * 批量写入数据集合
     * @param poList 给定数据表对象集合。
     * @return 返回成功记录数量,失败返回0
     * @param <T>
     * @date 2023-03-24
     * @author 时克英
     */
    public <T extends BasePo<T>> int insertBatch(List<T> poList) throws DataAccessException;
 
    /**
     * 根据主键更新数据,部分更新
     *
     * @param po  需要更新的数据库表PO
     * @param <T> BasePo子类
     * @return 成功修改的记录数
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> int update(T po) throws DataAccessException;
 
    /**
     * 根据各自的主键更新一组数据,部分更新
     *
     * @param poList 需要更新的数据库表PO数组
     * @param <T>    BasePo子类
     * @return 成功修改的记录数
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> int update(List<T> poList) throws DataAccessException;
 
    /**
     * 批量更新数据集合,使用系统生成的po对象。该方法只根据主键更新
     * @param poList
     * @return
     * @param <T>
     * @throws DataAccessException
     * @author 时克英
     * @date 2023-03-24
     */
    <T extends BasePo<T>> int updateBatch(List<T> poList) throws DataAccessException;
 
    /**
     * 保存数据, 主键不空则更新,主键为空则插入
     *
     * @param po  需要更新的PO
     * @param <T> BasePo子类
     * @return 影响的数据行数
     */
    <T extends BasePo<T>> int save(T po);
 
    /**
     * <pre>
     * 根据指定的where条件和parameters参数对象更新数据库
     * 例如:
     *   User user = new User(sybz=1, beiz="null")
     *   int cnt = update(user, "where name like :name and sybz = :sybz", new Map{name : "%admin", sybz : 0})
     * </pre>
     *
     * @param po         需要更新的数据库表PO
     * @param where      条件
     * @param parameters 条件参数
     * @param <T>        BasePo子类
     * @return 成功修改的记录数
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> int update(T po, String where, Map<String, Object> parameters) throws DataAccessException;
 
    /**
     * <pre>
     * 根据指定的where条件和parameters参数对象更新数据库
     * 例如:
     *   User user = new User(sybz=1, beiz="null")
     *   int cnt = update(user, "where name like ? and sybz = ?", new Object[]{"%admin", 0})
     * </pre>
     *
     * @param po         需要更新的数据库表PO
     * @param where      条件
     * @param parameters 条件参数
     * @param <T>        BasePo子类
     * @return 成功修改的记录数
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> int update(T po, String where, Object[] parameters) throws DataAccessException;
 
    /**
     * 根据主键删除数据
     *
     * @param po  需要删除的数据库表PO
     * @param <T> BasePo子类
     * @return 成功删除的记录数
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> int delete(T po) throws DataAccessException;
 
    /**
     * 更新各自的主键删除一组数据
     *
     * @param poList 需要删除的数据库表PO数组
     * @param <T>    BasePo子类
     * @return 成功删除的记录数
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> int delete(List<T> poList) throws DataAccessException;
 
    /**
     * <pre>
     * 根据条件和条件参数删除数据
     * 例如:
     *   int cnt = delete(new User(), "where sybz = :sybz", new Map{sybz : 3})
     * </pre>
     *
     * @param po         需要删除的数据库表PO
     * @param where      条件
     * @param parameters 条件参数
     * @param <T>        BasePo的子类型
     * @return 成功删除的记录数
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> int delete(T po, String where, Map<String, Object> parameters) throws DataAccessException;
 
    /**
     * <pre>
     * 根据条件和条件参数删除数据
     * 例如:
     *   int cnt = delete(new User(), "where sybz = ?", new Object[]{3})
     * </pre>
     *
     * @param po         需要删除的数据库表PO
     * @param where      条件
     * @param parameters 条件参数
     * @param <T>        BasePo的子类型
     * @return 成功删除的记录数
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> int delete(T po, String where, Object[] parameters) throws DataAccessException;
 
    /**
     * 根据主键查询单个PO
     *
     * @param po  数据对象
     * @param <T> BasePo的子类型
     * @return 单个PO对象
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> T get(T po) throws DataAccessException;
 
    /**
     * <pre>
     * 根据条件和条件对象查询单个PO,如果没查到返回null,查到多余一个报错
     * 例如:
     *   User user = get(new User(), "where name like :name", new Map{name : "%admin"})
     *   User user = get(new User(), "where name = :name", new Map{name : "admin"})
     * </pre>
     *
     * @param po         BasePo的子类型
     * @param where      查询条件
     * @param parameters 条件参数
     * @param <T>        BasePo的子类型
     * @return PO 对象
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> T get(T po, String where, Map<String, Object> parameters) throws DataAccessException;
 
    /**
     * <pre>
     * 根据条件和条件对象查询单个PO,如果没查到返回null,查到多余一个报错
     * 例如:
     *   User user = get(new User(), "where name like ?", new Object[]{"%admin"})
     *   User user = get(new User(), "where name = ?", new Object[]{"admin"})
     * </pre>
     *
     * @param po         BasePo的子类型
     * @param where      查询条件
     * @param parameters 条件参数
     * @param <T>        BasePo的子类型
     * @return PO 对象
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> T get(T po, String where, Object[] parameters) throws DataAccessException;
 
    /**
     * <pre>
     * 根据sql和条件对象查询单个Map,如果没查到返回null,查到多余一个报错
     * 例如:
     *   Map<String, Object> userMap = get("select * from user where name like :name", new Map{name : "%admin"})
     *   Map<String, Object> userMap = get("select * from user where name = :name", new Map{name : "admin"})
     * </pre>
     *
     * @param sql        查询语句
     * @param parameters 条件参数
     * @return 数据Map
     * @throws DataAccessException 数据访问异常
     */
    Map<String, Object> get(String sql, Map<String, Object> parameters) throws DataAccessException;
 
    /**
     * <pre>
     * 根据sql和条件对象查询单个Map,如果没查到返回null,查到多余一个报错
     * 例如:
     *   Map<String, Object> userMap = get("select * from user where name like ?", new Object[]{"%admin"})
     *   Map<String, Object> userMap = get("select * from user where name = ?", new Object[]{"admin"})
     * </pre>
     *
     * @param sql        查询语句
     * @param parameters 条件参数
     * @return Map
     * @throws DataAccessException 数据访问异常
     */
    Map<String, Object> get(String sql, Object[] parameters) throws DataAccessException;
 
    /**
     * <pre>
     * 根据sql和条件对象查询单个对象,如果没查到返回null,查到多余一个报错
     * 例如:
     *   User user = get("select * from user where name like :name", new Map{name : "%admin"}, User.ROW_MAPPER)
     *   User user = get("select * from user where name = :name", new Map{name : "admin"}, User.ROW_MAPPER)
     * </pre>
     *
     * @param sql        查询语句
     * @param parameters 条件参数
     * @param rowMapper  resultset转PO对象
     * @param <T>        RowMapper 或 BasePo 子类
     * @return T
     * @throws DataAccessException 数据访问异常
     */
    <T> T get(String sql, Map<String, Object> parameters, RowMapper<T> rowMapper) throws DataAccessException;
 
    /**
     *
     * @param sql
     * @param parameters
     * @param po
     * @param <T>
     * @return
     * @throws DataAccessException
     */
    <T extends BasePo<T>> T get(String sql, Map<String, Object> parameters, T po) throws DataAccessException;
 
    /**
     * <pre>
     * 根据sql和条件对象查询单个对象,如果没查到返回null,查到多余一个报错
     * 例如:
     *   User user = get("select * from user where name like ?", new Object[]{"%admin"}, User.ROW_MAPPER)
     *   User user = get("select * from user where name = ?", new Object[]{"admin"}, User.ROW_MAPPER)
     * </pre>
     *
     * @param sql        查询语句
     * @param parameters 条件参数
     * @param rowMapper  resultset转PO对象
     * @param <T>        RowMapper 或 BasePo 子类
     * @return T
     * @throws DataAccessException 数据访问异常
     */
    <T> T get(String sql, Object[] parameters, RowMapper<T> rowMapper) throws DataAccessException;
 
    /**
     *
     * @param sql
     * @param parameters
     * @param po
     * @param <T>
     * @return
     * @throws DataAccessException
     */
    <T extends BasePo<T>> T get(String sql, Object[] parameters, T po) throws DataAccessException;
 
    /**
     * <pre>
     * 根据条件和条件对象查询PO数组
     * 例如:
     *   List&lt;User&gt; list = select(new User(), "where name like :name", new Map{name : "%admin"})
     * </pre>
     *
     * @param po         需要查询的表PO
     * @param where      条件
     * @param parameters 条件对象
     * @param <T>        BasePo 的子类型
     * @return PO数组
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> List<T> select(T po, String where, Map<String, Object> parameters) throws DataAccessException;
 
    /**
     * <pre>
     * 根据条件和条件对象查询PO数组
     * 例如:
     *   List&lt;User&gt; list = select(new User(), "where name like ?", new Object[]{"%admin"})
     * </pre>
     *
     * @param po         需要查询的表PO
     * @param where      条件
     * @param parameters 条件对象
     * @param <T>        BasePo 的子类型
     * @return PO数组
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> List<T> select(T po, String where, Object[] parameters) throws DataAccessException;
 
    /**
     * 通用查询条件,po中可以设置查询字段,目前都是 and 方式。
     * @param po
     * @return
     * @param <T>
     * @throws DataAccessException
     * @date 2023-03-24
     */
    <T extends BasePo<T>> List<T> select(T po) throws DataAccessException;
 
    // 2023-07-28 sort
    <T extends BasePo<T>> List<T> select(T po, Sorts.Sort sort) throws DataAccessException;
 
    /**
     * <pre>
     * 根据条件和条件对象查询PO数组
     * 例如:
     *   List&lt;User&gt; list = selectSplit(new User(), "where name like :name", new Map{name : "%admin"}, new SplitPageInfo(6))
     * </pre>
     *
     * @param po            需要查询的表PO
     * @param where         条件
     * @param parameters    条件对象
     * @param <T>           BasePo 子类型
     * @return 分页后的PO数组
     * @throws DataAccessException 数据访问异常
     */
    <T extends BasePo<T>> GenericPager<T> selectSplit(T po
            , String where, Map<String, Object> parameters, int currentPage, int pageSize) throws DataAccessException;
 
    /**
     * 简单的单表分页查询,设置PO字段可查询,目前只支持 and 条件。
     * @param po
     * @param currentPage
     * @param pageSize
     * @return
     * @param <T>
     * @throws DataAccessException
     * @date 2023-03-24
     */
    public <T extends BasePo<T>> GenericPager<T> selectSplit(T po, int currentPage, int pageSize) throws DataAccessException;
 
    // 2023-07-28 sort
    public <T extends BasePo<T>> GenericPager<T> selectSplit(T po, int currentPage, int pageSize, Sorts.Sort sort) throws DataAccessException;
 
    /**
     * <pre>
     * 根据sql和条件对象查询map数组
     * 例如:
     *   List&lt;Map&lt;String, Object&gt;&gt; list = select("select * from user where name like ?", new Object[]{"%admin"})
     * </pre>
     *
     * @param sql        查询语句
     * @param parameters 条件对象
     * @return PO数组
     * @throws DataAccessException 数据访问异常
     */
    List<Map<String, Object>> select(String sql, Object[] parameters) throws DataAccessException;
 
    /**
     * <pre>
     * 根据sql和条件对象查询PO数组
     * 例如:
     *   List&lt;User&gt; list = select("select * from user where name like ?", new Object[]{"%admin"}, User.ROW_MAPPER)
     * </pre>
     *
     * @param sql        查询语句
     * @param parameters 条件对象
     * @param mapper     resultset 转换对象
     * @param <T>        RowMapper 或 BasePo 子类型
     * @return PO数组
     * @throws DataAccessException 数据访问异常
     */
    <T> List<T> select(String sql, Object[] parameters, RowMapper<T> mapper) throws DataAccessException;
 
    /**
     *
     * @param sql
     * @param parameters
     * @param po
     * @param <T>
     * @return
     * @throws DataAccessException
     */
    <T extends BasePo<T>> List<T> select(String sql, Object[] parameters, T po) throws DataAccessException;
 
    /**
     * <pre>
     * 根据sql和条件对象查询map数组
     * 例如:
     *   List&lt;Map&lt;String, Object&gt;&gt; list = selectSplit("select * from user where name like ?", new Object[]{"%admin"}, new SplitPageInfo(6))
     * </pre>
     *
     * @param sql           查询语句
     * @param parameters    条件对象
//     * @param splitPageInfo 分页对象
     * @param currentPage 当前页码
     * @param pageSize 每页显示几条
     * @return PO数组
     * @throws DataAccessException 数据访问异常
     */
    MapPager selectSplit(String sql, Object[] parameters, int currentPage, int pageSize) throws DataAccessException;
 
    // 2023-07-28 添加Sort排序参数
    MapPager selectSplit(String sql, Object[] parameters, int currentPage, int pageSize, Sorts.Sort sort) throws DataAccessException;
 
    /**
     * <pre>
     * 根据sql和条件对象查询map数组,结果放在分页对象中
     * 例如:
     *   SplitPageInfo spi = selectSplitEx("select * from user where name like ?", new Object[]{"%admin"}, new SplitPageInfo(6))
     * </pre>
     *
     * @param sql           查询语句
     * @param parameters    条件对象
     * @param splitPageInfo 分页对象
     * @return 分页对象
     * @throws DataAccessException 数据访问异常
    SplitPageInfo selectSplitEx(String sql, Object[] parameters, SplitPageInfo splitPageInfo) throws DataAccessException;*/
 
//    /**
//     * <pre>
//     * 根据sql和条件对象查询PO数组,结果放在分页对象中返回
//     * 例如:
//     *   SplitPageInfo spi = selectSplitEx("select * from user where name like ?", new Object[]{"%admin"}, new SplitPageInfo(6), User.ROW_MAPPER)
//     * </pre>
//     *
//     * @param sql           查询语句
//     * @param parameters    参数对象
//     * @param splitPageInfo 分页对象
//     * @param rowMapper     resultset转PO对象
//     * @param <T>           RowMapper 或 BasePo 子类
//     * @return 分页对象
//     * @throws DataAccessException 数据访问异常
//     */
//    <T> SplitPageInfo selectSplitEx(String sql, Object[] parameters, SplitPageInfo splitPageInfo, RowMapper<T> rowMapper) throws DataAccessException;
 
//    /**
//     *
//     * @param sql
//     * @param parameters
//     * @param splitPageInfo
//     * @param po
//     * @param <T>
//     * @return
//     * @throws DataAccessException
//     */
//    <T extends BasePo<T>> SplitPageInfo selectSplitEx(String sql, Object[] parameters, SplitPageInfo splitPageInfo, T po) throws DataAccessException;
 
    /**
     * <pre>
     * 根据sql和条件对象分页查询map数组,结果放在分页对象中返回
     * 例如:
     *   List&lt;User&gt; list = selectSplit("select * from user where name like :name", new Map{name:"%admin"}, new SplitPageInfo(6), User.ROW_MAPPER)
     * </pre>
     *
     * @param sql           查询语句
     * @param parameters    条件参数
//     * @param splitPageInfo 分页对象
     * @param currentPage 当前页码
     * @param pageSize 每页显示几条
     * @param rowMapper     resultset转PO对象
     * @param <T>           RowMapper 或 BasePo 子类
     * @return PO数组
     * @throws DataAccessException 数据访问异常
     */
    <T> GenericPager<T> selectSplit(String sql, Map<String, Object> parameters, int currentPage, int pageSize, RowMapper<T> rowMapper) throws DataAccessException;
    <T> GenericPager<T> selectSplit(String sql, Map<String, Object> parameters, int currentPage, int pageSize, RowMapper<T> rowMapper, Sorts.Sort sort) throws DataAccessException;
 
    <T> GenericPager<T> selectSplit(String sql, Map<String, Object> parameters, RowMapper<T> rowMapper, Sorts.Sort sort) throws DataAccessException;
 
    <T extends BasePo<T>> GenericPager<T> selectSplit(String sql, Map<String, Object> parameters, int currentPage, int pageSize, T po) throws DataAccessException;
 
    /**
     * <pre>
     * 根据sql和条件对象查询map数组
     * 例如:
     *   List&lt;Map&lt;String, Object&gt;&gt; list = select("select * from user where name like ?", new Map{"%admin"})
     * </pre>
     *
     * @param sql        查询语句
     * @param parameters 参数对象
     * @return map数组
     * @throws DataAccessException 数据访问异常
     */
    List<Map<String, Object>> select(String sql, Map<String, Object> parameters) throws DataAccessException;
 
    /**
     * <pre>
     * 根据sql和条件对象查询map数组
     * 例如:
     *   List&lt;User&gt; list = select("select * from user where name like ?", new Object[]{"%admin"}, User.ROW_MAPPER)
     * </pre>
     *
     * @param sql        查询语句
     * @param parameters 参数对象
     * @param mapper     resultset转PO对象
     * @param <T>        RowMapper 或 BasePo 子类
     * @return T数组
     * @throws DataAccessException 数据访问异常
     */
    <T> List<T> select(String sql, Map<String, Object> parameters, RowMapper<T> mapper) throws DataAccessException;
 
    /**
     *
     * @param sql
     * @param parameters
     * @param po
     * @param <T>
     * @return
     * @throws DataAccessException
     */
    <T extends BasePo<T>> List<T> select(String sql, Map<String, Object> parameters, T po) throws DataAccessException;
 
    /**
     * <pre>
     * 根据sql和条件对象分页查询map数组
     * 例如:
     *   List&lt;Map&lt;String, Object&gt;&gt; list = selectSplit("select * from user where name like :name", new Map{name:"%admin"}, new SplitPageInfo(6))
     * </pre>
     *
     * @param sql           查询语句
     * @param parameters    参数对象
//     * @param splitPageInfo 分页对象
     * @return map数组
     * @throws DataAccessException 数据访问异常
     */
    MapPager selectSplit(String sql, Map<String, Object> parameters, int currentPage, int pageSize) throws DataAccessException;
 
    // 2023-07-27 Sort
    MapPager selectSplit(String sql, Map<String, Object> parameters, int currentPage, int pageSize, Sorts.Sort sort) throws DataAccessException;
 
//    /**
//     * <pre>
//     * 根据sql和条件对象分页查询map数组,结果放在分页对象中返回
//     * 例如:
//     *   SplitPageInfo spi = selectSplitEx("select * from user where name like :name", new Map{name:"%admin"}, new SplitPageInfo(6))
//     * </pre>
//     *
//     * @param sql           查询语句
//     * @param parameters    条件参数
//     * @param splitPageInfo 分页对象
//     * @return 分页对象
//     * @throws DataAccessException 数据访问异常
//     */
//    SplitPageInfo selectSplitEx(String sql, Map<String, Object> parameters, SplitPageInfo splitPageInfo) throws DataAccessException;
 
//    /**
//     * <pre>
//     * 根据sql和条件对象分页查询map数组,结果放在分页对象中返回
//     * 例如:
//     *   SplitPageInfo spi = selectSplitEx("select * from user where name like :name", new Map{name:"%admin"}, new SplitPageInfo(6), User.ROW_MAPPER)
//     * </pre>
//     *
//     * @param sql           查询语句
//     * @param parameters    条件参数
//     * @param splitPageInfo 分页对象
//     * @param rowMapper     resultset转PO对象
//     * @param <T>           RowMapper 或 BasePo 子类
//     * @return 分页对象
//     * @throws DataAccessException 数据访问异常
//     */
//    <T> SplitPageInfo selectSplitEx(String sql, Map<String, Object> parameters, SplitPageInfo splitPageInfo, RowMapper<T> rowMapper) throws DataAccessException;
 
//    /**
//     *
//     * @param sql
//     * @param parameters
//     * @param splitPageInfo
//     * @param po
//     * @param <T>
//     * @return
//     * @throws DataAccessException
//     */
//    <T extends BasePo<T>> SplitPageInfo selectSplitEx(String sql, Map<String, Object> parameters, SplitPageInfo splitPageInfo, T po) throws DataAccessException;
 
    /**
     * 处理大结果集查询(不内存溢出)
     *
     * @param sql          SQL 查询语句
     * @param parameters   查询参数
     * @param rowMapper    resultset转PO对象
     * @param rowExecution 执行行业务逻辑对象
     * @param <T>          泛型类型
     */
    <T> void execute(String sql, final Object[] parameters, final RowMapper<T> rowMapper, final RowExecution<T> rowExecution);
 
    /**
     *
     * @param sql
     * @param parameters
     * @param po
     * @param rowExecution
     * @param <T>
     */
    <T extends BasePo<T>> void execute(String sql, final Object[] parameters, final T po, final RowExecution<T> rowExecution);
 
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //~ 以下方法简化分页参数
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    <T extends BasePo<T>> GenericPager<T> selectSplit(String sql
            , Map<String, Object> parameters, T po) throws DataAccessException;
 
    <T extends BasePo<T>> GenericPager<T> selectSplit(String sql
            , Object[] parameters, T po) throws DataAccessException;
 
    <T> GenericPager<T> selectSplit(String sql, Object[] parameters, RowMapper<T> rowMapper) throws DataAccessException;
 
    MapPager selectSplit(String sql, Object[] parameters) throws DataAccessException;
 
    <T extends BasePo<T>> GenericPager<T> selectSplit(T po
            , String where, Map<String, Object> parameters) throws DataAccessException;
 
    /**
     * <pre>
     * 根据条件参数更新数据库(insert or udpate or delete)
     * 例如:
     *   int cnt = execute("update user set name=? where id = ?", new Object[]{"张三", "123"})
     * </pre>
     *
     * @param sql        更新语句
     * @param parameters 条件参数
     * @return 受影响的数据行数
     * @throws DataAccessException 数据访问异常
     */
    int execute(String sql, Object[] parameters) throws DataAccessException;
 
    /**
     * <pre>
     * 根据条件参数更新数据库(insert or udpate or delete)
     * 例如:
     *   int cnt = execute("update user set name=:name where id=:id", new Map{name:"张三", id:"123"})
     *  </pre>
     *
     * @param sql        更新语句
     * @param parameters 条件参数
     * @return 受影响的数据行数
     * @throws DataAccessException 数据访问异常
     */
    int execute(String sql, Map<String, Object> parameters) throws DataAccessException;
 
    /**
     * <pre>
     * 根据sql语句和条件参数查询一个Int
     * 例如:
     *   int count = queryForInt("select count(*) from user where sybz=?", new Object[]{1})
     * </pre>
     *
     * @param sql        查询语句
     * @param parameters 参数对象
     * @return int
     * @throws DataAccessException 数据访问异常
     */
    int queryForInt(String sql, Object[] parameters) throws DataAccessException;
 
    /**
     * <pre>
     * 根据sql语句和条件参数查询一个Int
     * 例如:
     *   int count = queryForInt("select count(*) from user where sybz=:sybz", new Map{sybz:1})
     * </pre>
     *
     * @param sql        查询语句
     * @param parameters 参数对象
     * @return int
     * @throws DataAccessException 数据访问异常
     */
    int queryForInt(String sql, Map<String, Object> parameters) throws DataAccessException;
 
 
    /**
     * <pre>
     * 根据sql语句和条件参数查询一个Object
     * 例如:
     *   String name = queryForObject("select name from user where id=?", new Object[]{"123"}, String.class)
     * </pre>
     *
     * @param sql        查询语句
     * @param parameters 参数对象
     * @param clazz      返回的数据类型
     * @param <T>        对象类型
     * @return T类型的对象
     * @throws DataAccessException 数据访问异常
     */
    <T> T queryForObject(String sql, Object[] parameters, Class<T> clazz) throws DataAccessException;
 
    /**
     * <pre>
     * 根据sql语句和条件参数查询一个Object
     * 例如:
     *   String name = queryForObject("select name from user where id=:id", new Map[]{id:"123"}, String.class)
     * </pre>
     *
     * @param sql        查询语句
     * @param parameters 参数对象
     * @param clazz      返回的数据类型
     * @param <T>        对象类型(例如,String/Integer等)
     * @return T类型的对象
     * @throws DataAccessException 数据访问异常
     */
    <T> T queryForObject(String sql, Map<String, Object> parameters, Class<T> clazz) throws DataAccessException;
 
    /**
     * <pre>
     * 执行存储过程
     * 例如
     *   call("{call bbb(?, ?)}", new Integer[]{1, 2});
     * </pre>
     *
     * @param functionName 方法名称
     * @param parameters   参数对象
     * @throws DataAccessException 数据访问异常
     */
    void execCall(String functionName, Object[] parameters) throws DataAccessException;
 
    /**
     * <pre>
     * 执行存储过程
     * 例如
     *   Integer cnt = call("{? = call add(?, ?)}", new Integer[]{1, 2}, Integer.class);
     * </pre>
     *
     * @param functionName 方法名称
     * @param parameters   参数对象
     * @param clazz        返回对象类型
     * @param <T>          泛型类型
     * @return 执行结果
     * @throws DataAccessException 数据访问异常
     */
    <T> T execCall(String functionName, Object[] parameters, Class<T> clazz) throws DataAccessException;
 
    /**
     * <pre>
     * 批量更新
     * 例如:
     *   params = new List[
     *     new Object[]{1, "123"},
     *     new Object[]{1, "124"},
     *     new Object[]{1, "125"}
     *   ]
     *   int cnt = batchUpdate("update user sybz=? where id=?", params);
     *
     *   params = new List[
     *     new Map{sybz:1, id:"123"},
     *     new Map{sybz:1, id:"124"},
     *     new Map{sybz:1, id:"125"}
     *   ]
     *   int cnt = batchUpdate("update user sybz=:sybz where id=:id", params);
     * </pre>
     *
     * @param sql            更新语句
     * @param parametersList 参数对象数组
     * @return 受影响的行数
     * @throws DataAccessException 数据访问异常
     */
    int execBatchUpdate(String sql, List<?> parametersList) throws DataAccessException;
 
    void update(String sql);
 
    int update(String sql, Object[] args);
 
    <T> List<T> sqlQuery(String sql, RowMapper<T> rowMapper);
 
    <T> List<T> sqlQuery(String sql, Object[] args, RowMapper<T> rowMapper);
 
    List<Map<String, Object>> sqlQueryListMap(String sql, Object[] args);
 
    <E> GenericPager<E> sqlGeneralQueryPager(String sql, Object[] args, RowMapper<E> rowMapper);
 
    <E> GenericPager<E> sqlGeneralQueryPager(String sql, Object[] args, RowMapper<E> rowMapper
            , int pageIndex);
 
    <T> GenericPager<T> sqlGeneralQueryPager(String sql
            , Object[] args, RowMapper<T> rowMapper, int pageIndex, int pageSize);
 
    <T> T sqlMathQuery(String sql, Object[] args, Class<T> clazz);
 
    <T> List<T> sqlListObjectWhereIn(String sql, RowMapper<T> rowMapper, SqlParameterSource paramSource);
 
    List<Map<String, Object>> queryListObjectWhereIn(String sql, SqlParameterSource paramSource);
 
    /**
     * 分页查询,根据PO里面字段,做简单条件查询。
     * @param po
     * @return
     * @param <T>
     * @throws DataAccessException
     * @date 2023-04-21
     */
    <T extends BasePo<T>> GenericPager<T> selectSplit(T po) throws DataAccessException;
    <T extends BasePo<T>> GenericPager<T> selectSplit(T po, Sorts.Sort sort) throws DataAccessException;
 
    static interface RowExecution<T> {
        void execute(T t) throws Exception;
    }
}