@@ -179,6 +179,11 @@ public static class TemplateFileConfig {
179
179
*/
180
180
private Long cacheTtl ;
181
181
182
+ /**
183
+ * The template file path provider configuration.
184
+ */
185
+ private final PathProviderConfig pathProvider = new PathProviderConfig ();
186
+
182
187
/**
183
188
* Get the character encoding for reading template resource file.
184
189
* <p>
@@ -289,6 +294,136 @@ public void setCacheTtl(Long cacheTtl) {
289
294
this .cacheTtl = cacheTtl ;
290
295
}
291
296
297
+ /**
298
+ * Get the template file path provider configuration.
299
+ *
300
+ * @return the template file path provider configuration
301
+ * @since 1.0.1
302
+ */
303
+ public PathProviderConfig getPathProvider () {
304
+ return pathProvider ;
305
+ }
306
+
307
+ /**
308
+ * The template file path provider configuration.
309
+ *
310
+ * @since 1.0.1
311
+ */
312
+ public static class PathProviderConfig {
313
+
314
+ /**
315
+ * The prefix for adding to template file path.
316
+ */
317
+ private String prefix = "" ;
318
+
319
+ /**
320
+ * Whether includes package path part.
321
+ */
322
+ private boolean includesPackagePath = true ;
323
+
324
+ /**
325
+ * Whether separate directory per mapper.
326
+ */
327
+ private boolean separateDirectoryPerMapper = true ;
328
+
329
+ /**
330
+ * Whether includes mapper name into file name when separate directory per mapper.
331
+ */
332
+ private boolean includesMapperNameWhenSeparateDirectory = true ;
333
+
334
+ /**
335
+ * Get a prefix for adding to template file path.
336
+ * <p>
337
+ * Default is {@code ""}.
338
+ * </p>
339
+ *
340
+ * @return a prefix for adding to template file path
341
+ */
342
+ public String getPrefix () {
343
+ return prefix ;
344
+ }
345
+
346
+ /**
347
+ * Set the prefix for adding to template file path.
348
+ *
349
+ * @param prefix
350
+ * The prefix for adding to template file path
351
+ */
352
+ public void setPrefix (String prefix ) {
353
+ this .prefix = prefix ;
354
+ }
355
+
356
+ /**
357
+ * Get whether includes package path part.
358
+ * <p>
359
+ * Default is {@code true}.
360
+ * </p>
361
+ *
362
+ * @return If includes package path, return {@code true}
363
+ */
364
+ public boolean isIncludesPackagePath () {
365
+ return includesPackagePath ;
366
+ }
367
+
368
+ /**
369
+ * Set whether includes package path part.
370
+ *
371
+ * @param includesPackagePath
372
+ * If want to includes, set {@code true}
373
+ */
374
+ public void setIncludesPackagePath (boolean includesPackagePath ) {
375
+ this .includesPackagePath = includesPackagePath ;
376
+ }
377
+
378
+ /**
379
+ * Get whether separate directory per mapper.
380
+ *
381
+ * @return If separate directory per mapper, return {@code true}
382
+ */
383
+ public boolean isSeparateDirectoryPerMapper () {
384
+ return separateDirectoryPerMapper ;
385
+ }
386
+
387
+ /**
388
+ * Set whether separate directory per mapper.
389
+ * <p>
390
+ * Default is {@code true}.
391
+ * </p>
392
+ *
393
+ * @param separateDirectoryPerMapper
394
+ * If want to separate directory, set {@code true}
395
+ */
396
+ public void setSeparateDirectoryPerMapper (boolean separateDirectoryPerMapper ) {
397
+ this .separateDirectoryPerMapper = separateDirectoryPerMapper ;
398
+ }
399
+
400
+ /**
401
+ * Get whether includes mapper name into file name when separate directory per mapper.
402
+ * <p>
403
+ * Default is {@code true}.
404
+ * </p>
405
+ *
406
+ * @return If includes mapper name, set {@code true}
407
+ */
408
+ public boolean isIncludesMapperNameWhenSeparateDirectory () {
409
+ return includesMapperNameWhenSeparateDirectory ;
410
+ }
411
+
412
+ /**
413
+ * Set whether includes mapper name into file name when separate directory per mapper.
414
+ * <p>
415
+ * Default is {@code true}.
416
+ * </p>
417
+ *
418
+ * @param includesMapperNameWhenSeparateDirectory
419
+ * If want to includes, set {@code true}
420
+ */
421
+ public void setIncludesMapperNameWhenSeparateDirectory (boolean includesMapperNameWhenSeparateDirectory ) {
422
+ this .includesMapperNameWhenSeparateDirectory = includesMapperNameWhenSeparateDirectory ;
423
+ }
424
+
425
+ }
426
+
292
427
}
293
428
294
429
/**
@@ -465,6 +600,33 @@ public void setLikeAdditionalEscapeTargetChars(Character... likeAdditionalEscape
465
600
* <td>{@code "*.sql"}</td>
466
601
* </tr>
467
602
* <tr>
603
+ * <tr>
604
+ * <th colspan="3">Template file path provider configuration(TemplateFilePathProvider)</th>
605
+ * </tr>
606
+ * <tr>
607
+ * <td>template-file.path-provider.prefix</td>
608
+ * <td>The prefix for adding to template file path</td>
609
+ * <td>{@code ""}</td>
610
+ * </tr>
611
+ * <tr>
612
+ * <tr>
613
+ * <td>template-file.path-provider.includes-package-path</td>
614
+ * <td>Whether includes package path part</td>
615
+ * <td>{@code true}</td>
616
+ * </tr>
617
+ * <tr>
618
+ * <tr>
619
+ * <td>template-file.patterns</td>
620
+ * <td>Whether separate directory per mapper</td>
621
+ * <td>{@code true}</td>
622
+ * </tr>
623
+ * <tr>
624
+ * <tr>
625
+ * <td>template-file.patterns</td>
626
+ * <td>Whether includes mapper name into file name when separate directory per mapper</td>
627
+ * <td>{@code true}</td>
628
+ * </tr>
629
+ * <tr>
468
630
* <th colspan="3">Dialect configuration</th>
469
631
* </tr>
470
632
* <tr>
0 commit comments