Jelajahi Sumber

域初始化添加首页菜单,删除sys_domain的index_url字段

huangyh 6 tahun lalu
induk
melakukan
d03dde222e

+ 13 - 0
engine/system_init.go

@@ -239,6 +239,18 @@ func initBusinessDbData(domainid, login_id, domain string, db *xorm.Engine, plat
 		},
 	}
 
+	menu := []models.SysMenu{
+		{
+			Id:          domainid,
+			Name:        "首页",
+			Code:        "home",
+			Inheritance: "|" + domainid + "|",
+			Url:         "index",
+			Icon:        "index",
+			CreateTime:  models.NowLocal(),
+		},
+	}
+
 	userRoles := []models.SysUserRole{
 		{
 			Id:         domainid,
@@ -250,6 +262,7 @@ func initBusinessDbData(domainid, login_id, domain string, db *xorm.Engine, plat
 	platform_db.Insert(users)
 	db.Insert(users)
 	db.Insert(roles)
+	db.Insert(menu)
 	db.Insert(userRoles)
 }
 

+ 8 - 2
light-apiengine.xml

@@ -361,6 +361,13 @@
                     <failure ref="$sys_return"></failure>
                 </return>
             </api>
+            <api name="get_user_roles" desc="根据用户ID获取用户角色" method="post,get,put">
+                <param name="user_id" type="string" desc="用户ID"/>、
+                <return>
+                    <success ref="$sys_return"></success>
+                    <failure ref="$sys_return"></failure>
+                </return>
+            </api>
             <api name="find_role_menu" desc="查找角色权限" method="post,get,put">
                 <param name="role_id" type="string" desc="角色id"/>
                 <return>
@@ -741,7 +748,7 @@
             </column>
             <column isNull="false" name="name" caption="名称" type="string" size="36" dbtype="varchar(36)"/>
             <column isNull="false" name="code" caption="编码" type="string" size="36" dbtype="varchar(36)"/>
-            <column isNull="false" name="index_url" caption="角色进入后台首页url" type="string" size="500" dbtype="varchar(500)"/>
+            <column isNull="false" name="index_component" caption="角色进入后台首页组件" type="string" size="500" dbtype="varchar(500)"/>
             <column isNull="false" name="app_index" caption="角色app首页url" type="string" size="500" dbtype="varchar(500)"/>
             <column name="priority" caption="优先级" type="int32"/>
             <column name="remark" caption="备注" type="string" size="100" dbtype="varchar(100)"/>
@@ -862,7 +869,6 @@
             <column isNull="false" name="data_source" caption="数据库链接串" type="string" size="200" dbtype="varchar(200)"/>
             <column isNull="false" name="domain_url" caption="网址" type="string" size="200" dbtype="varchar(200)"/>
             <column isNull="false" name="login_url" caption="登录页" type="string" size="200" dbtype="varchar(200)"/>
-            <column isNull="false" name="index_url" caption="首页" type="string" size="200" dbtype="varchar(200)"/>
             <column isNull="true" name="theme" caption="样式" type="string" size="50" dbtype="varchar(50)"/>
             <column name="type" caption="域类型" type="int32"/>
             <column name="status" caption="状态 0:禁用   1:正常" type="int32"/>

+ 0 - 2
models/SysDomain_gen.go

@@ -23,8 +23,6 @@ type SysDomain struct {
 	DomainUrl string `xorm:"'domain_url' varchar(200) notnull "json:"domain_url"`
 	//登录页
 	LoginUrl string `xorm:"'login_url' varchar(200) notnull "json:"login_url"`
-	//首页
-	IndexUrl string `xorm:"'index_url' varchar(200) notnull "json:"index_url"`
 	//样式
 	Theme string `xorm:"'theme' varchar(50) null "json:"theme"`
 	//域类型

+ 5 - 5
sqlconfig/light-apiengine/sys_domain_gen.xml

@@ -2,13 +2,13 @@
 <sqlMap>
     <sql id="insert_sys_domain">
         insert into sys_domain
-		(`id`,`name`,`full_name`,`contact_name`,`contact_email`,`contact_mobile`,`data_source`,`domain_url`,`login_url`,`index_url`,`theme`,`type`,`status`,`sync_flag`,`domain`,`create_by`,`create_time`,`last_update_by`,`last_update_time`,`del_flag`)
+		(`id`,`name`,`full_name`,`contact_name`,`contact_email`,`contact_mobile`,`data_source`,`domain_url`,`login_url`,`theme`,`type`,`status`,`sync_flag`,`domain`,`create_by`,`create_time`,`last_update_by`,`last_update_time`,`del_flag`)
 		values
-		(?id,?name,?full_name,?contact_name,?contact_email,?contact_mobile,?data_source,?domain_url,?login_url,?index_url,?theme,?type,?status,?sync_flag,?domain,?create_by,?create_time,?last_update_by,?last_update_time,?del_flag)
+		(?id,?name,?full_name,?contact_name,?contact_email,?contact_mobile,?data_source,?domain_url,?login_url,?theme,?type,?status,?sync_flag,?domain,?create_by,?create_time,?last_update_by,?last_update_time,?del_flag)
     </sql>
     <sql id="update_sys_domain">
         update sys_domain set
-		`name` = ?name,`full_name` = ?full_name,`contact_name` = ?contact_name,`contact_email` = ?contact_email,`contact_mobile` = ?contact_mobile,`data_source` = ?data_source,`domain_url` = ?domain_url,`login_url` = ?login_url,`index_url` = ?index_url,`theme` = ?theme,`type` = ?type,`status` = ?status,`sync_flag` = ?sync_flag,`domain` = ?domain,`create_by` = ?create_by,`create_time` = ?create_time,`last_update_by` = ?last_update_by,`last_update_time` = ?last_update_time,`del_flag` = ?del_flag
+		`name` = ?name,`full_name` = ?full_name,`contact_name` = ?contact_name,`contact_email` = ?contact_email,`contact_mobile` = ?contact_mobile,`data_source` = ?data_source,`domain_url` = ?domain_url,`login_url` = ?login_url,`theme` = ?theme,`type` = ?type,`status` = ?status,`sync_flag` = ?sync_flag,`domain` = ?domain,`create_by` = ?create_by,`create_time` = ?create_time,`last_update_by` = ?last_update_by,`last_update_time` = ?last_update_time,`del_flag` = ?del_flag
 		where id = ?id
     </sql>
     <sql id="deleteone_sys_domain">
@@ -17,13 +17,13 @@
     </sql>
     <sql id="selectone_sys_domain">
         select 
-			`id`,`name`,`full_name`,`contact_name`,`contact_email`,`contact_mobile`,`data_source`,`domain_url`,`login_url`,`index_url`,`theme`,`type`,`status`,`sync_flag`,`domain`,`create_by`,`create_time`,`last_update_by`,`last_update_time`,`del_flag`
+			`id`,`name`,`full_name`,`contact_name`,`contact_email`,`contact_mobile`,`data_source`,`domain_url`,`login_url`,`theme`,`type`,`status`,`sync_flag`,`domain`,`create_by`,`create_time`,`last_update_by`,`last_update_time`,`del_flag`
         from sys_domain
 		where id = ?id
     </sql>
     <sql id="selectall_sys_domain">
         select 
-			`id`,`name`,`full_name`,`contact_name`,`contact_email`,`contact_mobile`,`data_source`,`domain_url`,`login_url`,`index_url`,`theme`,`type`,`status`,`sync_flag`,`domain`,`create_by`,`create_time`,`last_update_by`,`last_update_time`,`del_flag`
+			`id`,`name`,`full_name`,`contact_name`,`contact_email`,`contact_mobile`,`data_source`,`domain_url`,`login_url`,`theme`,`type`,`status`,`sync_flag`,`domain`,`create_by`,`create_time`,`last_update_by`,`last_update_time`,`del_flag`
         from sys_domain
     </sql>
 </sqlMap>