SELECT BK.BASE_KNIFE_ID, BK.MBB_BD_MRL_ID, RFID, MI.ITEM_CODE AS KNIFE_CODE, MI.ITEM_NAME AS KNIFE_NAME, MI.UNIT_NAME AS KNIFE_UNIT,
MIT.ITEM_TYPE_NAME AS KNIFE_TYPE, BK.SAFE_STOCK, BK.STANDARD_QUANTITY, BK.AREA_CODE, BK.KNIFE_LIFE, BK.KNIFE_FINE_STATE,
BK.IS_LOCKED, BK.LOCKED_START_TIME, BK.LOCKED_END_TIME, BK.PLAN_SHEET, BK.RESET_COUNT, BK.ITEM_OR_PRODUCT,
BK.REMARK, BK.ATTR1, BK.ATTR2, BK.ATTR3, BK.ATTR4, BK.CREATE_BY, BK.CREATE_TIME, BK.UPDATE_BY, BK.UPDATE_TIME from BASE_KNIFE BK
LEFT JOIN MD_ITEM MI on BK.MBB_BD_MRL_ID = MI.ITEM_ID
LEFT JOIN MD_ITEM_TYPE MIT ON MI.ITEM_TYPE_ID = MIT.ITEM_TYPE_ID
insert into BASE_KNIFE
MBB_BD_MRL_ID,
RFID,
KNIFE_CODE,
KNIFE_NAME,
KNIFE_UNIT,
KNIFE_TYPE,
SAFE_STOCK,
STANDARD_QUANTITY,
AREA_CODE,
KNIFE_LIFE,
KNIFE_FINE_STATE,
is_locked,
locked_start_time,
locked_end_time,
plan_sheet,
reset_count,
item_or_product,
REMARK,
ATTR1,
ATTR2,
ATTR3,
ATTR4,
CREATE_BY,
CREATE_TIME,
UPDATE_BY,
UPDATE_TIME,
#{mbbBdMrlId},
#{rfid},
#{knifeCode},
#{knifeName},
#{knifeUnit},
#{knifeType},
#{safeStock},
#{standardQuantity},
#{areaCode},
#{knifeLife},
#{knifeFineState},
#{isLocked},
#{lockedStartTime},
#{lockedEndTime},
#{planSheet},
#{resetCount},
#{itemOrProduct},
#{remark},
#{attr1},
#{attr2},
#{attr3},
#{attr4},
#{createBy},
#{createTime},
#{updateBy},
#{updateTime},
update BASE_KNIFE
MBB_BD_MRL_ID = #{mbbBdMrlId},
RFID = #{rfid},
KNIFE_CODE = #{knifeCode},
KNIFE_NAME = #{knifeName},
KNIFE_UNIT = #{knifeUnit},
KNIFE_TYPE = #{knifeType},
SAFE_STOCK = #{safeStock},
STANDARD_QUANTITY = #{standardQuantity},
AREA_CODE = #{areaCode},
KNIFE_LIFE = #{knifeLife},
KNIFE_FINE_STATE = #{knifeFineState},
is_locked = #{isLocked},
locked_start_time = #{lockedStartTime},
locked_end_time = #{lockedEndTime},
plan_sheet = #{planSheet},
reset_count = #{resetCount},
item_or_product = #{itemOrProduct},
REMARK = #{remark},
ATTR1 = #{attr1},
ATTR2 = #{attr2},
ATTR3 = #{attr3},
ATTR4 = #{attr4},
CREATE_BY = #{createBy},
CREATE_TIME = #{createTime},
UPDATE_BY = #{updateBy},
UPDATE_TIME = #{updateTime},
where BASE_KNIFE_ID = #{baseKnifeId}
update BASE_KNIFE set reset_count = reset_count - 1, knife_life = 100 where BASE_KNIFE_ID = #{baseKnifeId}
delete from BASE_KNIFE where BASE_KNIFE_ID = #{baseKnifeId}
delete from BASE_KNIFE where BASE_KNIFE_ID in
#{baseKnifeId}
delete from MD_ITEM where ITEM_ID in
#{itemId}
insert into MD_ITEM( ITEM_ID, ITEM_CODE, ITEM_NAME, SPECIFICATION, UNIT_OF_MEASURE, ITEM_OR_PRODUCT, ITEM_TYPE_ID, ITEM_TYPE_CODE, ITEM_TYPE_NAME, ENABLE_FLAG, SAFE_STOCK_FLAG, MIN_STOCK, MAX_STOCK, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, HIGH_VALUE, UNIT_NAME, MODEL_NUMBER, STANDARD_NUMBER) values
( #{item.itemId}, #{item.itemCode}, #{item.itemName}, #{item.specification}, #{item.unitOfMeasure}, #{item.itemOrProduct}, #{item.itemTypeId}, #{item.itemTypeCode}, #{item.itemTypeName}, #{item.enableFlag}, #{item.safeStockFlag}, #{item.minStock}, #{item.maxStock}, #{item.remark}, #{item.attr1}, #{item.attr2}, #{item.attr3}, #{item.attr4}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.highValue}, #{item.unitName}, #{item.modelNumber}, #{item.standardNumber})