refactor(入库计划明细实例): 增加批量插入

This commit is contained in:
LJW 2024-11-07 14:22:20 +08:00
parent be916cd00d
commit f274691bad

View File

@ -18,10 +18,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectWmsInPlanDetailEntityVo">
select ID, PLAN_ID, PLAN_DETAILS_ID, SOURCE, KNIFE_ID, CONSUME_LIFE, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME from WMS_IN_PLAN_DETAIL_ENTITY
select ID,
PLAN_ID,
PLAN_DETAILS_ID,
SOURCE,
KNIFE_ID,
CONSUME_LIFE,
CREATE_BY,
CREATE_TIME,
UPDATE_BY,
UPDATE_TIME
from WMS_IN_PLAN_DETAIL_ENTITY
</sql>
<select id="selectWmsInPlanDetailEntityList" parameterType="WmsInPlanDetailEntity" resultMap="WmsInPlanDetailEntityResult">
<select id="selectWmsInPlanDetailEntityList" parameterType="WmsInPlanDetailEntity"
resultMap="WmsInPlanDetailEntityResult">
<include refid="selectWmsInPlanDetailEntityVo"/>
<where>
<if test="planId != null and planId != ''">and PLAN_ID = #{planId}</if>
@ -41,7 +52,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where ID = #{id}
</select>
<insert id="insertWmsInPlanDetailEntity" parameterType="WmsInPlanDetailEntity" useGeneratedKeys="true" keyProperty="id">
<insert id="insertWmsInPlanDetailEntity" parameterType="WmsInPlanDetailEntity" useGeneratedKeys="true"
keyProperty="id">
insert into WMS_IN_PLAN_DETAIL_ENTITY
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planId != null">PLAN_ID,</if>
@ -84,7 +96,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteWmsInPlanDetailEntityById" parameterType="Long">
delete from WMS_IN_PLAN_DETAIL_ENTITY where ID = #{id}
delete
from WMS_IN_PLAN_DETAIL_ENTITY
where ID = #{id}
</delete>
<delete id="deleteWmsInPlanDetailEntityByIds" parameterType="String">
@ -93,4 +107,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<!--批量插入-->
<insert id="batchWmsInPlanDetailEntity">
insert into WMS_IN_PLAN_DETAIL_ENTITY(
ID,PLAN_ID,PLAN_DETAILS_ID,SOURCE,KNIFE_ID,CONSUME_LIFE,CREATE_BY,CREATE_TIME,UPDATE_BY,UPDATE_TIME) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.planId}, #{item.planDetailsId}, #{item.source}, #{item.knifeId},
#{item.consumeLife},#{item.createBy}, #{item.createTime}, #{item.updateBy},
#{item.updateTime})
</foreach>
</insert>
</mapper>