[#ftl]
<?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="${namespace}">
	
	<resultMap type="${fullClassName}" id="${alias}">
	[#list columns as col]
		<result column="${col.fieldName}" property="${col.propertyName}" />
	[/#list]
	</resultMap>
	
	[#if querySingleSQL??]
	<!-- 根据主键查询一条记录 -->
	<select id="get" resultMap="${alias}" [#if paramType??]parameterType="${paramType}"[/#if]>
		${querySingleSQL}
	</select>
	[/#if]
	
	<!-- 全查询 -->
	<select id="findAll" resultMap="${alias}">
		${queryFullSQL}
	</select>
	
	<!-- 向数据库增加一条记录 -->
	<insert id="insert" parameterType="${fullClassName}" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
		<!--
		<selectKey resultClass="int" keyProperty="id" > 
		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
		</selectKey>
		-->
		${insertSQL}
	</insert>
	
	[#if updateSQL??]
	<!-- 根据主键查询一条记录 -->
	<update id="update" parameterType="${fullClassName}">
		${updateSQL}
	</update>
	[/#if]
	
	[#if deleteSQL??]
	<!-- 根据主键删除一条记录 -->
	<delete id="delete" [#if paramType??]parameterType="${paramType}"[/#if]>
		${deleteSQL}
	</delete>
	[/#if]
	
	[#if queryPage??]
	<!-- 分页查询 -->
	<select id="queryPage" resultMap="${alias}" parameterType="map">
		${queryPage}
	</select>
	[/#if]
	
	<!-- 查询当前表的总记录数 -->
	<select id="queryCount" resultType="int">
		SELECT COUNT(*) FROM ${tableName}
	</select>
</mapper>
 