<?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="${context.packageName}.mapper.${context.bizEnBigName}Mapper" >
|
<resultMap id="BaseResultMap" type="${context.packageName}.domain.${context.bizEnBigName}" >
|
<% for(item in tableInfo!){ %>
|
<% if(item.name == 'id' ){ %>
|
<id column="${item.name}" property="${item.propertyName}" jdbcType="${item.jdbcType}" />
|
<% }else{ %>
|
<result column="${item.name}" property="${item.propertyName}" jdbcType="${item.jdbcType}" />
|
<% } %>
|
<% } %>
|
</resultMap>
|
<sql id="Base_Column_List" >
|
${columnStr}
|
</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
|
select
|
<include refid="Base_Column_List" />
|
from ${context.tableName}
|
where id = #{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
|
delete from ${context.tableName}
|
where id = #{id,jdbcType=BIGINT}
|
</delete>
|
<insert id="insert" parameterType="${context.packageName}.domain.${context.bizEnBigName}" >
|
insert into ${context.tableName} (
|
<% for(item in tableInfo!){ %>
|
<% if(item.last == true ){ %>
|
${item.name}
|
<% }else{ %>
|
${item.name},
|
<% } %>
|
<% } %>
|
)
|
values (
|
<% for(item in tableInfo!){ %>
|
<% if(item.last == true ){ %>
|
#{${item.propertyName},jdbcType=${item.jdbcType}}
|
<% }else{ %>
|
#{${item.propertyName},jdbcType=${item.jdbcType}},
|
<% } %>
|
<% } %>
|
)
|
</insert>
|
<insert id="insertSelective" parameterType="${context.packageName}.domain.${context.bizEnBigName}" >
|
insert into ${context.tableName}
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<% for(item in tableInfo!){ %>
|
<if test="${item.propertyName} != null" >
|
${item.name},
|
</if>
|
<% } %>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<% for(item in tableInfo!){ %>
|
<if test="${item.propertyName} != null" >
|
#{${item.propertyName},jdbcType=${item.jdbcType}},
|
</if>
|
<% } %>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKeySelective" parameterType="${context.packageName}.domain.${context.bizEnBigName}" >
|
update ${context.tableName}
|
<set >
|
<% for(item in tableInfo!){ %>
|
<% if(item.name != 'id' ){ %>
|
<if test="${item.propertyName} != null" >
|
${item.name} = #{${item.propertyName},jdbcType=${item.jdbcType}},
|
</if>
|
<% } %>
|
<% } %>
|
</set>
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
<update id="updateByPrimaryKey" parameterType="${context.packageName}.domain.${context.bizEnBigName}" >
|
update ${context.tableName}
|
set
|
<% for(item in tableInfo!){ %>
|
<% if(item.name != 'id' ){ %>
|
<% if(item.last == true ){ %>
|
${item.name} = #{${item.propertyName},jdbcType=${item.jdbcType}}
|
<% }else{ %>
|
${item.name} = #{${item.propertyName},jdbcType=${item.jdbcType}},
|
<% } %>
|
<% } %>
|
<% } %>
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
</mapper>
|