INSERT INTO ma_apply (create_user, order_number)
VALUES (#{createUser}, #{orderNumber})
INSERT INTO ma_apply_details (cs_id, dev_id)
VALUES (#{orderId}, #{maId})
INSERT INTO ma_dev_info (
device_name,
device_count,
item_type_model,
manage_type,
code,
ma_status,
province_id,
on_company,
identify_code,
type_id,
supplier_id,
production_date,
max_working_hours,
expiration_time,
buy_price,
purchase_date,
unit,
is_active,
change_status,
up_down_status
)
VALUES (
#{name},
#{count},
#{specificationModel},
#{manageType},
#{code},
'0',
'340000000000',
#{propertyUnitId},
#{originalCode},
#{typeId},
#{manufacturerId},
#{productionDate},
#{maxServiceLifeYears},
#{expirationTime},
#{originalValue},
#{purchaseDate},
#{unit},
'1',
'0',
'0'
)
INSERT INTO ma_dev_file (ma_id,
file_type,
file_name,
file_url,
creator,
create_time,
is_active)
VALUES (#{maId},
#{fileType},
#{fileName},
#{fileUrl},
#{creator},
now(),
'1')
INSERT INTO ma_dev_info (
device_name,
device_count,
item_type_model,
manage_type,
code,
ma_status,
province_id,
on_company,
identify_code,
type_id,
supplier_id,
production_date,
max_working_hours,
expiration_time,
buy_price,
purchase_date,
unit,
is_active,
change_status,
up_down_status
)
VALUES (
#{name},
#{count},
#{specificationModel},
#{manageType},
#{code},
'0',
'340000000000',
#{propertyUnitId},
#{originalCode},
#{typeId},
#{manufacturerId},
#{productionDate},
#{maxServiceLifeYears},
#{expirationTime},
#{originalValue},
#{purchaseDate},
#{unit},
'1',
'0',
'0'
)
UPDATE ma_apply
SET status = #{status}
WHERE id = #{id}
UPDATE ma_dev_info
SET entry_status = 0
WHERE ma_id IN (select dev_id
from ma_apply_details
where cs_id = #{id})
update ma_apply
set is_active = 0
where id = #{id}
DELETE
FROM ma_dev_file
WHERE ma_id = #{maId}
UPDATE ma_dev_info SET entry_status = #{data.value} WHERE ma_id = #{data.key}
UPDATE ma_dev_info SET change_status ='1',ma_status = '1' WHERE ma_id = #{data.key}
UPDATE ma_dev_info
SET
device_name = #{name},
device_count = #{count},
item_type_model = #{specificationModel},
manage_type = #{manageType},
identify_code = #{originalCode},
type_id = #{typeId},
supplier_id = #{manufacturerId},
production_date = #{productionDate},
max_working_hours = #{maxServiceLifeYears},
expiration_time = #{expirationTime},
buy_price = #{originalValue},
purchase_date = #{purchaseDate},
unit = #{unit}
WHERE
ma_id = #{maId}