改進版本號的精確資料許可權定義和實現

2021-09-08 17:52:50 字數 2982 閱讀 4920

因為project實現上的某些小問題。為了達到方便實現如圖效果,對資料結構做了一點點的調整。

新的資料結構例如以下圖:

go/*****檢視:查詢全部角色的資料許可權*****/

create view roledatapermit

aswith

list as (

select distinct

g.id as dataid,

null as parentid,

pm.roleid,

0 as action,

g.name as 模組,

null as 讀寫許可權

from sys_modulegroup g

join sys_module m on m.modulegroupid = g.id

join sys_roleperm_module pm on pm.moduleid = m.id

left join sys_roleperm_data pd on pd.permid = pm.id

where pm.permission >= 0

or pd.id is not null

union all

select m.id as dataid,

case when m.modulegroupid is null then m.parentid else m.modulegroupid end as parentid,

pm.roleid,

1 as action,

null as 讀寫許可權

from sys_module m

join sys_roleperm_module pm on pm.moduleid = m.id

where pm.permission >= 0

union all

select pm.id as dataid,

pm.moduleid as parentid,

pm.roleid,

2 as action,

'無歸屬資料' as 模組,

case when pm.permission = 0 then '僅僅讀' else '讀寫' end as 讀寫許可權

from sys_roleperm_module pm

where pm.permission >= 0

union all

select pd.id as dataid,

m.moduleid as parentid,

m.roleid,

pd.mode + 3 as action,

case pd.mode when 0 then '僅本人' when 1 then '僅本部門' when 2 then '本部門全部' when 3 then '本機構全部' when 4 then '根機構全部' else '自己定義' end as 模組,

case when pd.permission = 0 and pd.mode < 5 then '僅僅讀' when pd.permission = 1 and pd.mode < 5 then '讀寫' else null end as 讀寫許可權

from sys_roleperm_data pd

join sys_roleperm_module m on m.id = pd.permid

union all

select pc.id as dataid,

pc.permdataid as parentid,

pm.roleid,

9 as action,

o.fullname as 模組,

case when pc.permission = 0 then '僅僅讀' else '讀寫' end as 讀寫許可權

from sys_roleperm_module pm

join sys_roleperm_data pd on pd.permid = pm.id

and pd.mode = 5

join sys_roleperm_custom pc on pc.permdataid = pd.id

and pc.orgid is not null

join sys_organization o on o.id = pc.orgid

union all

select pc.id as dataid,

pc.permdataid as parentid,

pm.roleid,

10 as action,

u.name + '(' + u.loginname + ')' as 模組,

case when pc.permission = 0 then '僅僅讀' else '讀寫' end as 讀寫許可權

from sys_roleperm_module pm

join sys_roleperm_data pd on pd.permid = pm.id

and pd.mode = 5

join sys_roleperm_custom pc on pc.permdataid = pd.id

and pc.userid is not null

join sys_user u on u.id = pc.userid

)select newid() as id, * from list

go

關於svn git生成版本號指令碼的改進

之前寫了篇文章介紹使用指令碼生成svn git版本號的 svn git生成版本號 獲取svn版本號的方法有些不恰當,在不同版本的svn上會出現問題。這裡再對此進行完善。之前的指令碼是通過下面的命令獲取當前的svn的提交版本號 localver svn info cat n awk 下面給出結合了sv...

ios版本號的區別 和獲取版本號的方法

cfbundleshortversionstring 標識應用程式的 發布版本號 該版本的版本號是三個時期分隔的整數組成的字串。第乙個整數代表重大修改的版本,如實現新的功能或重大變化的修訂。第二個整數表示的修訂,實現較突出的特點。第三個整數代表維護版本。該鍵的值不同於 cfbundleversion...

關於iOS App的版本號

version和build的區別 一種是cfbundleversion bundle version 也就是我們看到的version,另一種是cfbundleshortversionstring bundle version string,short 也就是我們看到的build。build最好是整數...