Files
jshERP/jshERP-boot/src/main/resources/mapper_xml/MaterialCurrentStockMapperEx.xml
2024-05-22 00:56:03 +08:00

30 lines
1.3 KiB
XML

<?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="com.jsh.erp.datasource.mappers.MaterialCurrentStockMapperEx">
<insert id="batchInsert" parameterType="java.util.List">
insert into jsh_material_current_stock (material_id, depot_id, current_number)
values
<foreach collection="list" item="item" separator=",">
(#{item.materialId,jdbcType=BIGINT}, #{item.depotId,jdbcType=BIGINT},#{item.currentNumber,jdbcType=DECIMAL})
</foreach >
</insert>
<select id="getCurrentStockMapByIdList" resultType="com.jsh.erp.datasource.entities.MaterialCurrentStock">
select material_id, sum(current_number) current_number from jsh_material_current_stock
where 1=1
and ifnull(delete_flag,'0') !='1'
and material_id in
<foreach collection="materialIdList" item="materialId" index="index" separator="," open="(" close=")">
#{materialId}
</foreach>
group by material_id
</select>
<update id="updateUnitPriceByMId">
update jsh_material_current_stock set current_unit_price = #{currentUnitPrice}
where material_id = #{materialId}
and ifnull(delete_flag,'0') !='1'
</update>
</mapper>