26 lines
1.2 KiB
XML
26 lines
1.2 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
<mapper namespace="${packageName}.mapper.${ClassName}Mapper">
|
|
<resultMap type="${ClassName}" id="${ClassName}Result">
|
|
#foreach ($column in $columns)
|
|
<result property="${column.javaField}" column="${column.columnName}" />
|
|
#end
|
|
</resultMap>
|
|
#if($table.sub)
|
|
|
|
<resultMap id="${ClassName}${subClassName}Result" type="${ClassName}" extends="${ClassName}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="sub_${column.columnName}" />
|
|
#end
|
|
</resultMap>
|
|
#end
|
|
|
|
<sql id="select${ClassName}Vo">
|
|
select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName}
|
|
</sql>
|
|
</mapper> |