You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

442 lines
26 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.op.wms.mapper.WmsOdsMateStorageNewsSnMapper">
<resultMap type="WmsOdsMateStorageNewsSn" id="WmsOdsMateStorageNewsSnResult">
<result property="mateOrderInSnId" column="mate_order_in_sn_id"/>
<result property="whCode" column="wh_code"/>
<result property="waCode" column="wa_code"/>
<result property="wlCode" column="wl_code"/>
<result property="orderNo" column="order_no"/>
<result property="poNo" column="po_no"/>
<result property="poLine" column="po_line"/>
<result property="materialCode" column="material_code"/>
<result property="materialDesc" column="material_desc"/>
<result property="sn" column="sn"/>
<result property="barCode" column="bar_code"/>
<result property="amount" column="amount"/>
<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="userDefined6" column="user_defined6"/>
<result property="userDefined7" column="user_defined7"/>
<result property="userDefined8" column="user_defined8"/>
<result property="userDefined9" column="user_defined9"/>
<result property="userDefined10" column="user_defined10"/>
<result property="createBy" column="create_by"/>
<result property="gmtCreate" column="gmt_create"/>
<result property="lastModifiedBy" column="last_modified_by"/>
<result property="gmtModified" column="gmt_modified"/>
<result property="activeFlag" column="active_flag"/>
<result property="factoryCode" column="factory_code"/>
<result property="outNumber" column="outNumber"/>
<result property="status" column="status"/>
<result property="sapFactoryCode" column="sap_factory_code"/>
</resultMap>
<sql id="selectWmsOdsMateStorageNewsSnVo">
select mate_order_in_sn_id, wh_code, wa_code, wl_code, order_no, po_no, po_line, material_code, material_desc, sn, bar_code, amount, user_defined1, user_defined2, user_defined3, user_defined4, user_defined5, user_defined6, user_defined7, user_defined8, user_defined9, user_defined10, create_by, gmt_create, last_modified_by, gmt_modified, active_flag, factory_code, sap_factory_code from wms_ods_mate_storage_news_sn
</sql>
<select id="selectWmsOdsMateStorageNewsSnList" parameterType="WmsOdsMateStorageNewsSn"
resultMap="WmsOdsMateStorageNewsSnResult">
SELECT DISTINCT
wms_ods_mate_storage_news_sn.mate_order_in_sn_id,
wms_ods_mate_storage_news_sn.wh_code,
wms_ods_mate_storage_news_sn.wa_code,
wms_ods_mate_storage_news_sn.wl_code,
wms_ods_mate_storage_news_sn.po_line,
wms_ods_mate_storage_news_sn.material_code,
wms_ods_mate_storage_news_sn.material_desc,
wms_ods_mate_storage_news_sn.sn,
wms_ods_mate_storage_news_sn.bar_code,
wms_ods_mate_storage_news_sn.amount,
wms_ods_mate_storage_news_sn.user_defined1,
wms_ods_mate_storage_news_sn.user_defined2,
wms_ods_mate_storage_news_sn.user_defined3,
wms_ods_mate_storage_news_sn.user_defined4,
wms_ods_mate_storage_news_sn.user_defined5,
wms_ods_mate_storage_news_sn.user_defined6,
wms_ods_mate_storage_news_sn.user_defined7,
wms_ods_mate_storage_news_sn.user_defined8,
wms_ods_mate_storage_news_sn.user_defined9,
wms_ods_mate_storage_news_sn.user_defined10,
wms_ods_mate_storage_news_sn.create_by,
wms_ods_mate_storage_news_sn.gmt_create,
wms_ods_mate_storage_news_sn.last_modified_by,
wms_ods_mate_storage_news_sn.gmt_modified,
wms_ods_mate_storage_news_sn.active_flag,
wms_ods_mate_storage_news_sn.factory_code,
wms_ods_mate_storage_news_sn.sap_factory_code ,
wms_ods_mate_storage_news_sn.out_number outNumber,
ods_procure_order.Procure_Code order_no,
CASE
WHEN out_number IS NOT NULL THEN '1'
ELSE '0'
END AS status,
ods_procure_order.User_Defined5 po_no
FROM
wms_ods_mate_storage_news_sn
LEFT JOIN ods_procure_order_card ON ods_procure_order_card.user_defined1= wms_ods_mate_storage_news_sn.wl_code
LEFT JOIN ods_procure_order ON CAST ( ods_procure_order.ID AS NVARCHAR ) = ods_procure_order_card.User_Defined4
<where>
<if test="whCode != null and whCode != ''">and wms_ods_mate_storage_news_sn.wh_code = #{whCode}</if>
<if test="waCode != null and waCode != ''">and wms_ods_mate_storage_news_sn.wa_code = #{waCode}</if>
<if test="wlCode != null and wlCode != ''">and wms_ods_mate_storage_news_sn.wl_code = #{wlCode}</if>
<if test="orderNo != null and orderNo != ''">and ods_procure_order.Procure_Code = #{orderNo}</if>
<if test="poNo != null and poNo != ''">and ods_procure_order.User_Defined5 = #{poNo}</if>
<if test="poLine != null and poLine != ''">and wms_ods_mate_storage_news_sn.po_line = #{poLine}</if>
<if test="materialCode != null and materialCode != ''">and wms_ods_mate_storage_news_sn.material_code like concat('%', #{materialCode},
'%') </if>
<if test="materialDesc != null and materialDesc != ''">and wms_ods_mate_storage_news_sn.material_desc = #{materialDesc}</if>
<if test="sn != null and sn != ''">and wms_ods_mate_storage_news_sn.sn = #{sn}</if>
<if test="barCode != null and barCode != ''">and wms_ods_mate_storage_news_sn.bar_code = #{barCode}</if>
<if test="amount != null ">and wms_ods_mate_storage_news_sn.amount = #{amount}</if>
<if test="userDefined1 != null and userDefined1 != ''">and wms_ods_mate_storage_news_sn.user_defined1 = #{userDefined1}</if>
<if test="userDefined2 != null and userDefined2 != ''">and wms_ods_mate_storage_news_sn.user_defined2 = #{userDefined2}</if>
<if test="userDefined3 != null and userDefined3 != ''">and wms_ods_mate_storage_news_sn.user_defined3 = #{userDefined3}</if>
<if test="userDefined4 != null and userDefined4 != ''">and wms_ods_mate_storage_news_sn.user_defined4 = #{userDefined4}</if>
<if test="userDefined5 != null and userDefined5 != ''">and wms_ods_mate_storage_news_sn.user_defined5 = #{userDefined5}</if>
<if test="userDefined6 != null and userDefined6 != ''">and wms_ods_mate_storage_news_sn.user_defined6 = #{userDefined6}</if>
<if test="userDefined7 != null and userDefined7 != ''">and wms_ods_mate_storage_news_sn.user_defined7 = #{userDefined7}</if>
<if test="userDefined8 != null and userDefined8 != ''">and wms_ods_mate_storage_news_sn.user_defined8 = #{userDefined8}</if>
<if test="userDefined9 != null and userDefined9 != ''">and wms_ods_mate_storage_news_sn.user_defined9 = #{userDefined9}</if>
<if test="userDefined10 != null and userDefined10 != ''">and wms_ods_mate_storage_news_sn.user_defined10 = #{userDefined10}</if>
<if test="gmtCreate != null ">and CAST(wms_ods_mate_storage_news_sn.gmt_create AS DATE) = CAST(#{gmtCreate} AS DATE) </if>
<if test="lastModifiedBy != null and lastModifiedBy != ''">and wms_ods_mate_storage_news_sn.last_modified_by = #{lastModifiedBy}</if>
<if test="gmtModified != null ">and wms_ods_mate_storage_news_sn.gmt_modified = #{gmtModified}</if>
<if test="activeFlag != null and activeFlag != ''">and wms_ods_mate_storage_news_sn.active_flag = #{activeFlag}</if>
<if test="factoryCode != null and factoryCode != ''">and wms_ods_mate_storage_news_sn.factory_code = #{factoryCode}</if>
<if test="sapFactoryCode != null and sapFactoryCode != ''">and wms_ods_mate_storage_news_sn.sap_factory_code = #{sapFactoryCode}</if>
</where>
ORDER BY wms_ods_mate_storage_news_sn.gmt_create DESC
</select>
<select id="selectWmsOdsMateStorageNewsSnByMateOrderInSnId" parameterType="Long"
resultMap="WmsOdsMateStorageNewsSnResult">
<include refid="selectWmsOdsMateStorageNewsSnVo"/>
where mate_order_in_sn_id = #{mateOrderInSnId}
</select>
<select id="selectWmsOdsMateStorageNewsSnByMateOrderInSnIdk"
resultMap="WmsOdsMateStorageNewsSnResult">
<include refid="selectWmsOdsMateStorageNewsSnVo"/>
where mate_order_in_sn_id = #{mateOrderInSnId}
</select>
<insert id="insertWmsOdsMateStorageNewsSn" parameterType="WmsOdsMateStorageNewsSn" useGeneratedKeys="true"
keyProperty="mateOrderInSnId">
insert into wms_ods_mate_storage_news_sn
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="mateOrderInSnId != null">mate_order_in_sn_id,</if>
<if test="whCode != null">wh_code,</if>
<if test="waCode != null">wa_code,</if>
<if test="wlCode != null">wl_code,</if>
<if test="orderNo != null">order_no,</if>
<if test="poNo != null">po_no,</if>
<if test="poLine != null">po_line,</if>
<if test="materialCode != null">material_code,</if>
<if test="materialDesc != null">material_desc,</if>
<if test="sn != null">sn,</if>
<if test="barCode != null">bar_code,</if>
<if test="amount != null">amount,</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="userDefined6 != null">user_defined6,</if>
<if test="userDefined7 != null">user_defined7,</if>
<if test="userDefined8 != null">user_defined8,</if>
<if test="userDefined9 != null">user_defined9,</if>
<if test="userDefined10 != null">user_defined10,</if>
<if test="createBy != null">create_by,</if>
<if test="gmtCreate != null">gmt_create,</if>
<if test="lastModifiedBy != null">last_modified_by,</if>
<if test="gmtModified != null">gmt_modified,</if>
<if test="activeFlag != null">active_flag,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="sapFactoryCode != null">sap_factory_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mateOrderInSnId != null">#{mateOrderInSnId},</if>
<if test="whCode != null">#{whCode},</if>
<if test="waCode != null">#{waCode},</if>
<if test="wlCode != null">#{wlCode},</if>
<if test="orderNo != null">#{orderNo},</if>
<if test="poNo != null">#{poNo},</if>
<if test="poLine != null">#{poLine},</if>
<if test="materialCode != null">#{materialCode},</if>
<if test="materialDesc != null">#{materialDesc},</if>
<if test="sn != null">#{sn},</if>
<if test="barCode != null">#{barCode},</if>
<if test="amount != null">#{amount},</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="userDefined6 != null">#{userDefined6},</if>
<if test="userDefined7 != null">#{userDefined7},</if>
<if test="userDefined8 != null">#{userDefined8},</if>
<if test="userDefined9 != null">#{userDefined9},</if>
<if test="userDefined10 != null">#{userDefined10},</if>
<if test="createBy != null">#{createBy},</if>
<if test="gmtCreate != null">#{gmtCreate},</if>
<if test="lastModifiedBy != null">#{lastModifiedBy},</if>
<if test="gmtModified != null">#{gmtModified},</if>
<if test="activeFlag != null">#{activeFlag},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="sapFactoryCode != null">#{sapFactoryCode},</if>
</trim>
</insert>
<update id="updateWmsOdsMateStorageNewsSn" parameterType="WmsOdsMateStorageNewsSn">
update wms_ods_mate_storage_news_sn
<trim prefix="SET" suffixOverrides=",">
<if test="whCode != null">wh_code = #{whCode},</if>
<if test="waCode != null">wa_code = #{waCode},</if>
<if test="wlCode != null">wl_code = #{wlCode},</if>
<if test="orderNo != null">order_no = #{orderNo},</if>
<if test="poNo != null">po_no = #{poNo},</if>
<if test="poLine != null">po_line = #{poLine},</if>
<if test="materialCode != null">material_code = #{materialCode},</if>
<if test="materialDesc != null">material_desc = #{materialDesc},</if>
<if test="sn != null">sn = #{sn},</if>
<if test="barCode != null">bar_code = #{barCode},</if>
<if test="amount != null">amount = #{amount},</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="userDefined6 != null">user_defined6 = #{userDefined6},</if>
<if test="userDefined7 != null">user_defined7 = #{userDefined7},</if>
<if test="userDefined8 != null">user_defined8 = #{userDefined8},</if>
<if test="userDefined9 != null">user_defined9 = #{userDefined9},</if>
<if test="userDefined10 != null">user_defined10 = #{userDefined10},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="lastModifiedBy != null">last_modified_by = #{lastModifiedBy},</if>
<if test="gmtModified != null">gmt_modified = #{gmtModified},</if>
<if test="activeFlag != null">active_flag = #{activeFlag},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="sapFactoryCode != null">sap_factory_code = #{sapFactoryCode},</if>
</trim>
where mate_order_in_sn_id = #{mateOrderInSnId}
</update>
<update id="updateWmsOdsMateStorageNewsSnTWM" parameterType="WmsOdsMateStorageNewsSn">
update wms_ods_mate_storage_news_sn
set user_defined3 = #{userDefined3},
gmt_modified=GETDATE()
where wh_code=#{whCode} and wl_code=#{wlCode} and wa_code=#{waCode} and material_code=#{materialCode}
</update>
<delete id="deleteWmsOdsMateStorageNewsSnByMateOrderInSnId" parameterType="Long">
delete from wms_ods_mate_storage_news_sn where mate_order_in_sn_id = #{mateOrderInSnId}
</delete>
<delete id="deleteWmsOdsMateStorageNewsSnBycard" >
delete from wms_ods_mate_storage_news_sn where wl_code=#{wlCode}
</delete>
<delete id="deleteWmsOdsMateStorageNewsSnByMateOrderInSnIds" parameterType="String">
delete from wms_ods_mate_storage_news_sn where mate_order_in_sn_id in
<foreach item="mateOrderInSnId" collection="array" open="(" separator="," close=")">
#{mateOrderInSnId}
</foreach>
</delete>
<select id="cardDy" resultMap="WmsOdsMateStorageNewsSnResult">
<include refid="selectWmsOdsMateStorageNewsSnVo"/>
where mate_order_in_sn_id in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item.mateOrderInSnId}
</foreach>
</select>
<update id="updateAdd">
update wms_ods_mate_storage_news
set amount = ISNULL(amount, 0) + #{amount},
storage_amount = ISNULL(storage_amount, 0) + #{amount},
gmt_modified=GETDATE()
where wh_code=#{whCode} and wl_code=#{wlCode} and wa_code=#{waCode} and material_code=#{materialCode}
</update>
<update id="updatekdd">
update wms_ods_mate_storage_news
set occupy_amount =ISNULL(occupy_amount, 0) + #{amount},
last_modified_by=#{lastModifiedBy},
gmt_modified=GETDATE()
where wh_code=#{whCode} and wa_code=#{waCode} and wl_code=#{wlCode} and material_code=#{materialCode}
</update>
<update id="updatesub">
update wms_ods_mate_storage_news
set occupy_amount =ISNULL(occupy_amount, 0) - #{amount},
amount = ISNULL(amount, 0) - #{amount},
last_modified_by=#{lastModifiedBy},
gmt_modified=GETDATE()
where wh_code=#{userDefined2} and wl_code=#{sn} and wa_code=#{waCode} and wl_code=#{userDefined3} and material_code=#{materialCode}
</update>
<select id="selectByWhCodeAndMate">
<include refid="selectWmsOdsMateStorageNewsSnVo"/>
where mate_order_in_sn_id = #{mateOrderInSnId}
</select>
<select id="selectwmsRfidNotwo" parameterType="WmsOdsMateStorageNewsSn" resultMap="WmsOdsMateStorageNewsSnResult">
<include refid="selectWmsOdsMateStorageNewsSnVo"/>
WHERE
sn =#{ rfidNo }
AND active_flag = '1'
AND User_Defined1 IS NULL
</select>
<select id="selectWmsOdsMateStorageNewsSnByWlCode" parameterType="WmsOdsMateStorageNewsSn"
resultMap="WmsOdsMateStorageNewsSnResult">
<include refid="selectWmsOdsMateStorageNewsSnVo"/>
<where>
<if test="whCode != null and whCode != ''">and wh_code = #{whCode}</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="orderNo != null and orderNo != ''">and order_no = #{orderNo}</if>
<if test="poNo != null and poNo != ''">and po_no = #{poNo}</if>
<if test="poLine != null and poLine != ''">and po_line = #{poLine}</if>
<if test="materialCode != null and materialCode != ''">and material_code = #{materialCode}</if>
<if test="materialDesc != null and materialDesc != ''">and material_desc = #{materialDesc}</if>
<if test="sn != null and sn != ''">and sn = #{sn}</if>
<if test="barCode != null and barCode != ''">and bar_code = #{barCode}</if>
<if test="amount != null ">and amount = #{amount}</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="userDefined6 != null and userDefined6 != ''">and user_defined6 = #{userDefined6}</if>
<if test="userDefined7 != null and userDefined7 != ''">and user_defined7 = #{userDefined7}</if>
<if test="userDefined8 != null and userDefined8 != ''">and user_defined8 = #{userDefined8}</if>
<if test="userDefined9 != null and userDefined9 != ''">and user_defined9 = #{userDefined9}</if>
<if test="userDefined10 != null and userDefined10 != ''">and user_defined10 = #{userDefined10}</if>
<if test="gmtCreate != null ">and gmt_create = #{gmtCreate}</if>
<if test="lastModifiedBy != null and lastModifiedBy != ''">and last_modified_by = #{lastModifiedBy}</if>
<if test="gmtModified != null ">and gmt_modified = #{gmtModified}</if>
<if test="activeFlag != null and activeFlag != ''">and active_flag = #{activeFlag}</if>
<if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if>
<if test="sapFactoryCode != null and sapFactoryCode != ''">and sap_factory_code = #{sapFactoryCode}</if>
</where>
</select>
<update id="updateWmsOdsMateStorageNewsSnAddoutNumber" >
update wms_ods_mate_storage_news_sn
set out_number = ISNULL(out_number, 0) + #{outNumber},
last_modified_by = #{lastModifiedBy},
gmt_modified=GETDATE()
where mate_order_in_sn_id = #{mateOrderInSnId}
</update>
<select id="selectWmsOdsMateStorageNewsSnByWlCodeTEM" parameterType="WmsOdsMateStorageNewsSn"
resultMap="WmsOdsMateStorageNewsSnResult">
SELECT
mate_order_in_sn_id,
wh_code,
wa_code,
wl_code,
order_no,
po_no,
po_line,
material_code,
material_desc,
sn,
bar_code,
amount-ISNULL(out_number, 0) amount,
user_defined1,
user_defined2,
user_defined3,
user_defined4,
user_defined5,
user_defined6,
user_defined7,
user_defined8,
user_defined9,
user_defined10,
create_by,
gmt_create,
last_modified_by,
gmt_modified,
active_flag,
factory_code,
sap_factory_code
FROM
wms_ods_mate_storage_news_sn
<where>
<if test="whCode != null and whCode != ''">and wh_code = #{whCode}</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="orderNo != null and orderNo != ''">and order_no = #{orderNo}</if>
<if test="poNo != null and poNo != ''">and po_no = #{poNo}</if>
<if test="poLine != null and poLine != ''">and po_line = #{poLine}</if>
<if test="materialCode != null and materialCode != ''">and material_code = #{materialCode}</if>
<if test="materialDesc != null and materialDesc != ''">and material_desc = #{materialDesc}</if>
<if test="sn != null and sn != ''">and sn = #{sn}</if>
<if test="barCode != null and barCode != ''">and bar_code = #{barCode}</if>
<if test="amount != null ">and amount = #{amount}</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="userDefined6 != null and userDefined6 != ''">and user_defined6 = #{userDefined6}</if>
<if test="userDefined7 != null and userDefined7 != ''">and user_defined7 = #{userDefined7}</if>
<if test="userDefined8 != null and userDefined8 != ''">and user_defined8 = #{userDefined8}</if>
<if test="userDefined9 != null and userDefined9 != ''">and user_defined9 = #{userDefined9}</if>
<if test="userDefined10 != null and userDefined10 != ''">and user_defined10 = #{userDefined10}</if>
<if test="gmtCreate != null ">and gmt_create = #{gmtCreate}</if>
<if test="lastModifiedBy != null and lastModifiedBy != ''">and last_modified_by = #{lastModifiedBy}</if>
<if test="gmtModified != null ">and gmt_modified = #{gmtModified}</if>
<if test="activeFlag != null and activeFlag != ''">and active_flag = #{activeFlag}</if>
<if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if>
<if test="sapFactoryCode != null and sapFactoryCode != ''">and sap_factory_code = #{sapFactoryCode}</if>
</where>
</select>
<select id="selectWmsOdsMateStorageNewsSnBC" resultType="java.lang.String">
SELECT TOP
1 user_defined2
FROM
wms_ods_mate_storage_news_sn
WHERE
material_code LIKE concat ( '%', #{ materialCode }, '%' )
ORDER BY
gmt_create DESC;
</select>
<select id="selectSapOdsMateStorageNewsList" parameterType="com.op.wms.domain.SapOdsMateStorageNews" resultType="com.op.wms.domain.SapOdsMateStorageNews">
SELECT
storage_id storageId,
WERKS werks,
LGORT lgort,
CHARG charg,
MAKTX maktx,
MATKL matkl,
MATNR matnr,
MEINS meins,
CLABS clabs,
CINSM cinsm,
CEINM ceinm,
CSPEM cspem
FROM
sap_ods_mate_storage_news
<where>
<if test="storageId != null and storageId != ''">and storage_id = #{storageId}</if>
<if test="werks != null and werks != ''">and WERKS = #{werks}</if>
<if test="lgort != null and lgort != ''">and LGORT = #{lgort}</if>
<if test="charg != null and charg != ''">and CHARG = #{charg}</if>
<if test="maktx != null and maktx != ''">and MAKTX like concat ( '%', #{maktx}, '%' )</if>
<if test="matkl != null and matkl != ''">and MATKL = #{matkl}</if>
<if test="matnr != null and matnr != ''">and MATNR like concat ( '%', #{matnr}, '%' )</if>
<if test="meins != null and meins != ''">and MEINS = #{meins}</if>
<if test="clabs != null ">and CLABS = #{clabs}</if>
<if test="cinsm != null ">and CINSM = #{cinsm}</if>
<if test="ceinm != null ">and CEINM = #{ceinm}</if>
<if test="cspem != null ">and CSPEM = #{cspem}</if>
<if test="pdaSearch == 1 ">and MATNR like '00000004%'</if>
</where>
ORDER BY MATNR
</select>
</mapper>