update plm_properties_item_available set AvailableValue = #{availableValue} where itemNo = #{itemNo} and ItemType = #{itemType} and ValueNo = #{valueNo} and site = #{site}
update plm_properties_item_available
set AvailableValue = #{availableValue}
where itemNo = #{itemNo}
and ItemType = #{itemType}
and ValueNo = #{valueNo}
and site = #{site}
</update>
<deleteid="deleteItemAvailable">
delete from plm_properties_item_available where itemNo = #{itemNo} and ItemType = #{itemType} and ValueNo = #{valueNo} and site = #{site}
LEFT JOIN plm_properties_model_detail b on b.function_type = #{functionType} and b.code_no = #{codeNo} and b.properties_item_no = a.ItemNo and a.site = b.site
LEFT JOIN plm_properties_model_detail b
on b.function_type = #{functionType} and b.code_no = #{codeNo} and
b.properties_item_no = a.ItemNo and a.site = b.site
delete from PartSubPropertiesValueHeader where PartNo=#{testPartNo} and site=#{site} and RecordType ='IP'
delete
from PartSubPropertiesValueHeader
where PartNo = #{testPartNo}
and site = #{site}
and RecordType = 'IP'
</delete>
<deleteid="deletePartSubPropertiesValue">
delete from PartSubPropertiesValue where PartNo=#{testPartNo} and site=#{site} and RecordType ='IP'
delete
from PartSubPropertiesValue
where PartNo = #{testPartNo}
and site = #{site}
and RecordType = 'IP'
</delete>
<insertid="savePartSubPropertiesValueHeader">
insert into PartSubPropertiesValueHeader (PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, RecordType)
select #{testPartNo},#{site},#{codeNo},1,Code_Desc,'IP' from plm_properties_model_header where Code_No=#{codeNo} and site=#{site} and function_type='IP'
select #{testPartNo},#{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 ,'IP'
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
where a.Code_No=#{codeNo} and a.site=#{site} AND B.SITE IS NOT NULL AND A.function_type='IP'
select #{testPartNo},
#{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,
'IP'
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
select ItemNo,ValueNo,AvailableValue from plm_properties_item_available where itemNo=#{propertiesItemNo} and site=#{site} and ItemType='IP'
select ItemNo, ValueNo, AvailableValue
from plm_properties_item_available
where itemNo = #{propertiesItemNo}
and site = #{site}
and ItemType = 'IP'
</select>
<updateid="updateToolItem">
update PartSubPropertiesValue set TextValue=#{textValue} , NumValue=#{numValue,jdbcType=DOUBLE} where PropertiesItemNo=#{propertiesItemNo} and site=#{site} and PartNo=#{partNo} and RecordType='IP'
update PartSubPropertiesValue
set TextValue=#{textValue},
NumValue=#{numValue,jdbcType=DOUBLE}
where PropertiesItemNo = #{propertiesItemNo}
and site = #{site}
and PartNo = #{partNo}
and RecordType = 'IP'
</update>
<insertid="refreshItemModal">
insert into PartSubPropertiesValue(PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc,
select #{partNo},#{site},a.CodeNo,1,a.SubCodeDesc,b.seq_No,b.properties_item_no,case when e.ValueType_DB='T' then e.DefaultValue
else null end ,case when e.ValueType_DB='N' and e.DefaultValue!='' then e.DefaultValue else null end ,'IP'
from PartSubPropertiesValueHeader a left join plm_properties_model_detail b on a.CodeNo=b.Code_No and a.site=b.site and a.RecordType=b.function_type
left join PartSubPropertiesValue c on c.Site=#{site} and c.PartNo=#{partNo} and c.RecordType='IP' and b.seq_no=c.ItemNo and a.RecordType=b.function_type
left join plm_properties_item e on b.properties_item_no=e.ItemNo and a.site=e.site and a.RecordType=e.ItemType
where c.ItemNo is null and a.RecordType='IP' and a.PartNo=#{partNo} and a.site= #{site}
select #{partNo},
#{site},
a.CodeNo,
1,
a.SubCodeDesc,
b.seq_No,
b.properties_item_no,
case
when e.ValueType_DB = 'T' then e.DefaultValue
else null end,
case when e.ValueType_DB = 'N' and e.DefaultValue != '' then e.DefaultValue else null end,
'IP'
from PartSubPropertiesValueHeader a
left join plm_properties_model_detail b
on a.CodeNo = b.Code_No and a.site = b.site and a.RecordType = b.function_type
left join PartSubPropertiesValue c
on c.Site = #{site} and c.PartNo = #{partNo} and c.RecordType = 'IP' and
b.seq_no = c.ItemNo and a.RecordType = b.function_type
left join plm_properties_item e
on b.properties_item_no = e.ItemNo and a.site = e.site and a.RecordType = e.ItemType
LEFT JOIN plm_bm_model_detail b on b.function_type = #{functionType} and b.code_no = #{codeNo} and b.properties_item_no = a.ItemNo and a.site = b.site and b.bu_no=#{buNo}
LEFT JOIN plm_bm_model_detail b on b.function_type = #{functionType} and b.code_no = #{codeNo} and
b.properties_item_no = a.ItemNo and a.site = b.site and
select top 1 site,function_type,code_no,properties_item_no,seq_no,created_date,created_by,update_date,update_by,delflag,version,
order_id from plm_properties_model_detail where #{orderId} > order_id and site = #{site} and code_no = #{codeNo} and function_type = #{functionType} order by order_id desc
select top 1 site,function_type,code_no,properties_item_no,seq_no,created_date,created_by,update_date,update_by,delflag,version,
order_id from plm_properties_model_detail where order_id > #{orderId} and site = #{site} and code_no = #{codeNo} and function_type = #{functionType} order by order_id
select top 1 site,
function_type,
code_no,
properties_item_no,
seq_no,
created_date,
created_by,
update_date,
update_by,
delflag,
version,
order_id
from plm_properties_model_detail
where order_id > #{orderId}
and site = #{site}
and code_no = #{codeNo}
and function_type = #{functionType}
order by order_id
</select>
<updateid="updatePlmPropertiesModelDetailOrder">
update plm_properties_model_detail set order_id=#{orderId} where site = #{site} and code_no = #{codeNo} and function_type = #{functionType} and seq_no=#{seqNo}
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} ,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
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}
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},
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
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}
</insert>
<insertid="saveSubPropertiesValueHeader">
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,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}
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}
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}