ALTER procedure [dbo].[pro_get_sys_ordr_lock_info]( @ORDR_HEAD_SEQ 编号, @ORDR_TYP_CD VARCHAR(20) )as begin SELECT count(1) AS IS_LOCK FROM T_SYS_ORDR_LOCK WHERE ORDR_HEAD_SEQ = @ORDR_HEAD_SEQ AND ORDR_TYP_CD = @ORDR_TYP_CD END ALTER procedure [dbo].[pro_set_sys_ordr_lock_info]( @ORDR_HEAD_SEQ 编号, @ordr_typ_cd varchar(20), @IS_LOCK VARCHAR(200), -- 1或0 @LOGIN_USR_ID INT --登录用户ID )AS BEGIN IF isnull(@IS_LOCK, 0) = 1 BEGIN INSERT t_sys_ordr_lock(lock_usr_id, lock_dtim, ordr_head_seq, ordr_typ_cd) VALUES(@LOGIN_USR_ID, getdate(), @ordr_head_seq, @ordr_typ_cd) END ELSE BEGIN DELETE FROM t_sys_ordr_lock WHERE ordr_head_seq = @ORDR_HEAD_SEQ AND ordr_typ_cd = @ordr_typ_cd END END
加锁就插入一条数据,解锁就删除一条数据