https://blog.csdn.net/zengdeqing2012/article/details/78864922
<?xml version="1.0" encoding="UTF-8"?>
mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wlw.mgt.dao.WmsInPoolMapper">
<resultMap id="BaseResultMap" type="cn.wlw.mgt.entity.WmsInPool">
<id column="POOL_PK_NO" jdbcType="DECIMAL" property="poolPkNo" />
<result column="BIG_DATA" property="bigData" jdbcType="CLOB" javaType = "java.lang.String"/>
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" />
<result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
POOL_PK_NO,BIG_DATA,CREATE_TIME,UPDATE_TIME
</sql>
<select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from WMS_IN_POOL
where POOL_PK_NO = #{poolPkNo,jdbcType=DECIMAL}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
delete from WMS_IN_POOL
where POOL_PK_NO = #{poolPkNo,jdbcType=DECIMAL}
</delete>
<insert id="insert" parameterType="cn.wlw.mgt.entity.WmsInPool">
<selectKey resultType="Decimal" keyProperty="poolPkNo" order="BEFORE">
SELECT nvl(max(POOL_PK_NO),0)+1 from WMS_IN_POOL
</selectKey>
insert into WMS_IN_POOL (POOL_PK_NO,BIG_DATA,CREATE_TIME,UPDATE_TIME)
values (
#{poolPkNo,jdbcType=DECIMAL},#{bigData,jdbcType=CLOB},
#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="cn.wlw.mgt.entity.WmsInPool">
insert into WMS_IN_POOL
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="poolPkNo != null">
POOL_PK_NO,
</if>
<if test="bigData != null">
BIG_DATA,
</if>
<if test="createTime != null">
CREATE_TIME,
</if>
<if test="updateTime != null">
UPDATE_TIME,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="poolPkNo != null">
#{poolPkNo,jdbcType=DECIMAL},
</if>
<if test="bigData != null">
#{bigData,jdbcType=CLOB},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.wlw.mgt.entity.WmsInPool">
update WMS_IN_POOL
<set>
<if test="bigData != null">
BIG_DATA = #{bigData,jdbcType=CLOB},
</if>
<if test="createDate != null">
UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where POOL_PK_NO = #{poolPkNo,jdbcType=DECIMAL}
</update>
<update id="updateByPrimaryKey" parameterType="cn.wlw.mgt.entity.WmsInPool">
update WMS_IN_POOL
set BIG_DATA = #{bigDdata,jdbcType=CLOB},
UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP}
where POOL_PK_NO = #{poolPkNo,jdbcType=DECIMAL}
</update>
<insert id="batchInsertWmsInPool" parameterType="cn.wlw.mgt.entity.WmsInPool">
insert into WMS_IN_POOL(
POOL_PK_NO,BIG_DATA,CREATE_TIME,UPDATE_TIME)
select SEQ_POOL_PK_NO.NEXTVAL, A.* from(
<foreach collection="wmsInPools" item="item" index="index" separator="UNION ALL">
SELECT
#{item.bigData,jdbcType=CLOB},
#{item.createTime,jdbcType=TIMESTAMP},
#{item.updateTime,jdbcType=TIMESTAMP}
from dual
</foreach>
) A
</insert>
</mapper>