Lams档案管理系统主键策略为自增int类型的策略,主要设置在application.properties中的 program.max.did.flag ,下面对这个配置项做一下说明
注意:接口的did要从lams里面获取,不能自己生成主键。 附件一 (mysql,其他数据库联系研发)DROP procedure IF EXISTS `LAMSMAXDID`;CREATE PROCEDURE `LAMSMAXDID`( IN tableName varchar(254),IN fieldName varchar(254), OUT maxDid int)BEGIN set @keyName = concat(tableName,'.',fieldName) ; set @maxNum = 0; select _v into maxDid from S_LAMSMAXDID where _k = @keyName FOR UPDATE; if maxDid is null then set @maxCol = concat('max(',fieldName,')'); SET @sql= concat('SELECT if(', @maxCol,' is NULL,0,', @maxCol,') into @maxNum FROM ',tableName) ; PREPARE p_sqlstr FROM @sql ; EXECUTE p_sqlstr ; DEALLOCATE PREPARE p_sqlstr ; set maxDid = @maxNum; insert into S_LAMSMAXDID (_k,_v)values(@keyName,maxDid+1); else update S_LAMSMAXDID set _v = _v+1 where _k = @keyName; END IF;END