Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
RuoYi Vue
Commits
5a2a0c09
Commit
5a2a0c09
authored
Apr 12, 2021
by
Ricky
Browse files
优化主子表代码生成
parent
9aac65ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm
View file @
5a2a0c09
...
...
@@ -12,12 +12,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#
if
($
table
.
sub
)
<resultMap
id=
"
${
ClassName
}${
subClassName
}
Result"
type=
"
${
ClassName
}
"
extends=
"
${
ClassName
}
Result"
>
<collection
property=
"
${
subclassName
}
List"
notNullColumn=
"
${
subTable
.
pkColumn
.
columnName
}
"
javaType=
"java.util.List"
resultMap=
"
${
subClassName
}
Result"
/>
<collection
property=
"
${
subclassName
}
List"
notNullColumn=
"
sub_
${
subTable
.
pkColumn
.
columnName
}
"
javaType=
"java.util.List"
resultMap=
"
${
subClassName
}
Result"
/>
</resultMap>
<resultMap
type=
"
${
subClassName
}
"
id=
"
${
subClassName
}
Result"
>
#
foreach
($
column
in
$
subTable
.
columns
)
<result
property=
"
${
column
.
javaField
}
"
column=
"
${
column
.
columnName
}
"
/>
<result
property=
"
${
column
.
javaField
}
"
column=
"
sub_
${
column
.
columnName
}
"
/>
#
end
</resultMap>
#
end
...
...
@@ -64,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where
${
pkColumn
.
columnName
}
=
#{
${
pkColumn
.
javaField
}
}
#
elseif
($
table
.
sub
)
select
#
foreach
($
column
in
$
columns
)
a.
$
column
.
columnName
#
if
($
velocityCount
!=
$
columns
.
size
())
,
#
end
#
end
,
#
foreach
($
column
in
$
subTable
.
columns
)
b.
$
column
.
columnName
#
if
($
velocityCount
!=
$
subTable
.
columns
.
size
())
,
#
end
#
end
#
foreach
($
column
in
$
subTable
.
columns
)
b.
$
column
.
columnName
as sub_
$
column
.
columnName
#
if
($
velocityCount
!=
$
subTable
.
columns
.
size
())
,
#
end
#
end
from
${
tableName
}
a
left join
${
subTableName
}
b on b.
${
subTableFkName
}
= a.
${
pkColumn
.
columnName
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment