Skip to content

Commit

Permalink
v1.3.6: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mizuki1412 committed Apr 1, 2022
1 parent 4cb5471 commit bf9d09f
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 45 deletions.
18 changes: 8 additions & 10 deletions goland-live-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ const (
)
func New(tx ...*sqlx.Tx) *Dao {
return NewWithSchema("", tx...)
}
func NewWithSchema(schema string,tx ...*sqlx.Tx) *Dao {
dao := &Dao{}
dao.SetSchema(schema)
if len(tx) > 0 {
dao.TX = tx[0]
}
Expand All @@ -266,11 +270,6 @@ func New(tx ...*sqlx.Tx) *Dao {
}
return dao
}
func NewWithSchema(schema string,tx ...*sqlx.Tx) *Dao {
dao := New(tx...)
dao.SetSchema(schema)
return dao
}
```

## dao_new_no_cascade
Expand All @@ -280,17 +279,16 @@ type Dao struct {
}
func New(tx ...*sqlx.Tx) *Dao {
return NewWithSchema("", tx...)
}
func NewWithSchema(schema string,tx ...*sqlx.Tx) *Dao {
dao := &Dao{}
dao.SetSchema(schema)
if len(tx) > 0 {
dao.TX = tx[0]
}
return dao
}
func NewWithSchema(schema string,tx ...*sqlx.Tx) *Dao {
dao := New(tx...)
dao.SetSchema(schema)
return dao
}
```

## dao_demo
Expand Down
9 changes: 4 additions & 5 deletions mod/common/admindivision/dao/areadao/areadao.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@ type Dao struct {
}

func New(tx ...*sqlx.Tx) *Dao {
return NewWithSchema("", tx...)
}
func NewWithSchema(schema string, tx ...*sqlx.Tx) *Dao {
dao := &Dao{}
dao.SetSchema(schema)
if len(tx) > 0 {
dao.TX = tx[0]
}
return dao
}
func NewWithSchema(schema string, tx ...*sqlx.Tx) *Dao {
dao := New(tx...)
dao.SetSchema(schema)
return dao
}

func (dao *Dao) FindById(id class.String) *model.Area {
sql, args := sqlkit.Builder().Select("code,name").From(dao.GetTableD("area")).Where("code=?", id).MustSql()
Expand Down
9 changes: 4 additions & 5 deletions mod/common/admindivision/dao/citydao/citydao.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@ type Dao struct {
}

func New(tx ...*sqlx.Tx) *Dao {
return NewWithSchema("", tx...)
}
func NewWithSchema(schema string, tx ...*sqlx.Tx) *Dao {
dao := &Dao{}
dao.SetSchema(schema)
if len(tx) > 0 {
dao.TX = tx[0]
}
return dao
}
func NewWithSchema(schema string, tx ...*sqlx.Tx) *Dao {
dao := New(tx...)
dao.SetSchema(schema)
return dao
}

func (dao *Dao) FindById(id class.String) *model.City {
sql, args := sqlkit.Builder().Select("*").From(dao.GetTableD("city")).Where("code=?", id).MustSql()
Expand Down
9 changes: 4 additions & 5 deletions mod/common/admindivision/dao/provincedao/provincedao.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ const (
)

func New(tx ...*sqlx.Tx) *Dao {
return NewWithSchema("", tx...)
}
func NewWithSchema(schema string, tx ...*sqlx.Tx) *Dao {
dao := &Dao{}
dao.SetSchema(schema)
if len(tx) > 0 {
dao.TX = tx[0]
}
Expand All @@ -31,11 +35,6 @@ func New(tx ...*sqlx.Tx) *Dao {
}
return dao
}
func NewWithSchema(schema string, tx ...*sqlx.Tx) *Dao {
dao := New(tx...)
dao.SetSchema(schema)
return dao
}

func (dao *Dao) FindById(id class.String) *model.Province {
sql, args := sqlkit.Builder().Select("*").From(dao.GetTableD("province")).Where("code=?", id).MustSql()
Expand Down
9 changes: 4 additions & 5 deletions mod/setting/dao/settingdao/settingdao.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@ type Dao struct {
}

func New(tx ...*sqlx.Tx) *Dao {
return NewWithSchema("", tx...)
}
func NewWithSchema(schema string, tx ...*sqlx.Tx) *Dao {
dao := &Dao{}
dao.SetSchema(schema)
if len(tx) > 0 {
dao.TX = tx[0]
}
return dao
}
func NewWithSchema(schema string, tx ...*sqlx.Tx) *Dao {
dao := New(tx...)
dao.SetSchema(schema)
return dao
}

func (dao *Dao) Set(data map[string]interface{}) {
sql, args, err := sqlkit.Builder().Update(dao.GetTableD("more_setting")).Set("data", jsonkit.ToString(data)).Where("id=?", 1).ToSql()
Expand Down
9 changes: 4 additions & 5 deletions mod/user/dao/departmentdao/departmentdao.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ const (
)

func New(tx ...*sqlx.Tx) *Dao {
return NewWithSchema("", tx...)
}
func NewWithSchema(schema string, tx ...*sqlx.Tx) *Dao {
dao := &Dao{}
dao.SetSchema(schema)
if len(tx) > 0 {
dao.TX = tx[0]
}
Expand All @@ -42,11 +46,6 @@ func New(tx ...*sqlx.Tx) *Dao {
}
return dao
}
func NewWithSchema(schema string, tx ...*sqlx.Tx) *Dao {
dao := New(tx...)
dao.SetSchema(schema)
return dao
}

func (dao *Dao) FindById(id int32) *model.Department {
sql, args := sqlkit.Builder().Select("*").From(dao.GetTableD("department")).Where("id=?", id).MustSql()
Expand Down
9 changes: 4 additions & 5 deletions mod/user/dao/roledao/roledao.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ const (
)

func New(tx ...*sqlx.Tx) *Dao {
return NewWithSchema("", tx...)
}
func NewWithSchema(schema string, tx ...*sqlx.Tx) *Dao {
dao := &Dao{}
dao.SetSchema(schema)
if len(tx) > 0 {
dao.TX = tx[0]
}
Expand All @@ -36,11 +40,6 @@ func New(tx ...*sqlx.Tx) *Dao {
}
return dao
}
func NewWithSchema(schema string, tx ...*sqlx.Tx) *Dao {
dao := New(tx...)
dao.SetSchema(schema)
return dao
}
func (dao *Dao) scanPrivilege(sql string, args []any) []*model.PrivilegeConstant {
rows := dao.Query(sql, args...)
list := make([]*model.PrivilegeConstant, 0, 5)
Expand Down
9 changes: 4 additions & 5 deletions mod/user/dao/userdao/userdao.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ const (
)

func New(tx ...*sqlx.Tx) *Dao {
return NewWithSchema("", tx...)
}
func NewWithSchema(schema string, tx ...*sqlx.Tx) *Dao {
dao := &Dao{}
dao.SetSchema(schema)
if len(tx) > 0 {
dao.TX = tx[0]
}
Expand All @@ -44,11 +48,6 @@ func New(tx ...*sqlx.Tx) *Dao {
}
return dao
}
func NewWithSchema(schema string, tx ...*sqlx.Tx) *Dao {
dao := New(tx...)
dao.SetSchema(schema)
return dao
}

func (dao *Dao) Login(pwd, username, phone string) *model.User {
builder := sqlkit.Builder().Select("*").From(dao.GetTableD("admin_user"))
Expand Down

0 comments on commit bf9d09f

Please sign in to comment.