|
|
|
<?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.device.mapper.SparePartsLedgerMapper">
|
|
|
|
|
|
|
|
<resultMap type="SparePartsLedger" id="SparePartsLedgerResult">
|
|
|
|
<result property="storageId" column="storage_id" />
|
|
|
|
<result property="storageType" column="storage_type" />
|
|
|
|
<result property="materialCode" column="material_code" />
|
|
|
|
<result property="materialDesc" column="material_desc" />
|
|
|
|
<result property="amount" column="amount" />
|
|
|
|
<result property="storageAmount" column="storage_amount" />
|
|
|
|
<result property="storageType" column="storage_type" />
|
|
|
|
<result property="spareUseLife" column="spare_use_life" />
|
|
|
|
<result property="spareName" column="spare_name" />
|
|
|
|
<result property="spareMode" column="spare_mode" />
|
|
|
|
<result property="spareManufacturer" column="spare_manufacturer" />
|
|
|
|
<result property="spareSupplier" column="spare_supplier" />
|
|
|
|
<result property="spareReplacementCycle" column="spare_replacement_cycle" />
|
|
|
|
<result property="spareMeasurementUnit" column="spare_measurement_unit" />
|
|
|
|
<result property="spareConversionUnit" column="spare_conversion_unit" />
|
|
|
|
<result property="spareConversionRatio" column="spare_conversion_ratio" />
|
|
|
|
<result property="spareInventoryFloor" column="spare_inventory_floor" />
|
|
|
|
<result property="spareInventoryUpper" column="spare_inventory_upper" />
|
|
|
|
<result property="spareType" column="spare_type" />
|
|
|
|
<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="sapFactoryCode" column="sap_factory_code" />
|
|
|
|
<result property="delFlag" column="del_flag" />
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectSparePartsLedgerVo">
|
|
|
|
select
|
|
|
|
storage_id,
|
|
|
|
storage_type,
|
|
|
|
material_code,
|
|
|
|
material_desc,
|
|
|
|
amount,
|
|
|
|
storage_amount,
|
|
|
|
sap_factory_code,
|
|
|
|
wl_name,
|
|
|
|
del_flag,
|
|
|
|
spare_use_life,
|
|
|
|
spare_name,
|
|
|
|
spare_mode,
|
|
|
|
spare_manufacturer,
|
|
|
|
spare_supplier,
|
|
|
|
spare_replacement_cycle,
|
|
|
|
spare_measurement_unit,
|
|
|
|
spare_conversion_unit,
|
|
|
|
spare_conversion_ratio,
|
|
|
|
spare_inventory_floor,
|
|
|
|
spare_inventory_upper,
|
|
|
|
spare_type,
|
|
|
|
create_by,
|
|
|
|
gmt_create,
|
|
|
|
last_modified_by,
|
|
|
|
gmt_modified,
|
|
|
|
active_flag,
|
|
|
|
factory_code
|
|
|
|
from wms_ods_mate_storage_news
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectSparePartsLedgerList" parameterType="SparePartsLedger" resultMap="SparePartsLedgerResult">
|
|
|
|
<include refid="selectSparePartsLedgerVo"/>
|
|
|
|
<where>
|
|
|
|
<if test="storageId != null and storageId != ''"> and storage_id = #{storageId}</if>
|
|
|
|
<if test="whCode != null and whCode != ''"> and wh_code = #{whCode}</if>
|
|
|
|
<if test="regionCode != null and regionCode != ''"> and region_code = #{regionCode}</if>
|
|
|
|
<if test="waCode != null and waCode != ''"> and wa_code = #{waCode}</if>
|
|
|
|
<if test="storageType != null and storageType != ''"> and storage_type = #{storageType}</if>
|
|
|
|
<if test="wlCode != null and wlCode != ''"> and wl_code = #{wlCode}</if>
|
|
|
|
<if test="materialCode != null and materialCode != ''"> and material_code like concat('%', #{materialCode}, '%')</if>
|
|
|
|
<if test="materialDesc != null and materialDesc != ''"> and material_desc like concat('%', #{materialDesc}, '%')</if>
|
|
|
|
<if test="amount != null "> and amount = #{amount}</if>
|
|
|
|
<if test="storageAmount != null "> and storage_amount = #{storageAmount}</if>
|
|
|
|
<if test="occupyAmount != null "> and occupy_amount = #{occupyAmount}</if>
|
|
|
|
<if test="lpn != null and lpn != ''"> and lpn = #{lpn}</if>
|
|
|
|
<if test="productBatch != null and productBatch != ''"> and product_batch = #{productBatch}</if>
|
|
|
|
<if test="receiveDate != null "> and receive_date = #{receiveDate}</if>
|
|
|
|
<if test="productDate != null "> and product_date = #{productDate}</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>
|
|
|
|
<if test="wlName != null and wlName != ''"> and wl_name like concat('%', #{wlName}, '%')</if>
|
|
|
|
<if test="spareUseLife != null and spareUseLife != ''"> and spare_use_life = #{spareUseLife}</if>
|
|
|
|
<if test="spareName != null and spareName != ''"> and spare_name like concat('%', #{spareName}, '%')</if>
|
|
|
|
<if test="spareMode != null and spareMode != ''"> and spare_mode like concat('%', #{spareMode}, '%')</if>
|
|
|
|
<if test="spareManufacturer != null and spareManufacturer != ''"> and spare_manufacturer = #{spareManufacturer}</if>
|
|
|
|
<if test="spareSupplier != null and spareSupplier != ''"> and spare_supplier = #{spareSupplier}</if>
|
|
|
|
<if test="spareReplacementCycle != null and spareReplacementCycle != ''"> and spare_replacement_cycle = #{spareReplacementCycle}</if>
|
|
|
|
<if test="spareMeasurementUnit != null and spareMeasurementUnit != ''"> and spare_measurement_unit = #{spareMeasurementUnit}</if>
|
|
|
|
<if test="spareConversionUnit != null and spareConversionUnit != ''"> and spare_conversion_unit = #{spareConversionUnit}</if>
|
|
|
|
<if test="spareConversionRatio != null and spareConversionRatio != ''"> and spare_conversion_ratio = #{spareConversionRatio}</if>
|
|
|
|
<if test="spareInventoryFloor != null and spareInventoryFloor != ''"> and spare_inventory_floor = #{spareInventoryFloor}</if>
|
|
|
|
<if test="spareInventoryUpper != null and spareInventoryUpper != ''"> and spare_inventory_upper = #{spareInventoryUpper}</if>
|
|
|
|
<if test="spareType != null and spareType != ''"> and spare_type = #{spareType}</if>
|
|
|
|
and del_flag = '0'
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectSparePartsLedgerByStorageId" parameterType="String" resultMap="SparePartsLedgerResult">
|
|
|
|
<include refid="selectSparePartsLedgerVo"/>
|
|
|
|
where storage_id = #{storageId}
|
|
|
|
and del_flag = '0'
|
|
|
|
and storage_tpye = 'SP'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertSparePartsLedger" parameterType="SparePartsLedger">
|
|
|
|
insert into wms_ods_mate_storage_news
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="storageId != null and storageId != ''">storage_id,</if>
|
|
|
|
<if test="whCode != null">wh_code,</if>
|
|
|
|
<if test="regionCode != null">region_code,</if>
|
|
|
|
<if test="waCode != null">wa_code,</if>
|
|
|
|
<if test="storageType != null">storage_type,</if>
|
|
|
|
<if test="wlCode != null">wl_code,</if>
|
|
|
|
<if test="materialCode != null">material_code,</if>
|
|
|
|
<if test="materialDesc != null">material_desc,</if>
|
|
|
|
<if test="amount != null">amount,</if>
|
|
|
|
<if test="storageAmount != null">storage_amount,</if>
|
|
|
|
<if test="occupyAmount != null">occupy_amount,</if>
|
|
|
|
<if test="lpn != null">lpn,</if>
|
|
|
|
<if test="productBatch != null">product_batch,</if>
|
|
|
|
<if test="receiveDate != null">receive_date,</if>
|
|
|
|
<if test="productDate != null">product_date,</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>
|
|
|
|
<if test="wlName != null">wl_name,</if>
|
|
|
|
<if test="delFlag != null">del_flag,</if>
|
|
|
|
<if test="spareUseLife != null">spare_use_life,</if>
|
|
|
|
<if test="spareName != null">spare_name,</if>
|
|
|
|
<if test="spareMode != null">spare_mode,</if>
|
|
|
|
<if test="spareManufacturer != null">spare_manufacturer,</if>
|
|
|
|
<if test="spareSupplier != null">spare_supplier,</if>
|
|
|
|
<if test="spareReplacementCycle != null">spare_replacement_cycle,</if>
|
|
|
|
<if test="spareMeasurementUnit != null">spare_measurement_unit,</if>
|
|
|
|
<if test="spareConversionUnit != null">spare_conversion_unit,</if>
|
|
|
|
<if test="spareConversionRatio != null">spare_conversion_ratio,</if>
|
|
|
|
<if test="spareInventoryFloor != null">spare_inventory_floor,</if>
|
|
|
|
<if test="spareInventoryUpper != null">spare_inventory_upper,</if>
|
|
|
|
<if test="spareType != null">spare_type,</if>
|
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="storageId != null and storageId != ''">#{storageId},</if>
|
|
|
|
<if test="whCode != null">#{whCode},</if>
|
|
|
|
<if test="regionCode != null">#{regionCode},</if>
|
|
|
|
<if test="waCode != null">#{waCode},</if>
|
|
|
|
<if test="storageType != null">#{storageType},</if>
|
|
|
|
<if test="wlCode != null">#{wlCode},</if>
|
|
|
|
<if test="materialCode != null">#{materialCode},</if>
|
|
|
|
<if test="materialDesc != null">#{materialDesc},</if>
|
|
|
|
<if test="amount != null">#{amount},</if>
|
|
|
|
<if test="storageAmount != null">#{storageAmount},</if>
|
|
|
|
<if test="occupyAmount != null">#{occupyAmount},</if>
|
|
|
|
<if test="lpn != null">#{lpn},</if>
|
|
|
|
<if test="productBatch != null">#{productBatch},</if>
|
|
|
|
<if test="receiveDate != null">#{receiveDate},</if>
|
|
|
|
<if test="productDate != null">#{productDate},</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>
|
|
|
|
<if test="wlName != null">#{wlName},</if>
|
|
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
|
|
<if test="spareUseLife != null">#{spareUseLife},</if>
|
|
|
|
<if test="spareName != null">#{spareName},</if>
|
|
|
|
<if test="spareMode != null">#{spareMode},</if>
|
|
|
|
<if test="spareManufacturer != null">#{spareManufacturer},</if>
|
|
|
|
<if test="spareSupplier != null">#{spareSupplier},</if>
|
|
|
|
<if test="spareReplacementCycle != null">#{spareReplacementCycle},</if>
|
|
|
|
<if test="spareMeasurementUnit != null">#{spareMeasurementUnit},</if>
|
|
|
|
<if test="spareConversionUnit != null">#{spareConversionUnit},</if>
|
|
|
|
<if test="spareConversionRatio != null">#{spareConversionRatio},</if>
|
|
|
|
<if test="spareInventoryFloor != null">#{spareInventoryFloor},</if>
|
|
|
|
<if test="spareInventoryUpper != null">#{spareInventoryUpper},</if>
|
|
|
|
<if test="spareType != null">#{spareType},</if>
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateSparePartsLedger" parameterType="SparePartsLedger">
|
|
|
|
update wms_ods_mate_storage_news
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="whCode != null">wh_code = #{whCode},</if>
|
|
|
|
<if test="regionCode != null">region_code = #{regionCode},</if>
|
|
|
|
<if test="waCode != null">wa_code = #{waCode},</if>
|
|
|
|
<if test="storageType != null">storage_type = #{storageType},</if>
|
|
|
|
<if test="wlCode != null">wl_code = #{wlCode},</if>
|
|
|
|
<if test="materialCode != null">material_code = #{materialCode},</if>
|
|
|
|
<if test="materialDesc != null">material_desc = #{materialDesc},</if>
|
|
|
|
<if test="amount != null">amount = #{amount},</if>
|
|
|
|
<if test="storageAmount != null">storage_amount = #{storageAmount},</if>
|
|
|
|
<if test="occupyAmount != null">occupy_amount = #{occupyAmount},</if>
|
|
|
|
<if test="lpn != null">lpn = #{lpn},</if>
|
|
|
|
<if test="productBatch != null">product_batch = #{productBatch},</if>
|
|
|
|
<if test="receiveDate != null">receive_date = #{receiveDate},</if>
|
|
|
|
<if test="productDate != null">product_date = #{productDate},</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>
|
|
|
|
<if test="wlName != null">wl_name = #{wlName},</if>
|
|
|
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
|
|
<if test="spareUseLife != null">spare_use_life = #{spareUseLife},</if>
|
|
|
|
<if test="spareName != null">spare_name = #{spareName},</if>
|
|
|
|
<if test="spareMode != null">spare_mode = #{spareMode},</if>
|
|
|
|
<if test="spareManufacturer != null">spare_manufacturer = #{spareManufacturer},</if>
|
|
|
|
<if test="spareSupplier != null">spare_supplier = #{spareSupplier},</if>
|
|
|
|
<if test="spareReplacementCycle != null">spare_replacement_cycle = #{spareReplacementCycle},</if>
|
|
|
|
<if test="spareMeasurementUnit != null">spare_measurement_unit = #{spareMeasurementUnit},</if>
|
|
|
|
<if test="spareConversionUnit != null">spare_conversion_unit = #{spareConversionUnit},</if>
|
|
|
|
<if test="spareConversionRatio != null">spare_conversion_ratio = #{spareConversionRatio},</if>
|
|
|
|
<if test="spareInventoryFloor != null">spare_inventory_floor = #{spareInventoryFloor},</if>
|
|
|
|
<if test="spareInventoryUpper != null">spare_inventory_upper = #{spareInventoryUpper},</if>
|
|
|
|
<if test="spareType != null">spare_type = #{spareType},</if>
|
|
|
|
</trim>
|
|
|
|
where storage_id = #{storageId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<delete id="deleteSparePartsLedgerByStorageId" parameterType="String">
|
|
|
|
delete from wms_ods_mate_storage_news where storage_id = #{storageId}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteSparePartsLedgerByStorageIds" parameterType="String">
|
|
|
|
delete from wms_ods_mate_storage_news where storage_id in
|
|
|
|
<foreach item="storageId" collection="array" open="(" separator="," close=")">
|
|
|
|
#{storageId}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
</mapper>
|