|
|
|
<?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.op.wms.mapper.BpRawMaterialInMapper">
|
|
|
|
|
|
|
|
<resultMap type="BpRawMaterialIn" id="BpRawMaterialInResult">
|
|
|
|
<result property="id" column="id" />
|
|
|
|
<result property="factoryCode" column="factory_code" />
|
|
|
|
<result property="waCode" column="wa_code" />
|
|
|
|
<result property="wlCode" column="wl_code" />
|
|
|
|
<result property="materialCode" column="material_code" />
|
|
|
|
<result property="materialName" column="material_name" />
|
|
|
|
<result property="unit" column="unit" />
|
|
|
|
<result property="supplyName" column="supply_name" />
|
|
|
|
<result property="amnountPlan" column="amnount_plan" />
|
|
|
|
<result property="amountReal" column="amount_real" />
|
|
|
|
<result property="userDefined1" column="user_defined1" />
|
|
|
|
<result property="userDefined2" column="user_defined2" />
|
|
|
|
<result property="userDefined3" column="user_defined3" />
|
|
|
|
<result property="userDefined4" column="user_defined4" />
|
|
|
|
<result property="userDefined5" column="user_defined5" />
|
|
|
|
<result property="createBy" column="create_by" />
|
|
|
|
<result property="gmtCreate" column="gmt_create" />
|
|
|
|
<result property="modifiedBy" column="modified_by" />
|
|
|
|
<result property="gmtModified" column="gmt_modified" />
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectBpRawMaterialInVo">
|
|
|
|
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>
|
|
|
|
<select id="selectBpRawMaterialInList" parameterType="BpRawMaterialIn" resultMap="BpRawMaterialInResult">
|
|
|
|
<include refid="selectBpRawMaterialInVo"/>
|
|
|
|
<where>
|
|
|
|
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</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="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
|
|
|
|
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
|
|
|
|
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
|
|
|
|
<if test="supplyName != null and supplyName != ''"> and supply_name like concat('%', #{supplyName}, '%')</if>
|
|
|
|
<if test="amnountPlan != null "> and amnount_plan = #{amnountPlan}</if>
|
|
|
|
<if test="amountReal != null "> and amount_real = #{amountReal}</if>
|
|
|
|
<if test="userDefined1 != null and userDefined1 != ''"> and user_defined1 = #{userDefined1}</if>
|
|
|
|
<if test="userDefined2 != null and userDefined2 != ''"> and user_defined2 = #{userDefined2}</if>
|
|
|
|
<if test="userDefined3 != null and userDefined3 != ''"> and user_defined3 = #{userDefined3}</if>
|
|
|
|
<if test="userDefined4 != null and userDefined4 != ''"> and user_defined4 = #{userDefined4}</if>
|
|
|
|
<if test="userDefined5 != null and userDefined5 != ''"> and user_defined5 = #{userDefined5}</if>
|
|
|
|
<if test="gmtCreate != null "> and gmt_create = #{gmtCreate}</if>
|
|
|
|
<if test="modifiedBy != null and modifiedBy != ''"> and modified_by = #{modifiedBy}</if>
|
|
|
|
<if test="gmtModified != null "> and gmt_modified = #{gmtModified}</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectBpRawMaterialInById" parameterType="String" resultMap="BpRawMaterialInResult">
|
|
|
|
<include refid="selectBpRawMaterialInVo"/>
|
|
|
|
where id = #{id}
|
|
|
|
</select>
|
|
|
|
<select id="selectBpRawMaterialInBymateriaName" resultMap="BpRawMaterialInResult" parameterType="String">
|
|
|
|
select id, factory_code, wa_code, wl_code, material_code, 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 where material_name = #{materiaName}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertBpRawMaterialIn" parameterType="BpRawMaterialIn">
|
|
|
|
insert into bp_raw_material_in
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="id != null">id,</if>
|
|
|
|
<if test="factoryCode != null">factory_code,</if>
|
|
|
|
<if test="waCode != null">wa_code,</if>
|
|
|
|
<if test="wlCode != null">wl_code,</if>
|
|
|
|
<if test="materialCode != null">material_code,</if>
|
|
|
|
<if test="materialName != null">material_name,</if>
|
|
|
|
<if test="unit != null">unit,</if>
|
|
|
|
<if test="supplyName != null">supply_name,</if>
|
|
|
|
<if test="amnountPlan != null">amnount_plan,</if>
|
|
|
|
<if test="amountReal != null">amount_real,</if>
|
|
|
|
<if test="userDefined1 != null">user_defined1,</if>
|
|
|
|
<if test="userDefined2 != null">user_defined2,</if>
|
|
|
|
<if test="userDefined3 != null">user_defined3,</if>
|
|
|
|
<if test="userDefined4 != null">user_defined4,</if>
|
|
|
|
<if test="userDefined5 != null">user_defined5,</if>
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
<if test="gmtCreate != null">gmt_create,</if>
|
|
|
|
<if test="modifiedBy != null">modified_by,</if>
|
|
|
|
<if test="gmtModified != null">gmt_modified,</if>
|
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="id != null">#{id},</if>
|
|
|
|
<if test="factoryCode != null">#{factoryCode},</if>
|
|
|
|
<if test="waCode != null">#{waCode},</if>
|
|
|
|
<if test="wlCode != null">#{wlCode},</if>
|
|
|
|
<if test="materialCode != null">#{materialCode},</if>
|
|
|
|
<if test="materialName != null">#{materialName},</if>
|
|
|
|
<if test="unit != null">#{unit},</if>
|
|
|
|
<if test="supplyName != null">#{supplyName},</if>
|
|
|
|
<if test="amnountPlan != null">#{amnountPlan},</if>
|
|
|
|
<if test="amountReal != null">#{amountReal},</if>
|
|
|
|
<if test="userDefined1 != null">#{userDefined1},</if>
|
|
|
|
<if test="userDefined2 != null">#{userDefined2},</if>
|
|
|
|
<if test="userDefined3 != null">#{userDefined3},</if>
|
|
|
|
<if test="userDefined4 != null">#{userDefined4},</if>
|
|
|
|
<if test="userDefined5 != null">#{userDefined5},</if>
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
<if test="gmtCreate != null">#{gmtCreate},</if>
|
|
|
|
<if test="modifiedBy != null">#{modifiedBy},</if>
|
|
|
|
<if test="gmtModified != null">#{gmtModified},</if>
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateBpRawMaterialIn" parameterType="BpRawMaterialIn">
|
|
|
|
update bp_raw_material_in
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
|
|
|
|
<if test="waCode != null">wa_code = #{waCode},</if>
|
|
|
|
<if test="wlCode != null">wl_code = #{wlCode},</if>
|
|
|
|
<if test="materialCode != null">material_code = #{materialCode},</if>
|
|
|
|
<if test="materialName != null">material_name = #{materialName},</if>
|
|
|
|
<if test="unit != null">unit = #{unit},</if>
|
|
|
|
<if test="supplyName != null">supply_name = #{supplyName},</if>
|
|
|
|
<if test="amnountPlan != null">amnount_plan = #{amnountPlan},</if>
|
|
|
|
<if test="amountReal != null">amount_real = #{amountReal},</if>
|
|
|
|
<if test="userDefined1 != null">user_defined1 = #{userDefined1},</if>
|
|
|
|
<if test="userDefined2 != null">user_defined2 = #{userDefined2},</if>
|
|
|
|
<if test="userDefined3 != null">user_defined3 = #{userDefined3},</if>
|
|
|
|
<if test="userDefined4 != null">user_defined4 = #{userDefined4},</if>
|
|
|
|
<if test="userDefined5 != null">user_defined5 = #{userDefined5},</if>
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
|
|
|
|
<if test="modifiedBy != null">modified_by = #{modifiedBy},</if>
|
|
|
|
<if test="gmtModified != null">gmt_modified = #{gmtModified},</if>
|
|
|
|
</trim>
|
|
|
|
where id = #{id}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<delete id="deleteBpRawMaterialInById" parameterType="String">
|
|
|
|
delete from bp_raw_material_in where id = #{id}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteBpRawMaterialInByIds" parameterType="String">
|
|
|
|
delete from bp_raw_material_in where id in
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
</mapper>
|