wms白胚原材料库存查询,如果amount_real为null就查询为0

master
mengjiao 2 months ago
parent b195472f0d
commit a1caec6ae3

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.wms.mapper.BpRawMaterialInMapper"> <mapper namespace="com.op.wms.mapper.BpRawMaterialInMapper">
<resultMap type="BpRawMaterialIn" id="BpRawMaterialInResult"> <resultMap type="BpRawMaterialIn" id="BpRawMaterialInResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="factoryCode" column="factory_code" /> <result property="factoryCode" column="factory_code" />
@ -27,12 +27,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectBpRawMaterialInVo"> <sql id="selectBpRawMaterialInVo">
select id, factory_code, wa_code, wl_code, material_code, material_name, unit, supply_name, amnount_plan, amount_real, user_defined1, user_defined2, user_defined3, user_defined4, user_defined5, create_by, gmt_create, modified_by, gmt_modified from bp_raw_material_in SELECT
id,
factory_code,
wa_code,
wl_code,
material_code,
material_name,
unit,
supply_name,
amnount_plan,
COALESCE(amount_real, 0) AS amount_real, -- 使用COALESCE函数处理NULL值
user_defined1,
user_defined2,
user_defined3,
user_defined4,
user_defined5,
create_by,
gmt_create,
modified_by,
gmt_modified
FROM
bp_raw_material_in
</sql> </sql>
<select id="selectBpRawMaterialInList" parameterType="BpRawMaterialIn" resultMap="BpRawMaterialInResult"> <select id="selectBpRawMaterialInList" parameterType="BpRawMaterialIn" resultMap="BpRawMaterialInResult">
<include refid="selectBpRawMaterialInVo"/> <include refid="selectBpRawMaterialInVo"/>
<where> <where>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if> <if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="waCode != null and waCode != ''"> and wa_code = #{waCode}</if> <if test="waCode != null and waCode != ''"> and wa_code = #{waCode}</if>
<if test="wlCode != null and wlCode != ''"> and wl_code = #{wlCode}</if> <if test="wlCode != null and wlCode != ''"> and wl_code = #{wlCode}</if>
@ -52,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="gmtModified != null "> and gmt_modified = #{gmtModified}</if> <if test="gmtModified != null "> and gmt_modified = #{gmtModified}</if>
</where> </where>
</select> </select>
<select id="selectBpRawMaterialInById" parameterType="String" resultMap="BpRawMaterialInResult"> <select id="selectBpRawMaterialInById" parameterType="String" resultMap="BpRawMaterialInResult">
<include refid="selectBpRawMaterialInVo"/> <include refid="selectBpRawMaterialInVo"/>
where id = #{id} where id = #{id}
@ -140,9 +160,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="deleteBpRawMaterialInByIds" parameterType="String"> <delete id="deleteBpRawMaterialInByIds" parameterType="String">
delete from bp_raw_material_in where id in delete from bp_raw_material_in where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

Loading…
Cancel
Save