处理postgre启动报错问题
Signed-off-by: infnan <38274826+infnan@users.noreply.github.com>
This commit is contained in:
1 parent
483ec2bf3e
commit
0993173b1f
6 files changed
+25
-11
No files matched your search
@@ -198,7 +198,7 @@ func (e SysConfig) Get2SysApp(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
// 控制只读前台的数据
|
||||
req.IsFrontend = 1
|
||||
req.IsFrontend = "1"
|
||||
list := make([]models.SysConfig, 0)
|
||||
err = s.GetWithKeyList(&req, &list)
|
||||
if err != nil {
|
||||
@@ -310,4 +310,4 @@ func (e SysConfig) GetSysConfigByKEYForService(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
e.OK(resp, s.Msg)
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ type SysConfig struct {
|
||||
ConfigKey string `json:"configKey" gorm:"size:128;comment:ConfigKey"` //
|
||||
ConfigValue string `json:"configValue" gorm:"size:255;comment:ConfigValue"` //
|
||||
ConfigType string `json:"configType" gorm:"size:64;comment:ConfigType"`
|
||||
IsFrontend int `json:"isFrontend" gorm:"size:64;comment:是否前台"` //
|
||||
IsFrontend string `json:"isFrontend" gorm:"size:64;comment:是否前台"` //
|
||||
Remark string `json:"remark" gorm:"size:128;comment:Remark"` //
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
|
||||
@@ -12,7 +12,7 @@ type SysConfigGetPageReq struct {
|
||||
ConfigName string `form:"configName" search:"type:contains;column:config_name;table:sys_config"`
|
||||
ConfigKey string `form:"configKey" search:"type:contains;column:config_key;table:sys_config"`
|
||||
ConfigType string `form:"configType" search:"type:exact;column:config_type;table:sys_config"`
|
||||
IsFrontend int `form:"isFrontend" search:"type:exact;column:is_frontend;table:sys_config"`
|
||||
IsFrontend string `form:"isFrontend" search:"type:exact;column:is_frontend;table:sys_config"`
|
||||
SysConfigOrder
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ func (m *SysConfigGetPageReq) GetNeedSearch() interface{} {
|
||||
}
|
||||
|
||||
type SysConfigGetToSysAppReq struct {
|
||||
IsFrontend int `form:"isFrontend" search:"type:exact;column:is_frontend;table:sys_config"`
|
||||
IsFrontend string `form:"isFrontend" search:"type:exact;column:is_frontend;table:sys_config"`
|
||||
}
|
||||
|
||||
func (m *SysConfigGetToSysAppReq) GetNeedSearch() interface{} {
|
||||
@@ -43,7 +43,7 @@ type SysConfigControl struct {
|
||||
ConfigKey string `uri:"configKey" json:"configKey" comment:""`
|
||||
ConfigValue string `json:"configValue" comment:""`
|
||||
ConfigType string `json:"configType" comment:""`
|
||||
IsFrontend int `json:"isFrontend"`
|
||||
IsFrontend string `json:"isFrontend"`
|
||||
Remark string `json:"remark" comment:""`
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
@@ -13,6 +13,10 @@ import (
|
||||
func InitDb(db *gorm.DB) (err error) {
|
||||
filePath := "config/db.sql"
|
||||
if global.Driver == "postgres" {
|
||||
filePath := "config/db.sql"
|
||||
if err = ExecSql(db, filePath); err != nil {
|
||||
return err
|
||||
}
|
||||
filePath = "config/pg.sql"
|
||||
err = ExecSql(db, filePath)
|
||||
} else if global.Driver == "mysql" {
|
||||
|
||||
@@ -14,7 +14,7 @@ type Login struct {
|
||||
}
|
||||
|
||||
func (u *Login) GetUser(tx *gorm.DB) (user SysUser, role SysRole, err error) {
|
||||
err = tx.Table("sys_user").Where("username = ? and status = 2", u.Username).First(&user).Error
|
||||
err = tx.Table("sys_user").Where("username = ? and status = '2'", u.Username).First(&user).Error
|
||||
if err != nil {
|
||||
log.Errorf("get user error, %s", err.Error())
|
||||
return
|
||||
|
||||
+14
-4
@@ -1,11 +1,21 @@
|
||||
-- 开始初始化数据 ;
|
||||
create sequence if not exists sys_role_role_id_seq;
|
||||
create sequence if not exists sys_user_user_id_seq;
|
||||
create sequence if not exists sys_post_post_id_seq;
|
||||
create sequence if not exists sys_menu_menu_id_seq;
|
||||
create sequence if not exists sys_dict_type_dict_id_seq;
|
||||
create sequence if not exists sys_dict_data_dict_code_seq;
|
||||
create sequence if not exists sys_dept_dept_id_seq;
|
||||
create sequence if not exists sys_config_config_id_seq;
|
||||
create sequence if not exists sys_job_id_seq;
|
||||
|
||||
select setval('sys_role_role_id_seq',4);
|
||||
select setval('sys_user_user_id_seq',5);
|
||||
select setval('sys_post_post_id_seq',4);
|
||||
select setval('sys_menu_menu_id_seq',268);
|
||||
select setval('sys_menu_menu_id_seq',543);
|
||||
select setval('sys_dict_type_dict_id_seq',12);
|
||||
select setval('sys_dict_data_dict_code_seq',32);
|
||||
select setval('sys_dict_data_dict_code_seq',34);
|
||||
select setval('sys_dept_dept_id_seq',11);
|
||||
select setval('sys_config_config_id_seq',4);
|
||||
select setval('sys_config_config_id_seq',6);
|
||||
select setval('sys_job_id_seq',3);
|
||||
-- 数据完成 ;
|
||||
-- 数据完成 ;
|
||||
Reference in new issue
Block a user