Merge pull request #694 from infnan/master

处理postgre启动报错问题
This commit is contained in:
wenjianzhang authored and GitHub committed 2022-08-22 15:22:49 +08:00
commit dcafcdc6ce
6 files changed
+23 -9

No files matched your search

+1 -1
View File
@@ -198,7 +198,7 @@ func (e SysConfig) Get2SysApp(c *gin.Context) {
return return
} }
// 控制只读前台的数据 // 控制只读前台的数据
req.IsFrontend = 1 req.IsFrontend = "1"
list := make([]models.SysConfig, 0) list := make([]models.SysConfig, 0)
err = s.GetWithKeyList(&req, &list) err = s.GetWithKeyList(&req, &list)
if err != nil { if err != nil {
+1 -1
View File
@@ -10,7 +10,7 @@ type SysConfig struct {
ConfigKey string `json:"configKey" gorm:"size:128;comment:ConfigKey"` // ConfigKey string `json:"configKey" gorm:"size:128;comment:ConfigKey"` //
ConfigValue string `json:"configValue" gorm:"size:255;comment:ConfigValue"` // ConfigValue string `json:"configValue" gorm:"size:255;comment:ConfigValue"` //
ConfigType string `json:"configType" gorm:"size:64;comment:ConfigType"` 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"` // Remark string `json:"remark" gorm:"size:128;comment:Remark"` //
models.ControlBy models.ControlBy
models.ModelTime models.ModelTime
+3 -3
View File
@@ -12,7 +12,7 @@ type SysConfigGetPageReq struct {
ConfigName string `form:"configName" search:"type:contains;column:config_name;table:sys_config"` 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"` 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"` 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 SysConfigOrder
} }
@@ -29,7 +29,7 @@ func (m *SysConfigGetPageReq) GetNeedSearch() interface{} {
} }
type SysConfigGetToSysAppReq struct { 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{} { func (m *SysConfigGetToSysAppReq) GetNeedSearch() interface{} {
@@ -43,7 +43,7 @@ type SysConfigControl struct {
ConfigKey string `uri:"configKey" json:"configKey" comment:""` ConfigKey string `uri:"configKey" json:"configKey" comment:""`
ConfigValue string `json:"configValue" comment:""` ConfigValue string `json:"configValue" comment:""`
ConfigType string `json:"configType" comment:""` ConfigType string `json:"configType" comment:""`
IsFrontend int `json:"isFrontend"` IsFrontend string `json:"isFrontend"`
Remark string `json:"remark" comment:""` Remark string `json:"remark" comment:""`
common.ControlBy common.ControlBy
} }
+4
View File
@@ -13,6 +13,10 @@ import (
func InitDb(db *gorm.DB) (err error) { func InitDb(db *gorm.DB) (err error) {
filePath := "config/db.sql" filePath := "config/db.sql"
if global.Driver == "postgres" { if global.Driver == "postgres" {
filePath := "config/db.sql"
if err = ExecSql(db, filePath); err != nil {
return err
}
filePath = "config/pg.sql" filePath = "config/pg.sql"
err = ExecSql(db, filePath) err = ExecSql(db, filePath)
} else if global.Driver == "mysql" { } else if global.Driver == "mysql" {
+1 -1
View File
@@ -14,7 +14,7 @@ type Login struct {
} }
func (u *Login) GetUser(tx *gorm.DB) (user SysUser, role SysRole, err error) { 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 { if err != nil {
log.Errorf("get user error, %s", err.Error()) log.Errorf("get user error, %s", err.Error())
return return
+13 -3
View File
@@ -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_role_role_id_seq',4);
select setval('sys_user_user_id_seq',5); select setval('sys_user_user_id_seq',5);
select setval('sys_post_post_id_seq',4); 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_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_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); select setval('sys_job_id_seq',3);
-- 数据完成 ; -- 数据完成 ;