mapper.xml.vm 897 B

1234567891011121314151617181920212223
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="${packageName}.mapper.${ClassName}Mapper">
  6. <resultMap type="${ClassName}" id="${ClassName}Result">
  7. #foreach ($column in $columns)
  8. <result property="${column.javaField}" column="${column.columnName}" />
  9. #end
  10. </resultMap>
  11. #if($table.sub)
  12. <select id="select${subClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}" resultType="${packageName}.domain.${ClassName}">
  13. select * from ${subTableName} where ${subTableFkName} = #{${pkColumn.javaField}}
  14. </select>
  15. <delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${pkColumn.javaType}">
  16. delete from ${subTableName} where ${subTableFkName} = #{${pkColumn.javaField}}
  17. </delete>
  18. #end
  19. </mapper>