Index: forgon-core/src/main/java/com/forgon/directory/service/OrgUnitManagerImpl.java =================================================================== diff -u -r20481 -r20666 --- forgon-core/src/main/java/com/forgon/directory/service/OrgUnitManagerImpl.java (.../OrgUnitManagerImpl.java) (revision 20481) +++ forgon-core/src/main/java/com/forgon/directory/service/OrgUnitManagerImpl.java (.../OrgUnitManagerImpl.java) (revision 20666) @@ -1408,23 +1408,25 @@ objectDao.excuteSQL("update PrintConfig set departCodes=SUBSTRING(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(';' , departNames , ';') , ';" + name + ";' , ';" + newName + ";') , 2 , len(replace(concat(';' , departNames , ';') , ';" + name + ";' , ';" + newName + ";')) - 2)" : "") +" where concat(';' , departCodes , ';') like '%;" + oldOrgUnitCoding + ";%';"); objectDao.excuteSQL("update FormDefinition set departCodes=SUBSTRING(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(';' , departNames , ';') , ';" + name + ";' , ';" + newName + ";') , 2 , len(replace(concat(';' , departNames , ';') , ';" + name + ";' , ';" + newName + ";')) - 2)" : "") +" where concat(';' , departCodes , ';') like '%;" + oldOrgUnitCoding + ";%';");*/ - objectDao.excuteSQL("update DepartmentAppTemplate set orgUnitCode = SUBSTRING(replace((','+cast(orgUnitCode as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(orgUnitCode as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where (',' + cast(orgUnitCode as varchar) + ',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update departmentGroup set departCodes = SUBSTRING(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",') , 2 , len(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where (','+cast(departCodes as varchar)+',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update InvoiceDepartment set departCodes = SUBSTRING(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",') , 2 , len(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where (','+cast(departCodes as varchar)+',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update PrintInvoiceConfig set departCodes = SUBSTRING(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",') , 2 , len(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where (','+cast(departCodes as varchar)+',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update System_Message set departCodes = SUBSTRING(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departName = SUBSTRING(replace((','+cast(departName as varchar)+','),'," + name + ",','," + newName + ",') , 2 , len(replace((','+cast(departName as varchar)+','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where (','+cast(departCodes as varchar)+',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update MaterialDefinition set inventoryDepartCoding = SUBSTRING(replace((','+cast(inventoryDepartCoding as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(inventoryDepartCoding as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where (','+cast(inventoryDepartCoding as varchar)+',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update GoodsDepartShareConfig set departCodes = SUBSTRING(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",') , 2 , len(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where (','+cast(departCodes as varchar)+',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update PrintConfig set departCodes=SUBSTRING(replace((';'+cast(departCodes as varchar)+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace((';'+cast(departCodes as varchar)+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((';' + cast(departNames as varchar) + ';') , ';" + name + ";' , ';" + newName + ";') , 2 , len(replace((';' + cast(departNames as varchar) + ';') , ';" + name + ";' , ';" + newName + ";')) - 2)" : "") +" where (';' + cast(departCodes as varchar) + ';') like '%;" + oldOrgUnitCoding + ";%';"); - objectDao.excuteSQL("update FormDefinition set departCodes=SUBSTRING(replace((';'+cast(departCodes as varchar)+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace((';'+cast(departCodes as varchar)+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((';' + cast(departNames as varchar) + ';') , ';" + name + ";' , ';" + newName + ";') , 2 , len(replace((';' + cast(departNames as varchar) + ';') , ';" + name + ";' , ';" + newName + ";')) - 2)" : "") +" where (';' + cast(departCodes as varchar) + ';') like '%;" + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update DepartmentAppTemplate set orgUnitCode = SUBSTRING(replace((','+cast(orgUnitCode as varchar(4000))+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(orgUnitCode as varchar(4000))+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where (',' + cast(orgUnitCode as varchar(4000)) + ',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update MaterialDefinition set inventoryDepartCoding = SUBSTRING(replace((','+cast(inventoryDepartCoding as varchar(4000))+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(inventoryDepartCoding as varchar(4000))+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where (','+cast(inventoryDepartCoding as varchar(4000))+',') like '%," + oldOrgUnitCoding + ",%';"); + + objectDao.excuteSQL("update DepartmentGroup set departCodes = SUBSTRING(replace((';'+cast(departCodes as varchar(4000))+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace((';'+cast(departCodes as varchar(4000))+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((';'+cast(departNames as varchar(4000))+';'),';" + name + ";' , ';" + newName + ";') , 2 , len(replace((';'+cast(departNames as varchar(4000))+';'),';" + name + ";' , ';" + newName + ";')) - 2)" : "") +" where (';'+cast(departCodes as varchar(4000))+';') like '%;" + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update InvoiceDepartment set departCodes = SUBSTRING(replace((';'+cast(departCodes as varchar(4000))+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace((';'+cast(departCodes as varchar(4000))+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((';'+cast(departNames as varchar(4000))+';'),';" + name + ";' , ';" + newName + ";') , 2 , len(replace((';'+cast(departNames as varchar(4000))+';'),';" + name + ";' , ';" + newName + ";')) - 2)" : "") +" where (';'+cast(departCodes as varchar(4000))+';') like '%;" + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update PrintInvoiceConfig set departCodes = SUBSTRING(replace((';'+cast(departCodes as varchar(4000))+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace((';'+cast(departCodes as varchar(4000))+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((';'+cast(departNames as varchar(4000))+';'),';" + name + ";' , ';" + newName + ";') , 2 , len(replace((';'+cast(departNames as varchar(4000))+';'),';" + name + ";' , ';" + newName + ";')) - 2)" : "") +" where (';'+cast(departCodes as varchar(4000))+';') like '%;" + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update System_Message set departCodes = SUBSTRING(replace((';'+cast(departCodes as varchar(4000))+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace((';'+cast(departCodes as varchar(4000))+';'),'," + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departName = SUBSTRING(replace((';'+cast(departName as varchar(4000))+';'),';" + name + ";' , ';" + newName + ";') , 2 , len(replace((';'+cast(departName as varchar(4000))+';'),';" + name + ";',';" + newName + ";')) - 2)" : "") +" where (';'+cast(departCodes as varchar(4000))+';') like '%;" + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update GoodsDepartShareConfig set departCodes = SUBSTRING(replace((';'+cast(departCodes as varchar(4000))+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace((';'+cast(departCodes as varchar(4000))+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((';'+cast(departNames as varchar(4000))+';'),';" + name + ";' , ';" + newName + ";') , 2 , len(replace((';'+cast(departNames as varchar(4000))+';'),';" + name + ";' , ';" + newName + ";')) - 2)" : "") +" where (';'+cast(departCodes as varchar(4000))+';') like '%;" + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update PrintConfig set departCodes=SUBSTRING(replace((';'+cast(departCodes as varchar(4000))+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace((';'+cast(departCodes as varchar(4000))+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((';' + cast(departNames as varchar(4000)) + ';') , ';" + name + ";' , ';" + newName + ";') , 2 , len(replace((';' + cast(departNames as varchar(4000)) + ';') , ';" + name + ";' , ';" + newName + ";')) - 2)" : "") +" where (';' + cast(departCodes as varchar(4000)) + ';') like '%;" + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update FormDefinition set departCodes=SUBSTRING(replace((';'+cast(departCodes as varchar(4000))+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace((';'+cast(departCodes as varchar(4000))+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((';' + cast(departNames as varchar(4000)) + ';') , ';" + name + ";' , ';" + newName + ";') , 2 , len(replace((';' + cast(departNames as varchar(4000)) + ';') , ';" + name + ";' , ';" + newName + ";')) - 2)" : "") +" where (';' + cast(departCodes as varchar(4000)) + ';') like '%;" + oldOrgUnitCoding + ";%';"); }else if(DatabaseUtil.isOracle(dbConnection.getDatabase())){ objectDao.excuteSQL("update DepartmentAppTemplate set orgUnitCode = substr(replace(concat(',',concat(orgUnitCode,',')),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , length(replace(concat(',',concat(orgUnitCode,',')),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',orgUnitCode,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update departmentGroup set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update InvoiceDepartment set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update PrintInvoiceConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update System_Message set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departName,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departName,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); objectDao.excuteSQL("update MaterialDefinition set inventoryDepartCoding = SUBSTRING(replace(concat(',',inventoryDepartCoding,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',inventoryDepartCoding,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',inventoryDepartCoding,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update GoodsDepartShareConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + + objectDao.excuteSQL("update departmentGroup set departCodes = SUBSTRING(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(';',departNames,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departNames,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2)":"") +" where concat(';',departCodes,';') like '%;" + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update InvoiceDepartment set departCodes = SUBSTRING(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(';',departNames,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departNames,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2)":"") +" where concat(';',departCodes,';') like '%;" + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update PrintInvoiceConfig set departCodes = SUBSTRING(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(';',departNames,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departNames,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2)":"") +" where concat(';',departCodes,';') like '%;" + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update System_Message set departCodes = SUBSTRING(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(';',departName,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departName,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2)":"") +" where concat(';',departCodes,';') like '%," + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update GoodsDepartShareConfig set departCodes = SUBSTRING(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(';',departNames,';'),'," + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departNames,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2)":"") +" where concat(';',departCodes,';') like '%," + oldOrgUnitCoding + ";%';"); objectDao.excuteSQL("update PrintConfig set departCodes=SUBSTRING(replace(concat(';' , departCodes , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';' , departCodes , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(';' , departNames , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';' , departNames , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";')) - 2)":"") +" where concat(';' , departCodes , ';') like '%;" + oldOrgUnitCoding + ";%';"); objectDao.excuteSQL("update FormDefinition set departCodes=SUBSTRING(replace(concat(';' , departCodes , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';' , departCodes , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(';' , departNames , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';' , departNames , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";')) - 2)":"") +" where concat(';' , departCodes , ';') like '%;" + oldOrgUnitCoding + ";%';"); }