select #{partNo},#{site},#{codeNo},1,a.Code_Desc,b.seq_No,b.properties_item_no,case when c.ValueType_DB='T' then c.DefaultValue
select #{partNo},#{site},#{codeNo},1,a.Code_Desc,b.seq_No,b.properties_item_no,case when c.ValueType_DB='T' then c.DefaultValue
else null end ,case when c.ValueType_DB='N' and c.DefaultValue!='' then c.DefaultValue else null end ,#{recordType} ,b.order_id
else null end ,case when c.ValueType_DB='N' and c.DefaultValue!='' then c.DefaultValue else null end ,#{recordType} ,isnull(b.order_id,999)
from plm_properties_model_header a left join plm_properties_model_detail b on a.Code_No=b.Code_No and a.site=b.site and a.function_type=b.function_type
from plm_properties_model_header a left join plm_properties_model_detail b on a.Code_No=b.Code_No and a.site=b.site and a.function_type=b.function_type
left join plm_properties_item c on b.properties_item_no=c.ItemNo and b.site=c.site and a.function_type=c.itemType
left join plm_properties_item c on b.properties_item_no=c.ItemNo and b.site=c.site and a.function_type=c.itemType
where a.Code_No=#{codeNo} and a.site=#{site} AND B.SITE IS NOT NULL AND A.function_type=#{recordType}
where a.Code_No=#{codeNo} and a.site=#{site} AND B.SITE IS NOT NULL AND A.function_type=#{recordType}
@ -643,6 +643,27 @@ order_id from plm_properties_model_detail where order_id > #{orderId} and site =
<insertid="saveSubPropertiesValueHeader">
<insertid="saveSubPropertiesValueHeader">
insert into PartSubPropertiesValueHeader (PartNo,Site,CodeNo,SubCodeSeqNo,SubCodeDesc,RecordType)
insert into PartSubPropertiesValueHeader (PartNo,Site,CodeNo,SubCodeSeqNo,SubCodeDesc,RecordType)
select #{partNo},#{site},#{codeNo},1,Code_Desc,#{recordType} from plm_properties_model_header where Code_No=#{codeNo} and site=#{site} and function_type=#{recordType}
select #{partNo},#{site},#{codeNo},1,Code_Desc,#{recordType} from plm_properties_model_header
where Code_No=#{codeNo} and site=#{site} and function_type=#{recordType}
</insert>
</insert>
<insertid="saveSubPropertiesValueForAlone">
insert into PartSubPropertiesValue (PartNo,Site,CodeNo,SubCodeSeqNo,SubCodeDesc
select #{partNo},#{site},#{codeNo},1,d.SubCodeDesc,#{itemNo,jdbcType=DOUBLE},#{propertiesItemNo},case when c.ValueType_DB='T' then c.DefaultValue
else null end ,case when c.ValueType_DB='N' and c.DefaultValue!='' then c.DefaultValue else null end ,#{recordType} ,#{itemNo,jdbcType=DOUBLE}
from plm_properties_item c
left join PartSubPropertiesValueHeader d on d.PartNo=#{partNo} and d.site=#{site} and CodeNo=#{codeNo} and RecordType=#{recordType}
where c.ItemNo=#{propertiesItemNo} and c.site=#{site} and c.itemType=#{recordType}
</insert>
<deleteid="deleteSubPropertiesValueForAlone">
delete from PartSubPropertiesValue where Site=#{site} and PartNo=#{partNo} and CodeNo=#{codeNo} and PropertiesItemNo=#{propertiesItemNo} and RecordType=#{recordType}