From 087054e3bd23650ee2f2fedfcb68dff87392dbd6 Mon Sep 17 00:00:00 2001 From: qiezi <15576055375@163.com> Date: Fri, 11 Oct 2024 16:37:15 +0800 Subject: [PATCH] 2024-10-11 --- .../modules/base/dao/PropertiesMapper.java | 3 + .../impl/ProofingInformationServiceImpl.java | 9 + .../mapper/base/PropertiesMapper.xml | 1340 ++++++++++------- 3 files changed, 822 insertions(+), 530 deletions(-) diff --git a/src/main/java/com/spring/modules/base/dao/PropertiesMapper.java b/src/main/java/com/spring/modules/base/dao/PropertiesMapper.java index 56e25dab..5b1c3639 100644 --- a/src/main/java/com/spring/modules/base/dao/PropertiesMapper.java +++ b/src/main/java/com/spring/modules/base/dao/PropertiesMapper.java @@ -411,6 +411,9 @@ public interface PropertiesMapper extends BaseMapper { void saveSubPropertiesValue(PartSubPropertiesValueData inData); void saveSubPropertiesValueHeader(PartSubPropertiesValueData inData); + void removeSubPropertiesValue(PartSubPropertiesValueData inData); + void removeSubPropertiesValueHeader(PartSubPropertiesValueData inData); + List getItemListsForPartAndCode(PlmPropertiesModelHeaderData inData); List searchPropertiesUnChoose(@Param("site")String site, diff --git a/src/main/java/com/spring/modules/proofing/service/impl/ProofingInformationServiceImpl.java b/src/main/java/com/spring/modules/proofing/service/impl/ProofingInformationServiceImpl.java index 377979d0..9df105b5 100644 --- a/src/main/java/com/spring/modules/proofing/service/impl/ProofingInformationServiceImpl.java +++ b/src/main/java/com/spring/modules/proofing/service/impl/ProofingInformationServiceImpl.java @@ -212,6 +212,15 @@ public class ProofingInformationServiceImpl extends ServiceImpl + + - - - - - - - Insert into plm_properties_item (site,ItemNo,ItemDesc,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,CreatedDate - ,CreatedBy,MaxValue,MinValue,ItemType) values - (#{site},#{itemNo},#{itemDesc},#{defaultValue},#{valueType},#{valueTypeDb},#{valueChooseFlag},GetDate(), - #{createdBy},#{maxValue,jdbcType=DOUBLE},#{minValue,jdbcType=DOUBLE},#{itemType}) - - - - update plm_properties_item - set ItemDesc=#{itemDesc},DefaultValue=#{defaultValue},ValueType=#{valueType},ValueType_DB=#{valueTypeDb}, - ValueChooseFlag=#{valueChooseFlag},update_date=GetDate() - ,update_by=#{updateBy},MaxValue=#{maxValue,jdbcType=DOUBLE},MinValue=#{minValue,jdbcType=DOUBLE},ItemType=#{itemType} - WHERE ItemNo = #{itemNo} and ItemType = #{itemType} and site = #{site} - - - - Delete FROM plm_properties_item WHERE ItemNo = #{itemNo} and ItemType = #{itemType} and site = #{site} - - + SELECT ItemNo, ItemDesc + FROM plm_properties_item + WHERE ItemNo = #{itemNo} + and ItemType = #{itemType} + and site = #{site} + + + + Insert into plm_properties_item ( site, ItemNo, ItemDesc, DefaultValue, ValueType, ValueType_DB, ValueChooseFlag + , CreatedDate + , CreatedBy, MaxValue, MinValue, ItemType) + values (#{site}, #{itemNo}, #{itemDesc}, #{defaultValue}, #{valueType}, #{valueTypeDb}, #{valueChooseFlag}, + GetDate(), + #{createdBy}, #{maxValue,jdbcType=DOUBLE}, #{minValue,jdbcType=DOUBLE}, #{itemType}) + + + + update plm_properties_item + set ItemDesc=#{itemDesc}, + DefaultValue=#{defaultValue}, + ValueType=#{valueType}, + ValueType_DB=#{valueTypeDb}, + ValueChooseFlag=#{valueChooseFlag}, + update_date=GetDate() + , + update_by=#{updateBy}, + MaxValue=#{maxValue,jdbcType=DOUBLE}, + MinValue=#{minValue,jdbcType=DOUBLE}, + ItemType=#{itemType} + WHERE ItemNo = #{itemNo} + and ItemType = #{itemType} + and site = #{site} + + + + Delete + FROM plm_properties_item + WHERE ItemNo = #{itemNo} + and ItemType = #{itemType} + and site = #{site} + + - - - - - - insert into plm_properties_item_available (ItemNo,ValueNo,AvailableValue,CreatedDate,CreatedBy,ItemType,site) - values(#{itemNo},#{valueNo},#{availableValue},GetDate(),#{createdBy},#{itemType},#{site}) - - - - update plm_properties_item_available set AvailableValue = #{availableValue} where itemNo = #{itemNo} and ItemType = #{itemType} and ValueNo = #{valueNo} and site = #{site} - - - - delete from plm_properties_item_available where itemNo = #{itemNo} and ItemType = #{itemType} and ValueNo = #{valueNo} and site = #{site} - - - - - - insert into plm_properties_model_header - (function_type, code_no, code_desc, active, created_date, created_by, delflag, version, update_date, update_by,site,function_group) - values(#{functionType}, #{codeNo}, #{codeDesc}, #{active}, GetDate(), #{userId}, 'N', 0, getDate(), #{updateBy},#{site},#{functionGroup}) - - - - update plm_properties_model_header - set version = version + 1, - code_desc = #{codeDesc}, - function_group = #{functionGroup}, - active = #{active}, - update_by = #{updateBy}, - update_date = GetDate() - where function_type = #{functionType} - and code_no = #{codeNo} - and site = #{site} - - - - - - delete from plm_properties_model_header where function_type = #{functionType} and code_no = #{codeNo} and site = #{site} - - - - - - - - - + + + + + + insert into plm_properties_item_available (ItemNo, ValueNo, AvailableValue, CreatedDate, CreatedBy, ItemType, + site) + values (#{itemNo}, #{valueNo}, #{availableValue}, GetDate(), #{createdBy}, #{itemType}, #{site}) + + + + update plm_properties_item_available + set AvailableValue = #{availableValue} + where itemNo = #{itemNo} + and ItemType = #{itemType} + and ValueNo = #{valueNo} + and site = #{site} + + + + delete + from plm_properties_item_available + where itemNo = #{itemNo} + and ItemType = #{itemType} + and ValueNo = #{valueNo} + and site = #{site} + + + + + + insert into plm_properties_model_header + (function_type, code_no, code_desc, active, created_date, created_by, delflag, version, update_date, update_by, + site, function_group) + values (#{functionType}, #{codeNo}, #{codeDesc}, #{active}, GetDate(), #{userId}, 'N', 0, getDate(), + #{updateBy}, #{site}, #{functionGroup}) + + + + update plm_properties_model_header + set version = version + 1, + code_desc = #{codeDesc}, + function_group = #{functionGroup}, + active = #{active}, + update_by = #{updateBy}, + update_date = GetDate() + where function_type = #{functionType} + and code_no = #{codeNo} + and site = #{site} + + + + + + delete + from plm_properties_model_header + where function_type = #{functionType} + and code_no = #{codeNo} + and site = #{site} + + + + + + + + + + where function_type = #{functionType} + and code_no = #{codeNo} + and site = #{site} + - - insert into plm_properties_model_detail - (function_type, code_no, properties_item_no, seq_no, created_date, created_by, delflag, version, site,order_id) - values (#{functionType}, #{codeNo}, #{itemNo}, #{seqNo}, GetDate(), #{userId}, 'N', 0, #{site},#{orderId}) - + + insert into plm_properties_model_detail + (function_type, code_no, properties_item_no, seq_no, created_date, created_by, delflag, version, site, order_id) + values (#{functionType}, #{codeNo}, #{itemNo}, #{seqNo}, GetDate(), #{userId}, 'N', 0, #{site}, #{orderId}) + - - delete from plm_properties_model_detail + + delete + from plm_properties_model_detail where function_type = #{functionType} - and code_no = #{codeNo} - and properties_item_no = #{itemNo} - and site = #{site} - - - + SELECT a.itemNo, + a.ItemDesc FROM plm_properties_item a - 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 a.ItemType = #{functionType} - and a.site = #{site} - AND b.code_no is null - + and a.site = #{site} + AND b.code_no is null + AND a.ItemNo LIKE '%' + #{itemNo} + '%' - + AND a.ItemDesc LIKE '%' + #{itemDesc} + '%' - + select a.PropertiesItemNo itemNo, + b.ItemDesc from PartSubPropertiesValue a - left join plm_properties_item b on a.PropertiesItemNo = b.ItemNo and a.RecordType = b.ItemType and a.site=b.site + left join plm_properties_item b + on a.PropertiesItemNo = b.ItemNo and a.RecordType = b.ItemType and a.site = b.site where a.code_no = #{codeNo} - and a.RecordType = #{functionType} - and a.site=#{site} - and a.partNo=#{partNo} + and a.RecordType = #{functionType} + and a.site = #{site} + and a.partNo = #{partNo} - + SELECT PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, RecordType + from PartSubPropertiesValueHeader + where PartNo = #{testPartNo} + and site = #{site} + and CodeNo = #{codeNo} + and RecordType = 'IP' - 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 from PartSubPropertiesValue where PartNo=#{testPartNo} and site=#{site} and RecordType ='IP' + + delete + from PartSubPropertiesValue + where PartNo = #{testPartNo} + and site = #{site} + and RecordType = 'IP' - 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' + 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' - - insert into PartSubPropertiesValue (PartNo,Site,CodeNo,SubCodeSeqNo,SubCodeDesc - ,ItemNo,PropertiesItemNo,TextValue,NumValue,RecordType) - 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' + + insert into PartSubPropertiesValue ( PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc + , ItemNo, PropertiesItemNo, TextValue, NumValue, RecordType) + 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 a.PartNo + , a.Site + , a.CodeNo + , a.SubCodeSeqNo + , a.SubCodeDesc + , a.ItemNo + , a.PropertiesItemNo + , a.TextValue + , a.NumValue + , a.RecordType + , b.ItemDesc ItemDesc + , b.ValueType + , b.ValueType_DB + , b.ValueChooseFlag + FROM PartSubPropertiesValue a + left join plm_properties_item b + on a.PropertiesItemNo = b.ItemNo and a.site = b.site and a.RecordType = b.ItemType + + AND a.site = #{site} + and RecordType = 'IP' + AND a.PartNo = #{partNo,jdbcType=VARCHAR} + - + select ValueType_DB + from plm_properties_item + 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' - - 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' - - insert into PartSubPropertiesValue(PartNo,Site,CodeNo,SubCodeSeqNo,SubCodeDesc, - ItemNo,PropertiesItemNo,TextValue,NumValue,RecordType) - 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} - + + insert into PartSubPropertiesValue(PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, + ItemNo, PropertiesItemNo, TextValue, NumValue, RecordType) + 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 site, + bu_no, + dbo.plm_get_bu_desc(site, bu_no) buDesc, + function_type, + code_no, + code_desc, + active, + created_date, + created_by, + update_date, + update_by, + delflag, + version, + edit_flag, + properties_code_no, + dbo.get_properties_codeDesc(site, function_type, properties_code_no) properties_code_desc FROM plm_bm_model_header site = #{query.site} - AND code_no like '%' + #{query.codeNo} +'%' + AND code_no like '%' + #{query.codeNo} + '%' - AND code_desc like '%' + #{query.codeDesc} +'%' + AND code_desc like '%' + #{query.codeDesc} + '%' AND active = #{query.active} - + AND bu_no = #{query.buNo} @@ -411,259 +538,412 @@ and edit_flag = #{query.editFlag} - AND bu_no in ( select bu_no from AccessBu where site=#{query.site} and username=#{query.username} ) + AND bu_no in (select bu_no from AccessBu where site = #{query.site} and username = #{query.username}) - order by bu_no,order_id - - - - - + + + + - - + + + where function_type = #{functionType} + and code_no = #{codeNo} + and site = #{site} + and bu_no = #{buNo} + - + SELECT isnull(max(order_id), 0) + 1 from plm_properties_model_detail - where function_type = #{functionType} and code_no = #{codeNo} and site = #{site} - - - - insert into plm_bm_model_detail - (function_type, code_no, properties_item_no, seq_no, created_date, created_by, delflag, version, site,bu_no,order_id) - values (#{functionType}, #{codeNo}, #{itemNo}, #{seqNo}, GetDate(), #{userId}, 'N', 0, #{site},#{buNo}, #{orderId}) - - - - - update PartSubPropertiesValue set TextValue=#{textValue} ,NumValue=#{numValue,jdbcType=DOUBLE} where - Site=#{site} and CodeNo=#{codeNo} and PartNo=#{partNo} and SubCodeSeqNo=#{subCodeSeqNo} and itemNo=#{itemNo} - - - - delete from plm_bm_model_detail where function_type = #{functionType} - and code_no = #{codeNo} - and properties_item_no = #{itemNo} - and site = #{site} and bu_no=#{buNo} - - - - - - - - update plm_properties_model_detail set order_id=#{orderId} where site = #{site} and code_no = #{codeNo} and function_type = #{functionType} and seq_no=#{seqNo} - - - + and code_no = #{codeNo} + and site = #{site} + + + + insert into plm_bm_model_detail + (function_type, code_no, properties_item_no, seq_no, created_date, created_by, delflag, version, site, bu_no, + order_id) + values (#{functionType}, #{codeNo}, #{itemNo}, #{seqNo}, GetDate(), #{userId}, 'N', 0, #{site}, #{buNo}, + #{orderId}) + + + + + update PartSubPropertiesValue + set TextValue=#{textValue}, + NumValue=#{numValue,jdbcType=DOUBLE} + where Site = #{site} + and CodeNo = #{codeNo} + and PartNo = #{partNo} + and SubCodeSeqNo = #{subCodeSeqNo} + and itemNo = #{itemNo} + + + + delete + from plm_bm_model_detail + where function_type = #{functionType} + and code_no = #{codeNo} + and properties_item_no = #{itemNo} + and site = #{site} + and bu_no = #{buNo} + + + + + + + + update plm_properties_model_detail + set order_id=#{orderId} + where site = #{site} + and code_no = #{codeNo} + and function_type = #{functionType} + and seq_no = #{seqNo} + + + - delete from WorkCenter_BMType where site=#{site} and workCenterNo=#{workCenterNo} + delete + from WorkCenter_BMType + where site = #{site} + and workCenterNo = #{workCenterNo} - - update WorkCenter_BMType set itemType=#{itemType} ,update_by=#{updateBy} ,update_date=GetDate() - where site=#{site} and workCenterNo=#{workCenterNo} + + update WorkCenter_BMType + set itemType=#{itemType}, + update_by=#{updateBy}, + update_date=GetDate() + where site = #{site} + and workCenterNo = #{workCenterNo} - insert into WorkCenter_BMType (site,workCenterNo,itemType,update_by,update_date) values - (#{site},#{workCenterNo},#{itemType},#{updateBy},GetDate()) + insert into WorkCenter_BMType (site, workCenterNo, itemType, update_by, update_date) + values (#{site}, #{workCenterNo}, #{itemType}, #{updateBy}, GetDate()) - + select bu_no, bu_desc + from BU + where site = #{site} + and active = 'Y' - + select a.bu_no, b.bu_desc + from properties_bu a + left join BU b on a.site = b.site and a.bu_no = b.bu_no + + + and a.function_type = #{functionType} + + + and a.code_no = #{codeNo} + + + and a.site = #{site} + + - + - + select function_type as functionType, function_type_desc as functionTypeDesc + from properties_type - + select function_group as functionGroup, function_group_desc as functionGroupDesc + from properties_relationship + where function_type = #{type} - - insert into PartSubPropertiesValue (PartNo,Site,CodeNo,SubCodeSeqNo,SubCodeDesc - ,ItemNo,PropertiesItemNo,TextValue,NumValue,RecordType,order_id) - 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 into PartSubPropertiesValue ( PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc + , ItemNo, PropertiesItemNo, TextValue, NumValue, RecordType, order_id) + 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 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} + 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} - - insert into PartSubPropertiesValue (PartNo,Site,CodeNo,SubCodeSeqNo,SubCodeDesc - ,ItemNo,PropertiesItemNo,TextValue,NumValue,RecordType,order_id) - 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} + + insert into PartSubPropertiesValue ( PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc + , ItemNo, PropertiesItemNo, TextValue, NumValue, RecordType, order_id) + 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} - delete from PartSubPropertiesValue where Site=#{site} and PartNo=#{partNo} and CodeNo=#{codeNo} and PropertiesItemNo=#{propertiesItemNo} and RecordType=#{recordType} + delete + from PartSubPropertiesValue + where Site = #{site} + and PartNo = #{partNo} + and CodeNo = #{codeNo} + and PropertiesItemNo = #{propertiesItemNo} + and RecordType = #{recordType} - + select isnull(Max(itemNo) + 1, 1) + from PartSubPropertiesValue + where Site = #{site} + and PartNo = #{partNo} + and CodeNo = #{codeNo} + and RecordType = #{recordType} + + + delete + from PartSubPropertiesValue + where Site = #{site} + and PartNo = #{partNo} + and CodeNo = #{codeNo} + and RecordType = #{recordType} + + + + delete from PartSubPropertiesValueHeader + where Site = #{site} + and PartNo = #{partNo} + and CodeNo = #{codeNo} + and RecordType = #{recordType} + \ No newline at end of file