提交 | 用户 | 时间
|
e7c126
|
1 |
package ${basePackage}.module.${table.moduleName}.dal.mysql.${table.businessName}; |
H |
2 |
|
|
3 |
import java.util.*; |
|
4 |
|
|
5 |
import ${PageResultClassName}; |
|
6 |
import ${QueryWrapperClassName}; |
|
7 |
import ${BaseMapperClassName}; |
|
8 |
import ${basePackage}.module.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO; |
|
9 |
import org.apache.ibatis.annotations.Mapper; |
|
10 |
import ${basePackage}.module.${table.moduleName}.controller.${sceneEnum.basePackage}.${table.businessName}.vo.*; |
|
11 |
|
|
12 |
## 字段模板 |
|
13 |
#macro(listCondition) |
|
14 |
#foreach ($column in $columns) |
|
15 |
#if (${column.listOperation}) |
|
16 |
#set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写 |
|
17 |
#if (${column.listOperationCondition} == "=")##情况一,= 的时候 |
|
18 |
.eqIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) |
|
19 |
#end |
|
20 |
#if (${column.listOperationCondition} == "!=")##情况二,!= 的时候 |
|
21 |
.neIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) |
|
22 |
#end |
|
23 |
#if (${column.listOperationCondition} == ">")##情况三,> 的时候 |
|
24 |
.gtIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) |
|
25 |
#end |
|
26 |
#if (${column.listOperationCondition} == ">=")##情况四,>= 的时候 |
|
27 |
.geIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) |
|
28 |
#end |
|
29 |
#if (${column.listOperationCondition} == "<")##情况五,< 的时候 |
|
30 |
.ltIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) |
|
31 |
#end |
|
32 |
#if (${column.listOperationCondition} == "<=")##情况五,<= 的时候 |
|
33 |
.leIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) |
|
34 |
#end |
|
35 |
#if (${column.listOperationCondition} == "LIKE")##情况七,Like 的时候 |
|
36 |
.likeIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) |
|
37 |
#end |
|
38 |
#if (${column.listOperationCondition} == "BETWEEN")##情况八,Between 的时候 |
|
39 |
.betweenIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) |
|
40 |
#end |
|
41 |
#end |
|
42 |
#end |
|
43 |
#end |
|
44 |
/** |
|
45 |
* ${table.classComment} Mapper |
|
46 |
* |
|
47 |
* @author ${table.author} |
|
48 |
*/ |
|
49 |
@Mapper |
|
50 |
public interface ${table.className}Mapper extends BaseMapperX<${table.className}DO> { |
|
51 |
|
|
52 |
## 特殊:树表专属逻辑(树不需要分页接口) |
|
53 |
#if ( $table.templateType != 2 ) |
|
54 |
default PageResult<${table.className}DO> selectPage(${sceneEnum.prefixClass}${table.className}PageReqVO reqVO) { |
|
55 |
return selectPage(reqVO, new LambdaQueryWrapperX<${table.className}DO>() |
|
56 |
#listCondition() |
|
57 |
.orderByDesc(${table.className}DO::getId));## 大多数情况下,id 倒序 |
|
58 |
|
|
59 |
} |
|
60 |
#else |
|
61 |
default List<${table.className}DO> selectList(${sceneEnum.prefixClass}${table.className}ListReqVO reqVO) { |
|
62 |
return selectList(new LambdaQueryWrapperX<${table.className}DO>() |
|
63 |
#listCondition() |
|
64 |
.orderByDesc(${table.className}DO::getId));## 大多数情况下,id 倒序 |
|
65 |
|
|
66 |
} |
|
67 |
#end |
|
68 |
|
|
69 |
## 特殊:树表专属逻辑 |
|
70 |
#if ( $table.templateType == 2 ) |
|
71 |
#set ($TreeParentJavaField = $treeParentColumn.javaField.substring(0,1).toUpperCase() + ${treeParentColumn.javaField.substring(1)})##首字母大写 |
|
72 |
#set ($TreeNameJavaField = $treeNameColumn.javaField.substring(0,1).toUpperCase() + ${treeNameColumn.javaField.substring(1)})##首字母大写 |
|
73 |
default ${table.className}DO selectBy${TreeParentJavaField}And${TreeNameJavaField}(Long ${treeParentColumn.javaField}, String ${treeNameColumn.javaField}) { |
|
74 |
return selectOne(${table.className}DO::get${TreeParentJavaField}, ${treeParentColumn.javaField}, ${table.className}DO::get${TreeNameJavaField}, ${treeNameColumn.javaField}); |
|
75 |
} |
|
76 |
|
|
77 |
default Long selectCountBy${TreeParentJavaField}(${treeParentColumn.javaType} ${treeParentColumn.javaField}) { |
|
78 |
return selectCount(${table.className}DO::get${TreeParentJavaField}, ${treeParentColumn.javaField}); |
|
79 |
} |
|
80 |
|
|
81 |
#end |
|
82 |
} |