提交 | 用户 | 时间
|
71e81e
|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
懒 |
2 |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
3 |
<mapper namespace="${package.Mapper}.${table.mapperName}"> |
|
4 |
|
|
5 |
#if(${enableCache}) |
|
6 |
<!-- 开启二级缓存 --> |
|
7 |
<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/> |
|
8 |
|
|
9 |
#end |
|
10 |
#if(${baseResultMap}) |
|
11 |
<!-- 通用查询映射结果 --> |
|
12 |
<resultMap id="BaseResultMap" type="${package.Entity}.${entity}"> |
|
13 |
#foreach($field in ${table.fields}) |
|
14 |
#if(${field.keyFlag})##生成主键排在第一位 |
|
15 |
<id column="${field.name}" property="${field.propertyName}" /> |
|
16 |
#end |
|
17 |
#end |
|
18 |
#foreach($field in ${table.commonFields})##生成公共字段 |
|
19 |
<result column="${field.name}" property="${field.propertyName}" /> |
|
20 |
#end |
|
21 |
#foreach($field in ${table.fields}) |
|
22 |
#if(!${field.keyFlag})##生成普通字段 |
|
23 |
<result column="${field.name}" property="${field.propertyName}" /> |
|
24 |
#end |
|
25 |
#end |
|
26 |
</resultMap> |
|
27 |
|
|
28 |
#end |
|
29 |
#if(${baseColumnList}) |
|
30 |
<!-- 通用查询结果列 --> |
|
31 |
<sql id="Base_Column_List"> |
|
32 |
${tableRebuild} |
|
33 |
</sql> |
|
34 |
|
|
35 |
#end |
|
36 |
|
|
37 |
<select id="customList" resultType="${package.EntitySpecResult}.${entity}Result" parameterType="${package.EntitySpecParams}.${entity}Param"> |
|
38 |
select |
|
39 |
<include refid="Base_Column_List"/> |
|
40 |
from ${table.name} where 1 = 1 |
|
41 |
#foreach($field in ${mapperConditions}) |
|
42 |
<if test="paramCondition.${field.camelFieldName} != null and paramCondition.${field.camelFieldName} != ''"> |
|
43 |
and ${field.columnName} like CONCAT('%',#{paramCondition.${field.camelFieldName}},'%') |
|
44 |
</if> |
|
45 |
#end |
|
46 |
</select> |
|
47 |
|
|
48 |
<select id="customMapList" resultType="map" parameterType="${package.EntitySpecParams}.${entity}Param"> |
|
49 |
select |
|
50 |
<include refid="Base_Column_List"/> |
|
51 |
from ${table.name} where 1 = 1 |
|
52 |
#foreach($field in ${mapperConditions}) |
|
53 |
<if test="paramCondition.${field.camelFieldName} != null and paramCondition.${field.camelFieldName} != ''"> |
|
54 |
and ${field.columnName} like CONCAT('%',#{paramCondition.${field.camelFieldName}},'%') |
|
55 |
</if> |
|
56 |
#end |
|
57 |
</select> |
|
58 |
|
|
59 |
<select id="customPageList" resultType="${package.EntitySpecResult}.${entity}Result" parameterType="${package.EntitySpecParams}.${entity}Param"> |
|
60 |
select |
|
61 |
<include refid="Base_Column_List"/> |
|
62 |
from ${table.name} where 1 = 1 |
|
63 |
#foreach($field in ${mapperConditions}) |
|
64 |
<if test="paramCondition.${field.camelFieldName} != null and paramCondition.${field.camelFieldName} != ''"> |
|
65 |
and ${field.columnName} like CONCAT('%',#{paramCondition.${field.camelFieldName}},'%') |
|
66 |
</if> |
|
67 |
#end |
|
68 |
</select> |
|
69 |
|
|
70 |
<select id="customPageMapList" resultType="map" parameterType="${package.EntitySpecParams}.${entity}Param"> |
|
71 |
select |
|
72 |
<include refid="Base_Column_List"/> |
|
73 |
from ${table.name} where 1 = 1 |
|
74 |
#foreach($field in ${mapperConditions}) |
|
75 |
<if test="paramCondition.${field.camelFieldName} != null and paramCondition.${field.camelFieldName} != ''"> |
|
76 |
and ${field.columnName} like CONCAT('%',#{paramCondition.${field.camelFieldName}},'%') |
|
77 |
</if> |
|
78 |
#end |
|
79 |
</select> |
|
80 |
|
|
81 |
</mapper> |