Browse Source

'fix'

master
u 2 years ago
parent
commit
dc0a827dcd
  1. 25
      hasaki-gen-crud/template.go

25
hasaki-gen-crud/template.go

@ -56,9 +56,11 @@ func (TempLowHead3A60 *Temp3A60) init() {
//todo
}
func (TempLowHead3A60 *Temp3A60) joinTable() (types, sqlx, condition, alias string) {
func (TempLowHead3A60 *Temp3A60) joinTable() (typesAndsqlxAndcondition [][]string) {
//todo
return "LEFT", "", "Temp3A60.id=Temp3A60_id", "tmp"
return [][]string{
// {"LEFT", "(SELECT id as mbrand_id,name FROM `ox_brand`) as tmp", "tmp.mbrand_id=brand_id"},
}
}
// saveAllCols 保存时是否全量保存
@ -170,9 +172,9 @@ func (TempLowHead3A60 *Temp3A60) Load() (err error) {
session := TempLowHead3A60.getXorm().NewSession()
defer session.Close()
types, sqlx, condition, alias := TempLowHead3A60.joinTable()
if sqlx != "" {
session = session.Join(types, sqlx, condition, alias)
typesAndSqlxAndCndition := TempLowHead3A60.joinTable()
for _, v := range typesAndSqlxAndCndition {
session = session.Join(v[0], v[1], v[2])
}
if whereQuery != "" {
@ -205,9 +207,9 @@ func (TempLowHead3A60 *Temp3A60) Data() (data []Temp3A60) {
session.Close()
}()
types, sqlx, condition, alias := TempLowHead3A60.joinTable()
if sqlx != "" {
session = session.Join(types, sqlx, condition, alias)
typesAndSqlxAndCndition := TempLowHead3A60.joinTable()
for _, v := range typesAndSqlxAndCndition {
session = session.Join(v[0], v[1], v[2])
}
if q != "" {
@ -244,11 +246,10 @@ func (TempLowHead3A60 *Temp3A60) PageData(page, pageSize int) (data []Temp3A60,
session.Close()
}()
types, sqlx, condition, alias := TempLowHead3A60.joinTable()
if sqlx != "" {
session = session.Join(types, sqlx, condition, alias)
typesAndSqlxAndCndition := TempLowHead3A60.joinTable()
for _, v := range typesAndSqlxAndCndition {
session = session.Join(v[0], v[1], v[2])
}
if q != "" {
session = session.Where(q, args...)
}

Loading…
Cancel
Save