本文整理匯總了Golang中github.com/hjqhezgh/lessgo.Prop類的典型用法代碼示例。如果您正苦於以下問題:Golang Prop類的具體用法?Golang Prop怎麽用?Golang Prop使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Prop類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: CallCenterStatisticsAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by ce.cid limit ?,?"
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
lessgo.Log.Debug(sql)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 11; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例2: ChildSignInLogListAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by si.sign_time desc limit ?,?"
lessgo.Log.Debug(sql)
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 6; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例3: TmkStatisticsAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by em.user_id limit ?,?"
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
lessgo.Log.Debug(sql)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 10; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例4: ClassScheduleAttachListAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
params = append(params, scheduleId)
params = append(params, "%["+childId+"]%")
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " limit ?,? "
lessgo.Log.Debug(sql)
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 5; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例5: ConsultantPhoneListAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
lessgo.Log.Debug(sql + " limit ?,?")
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql+" limit ?,?", params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
r := rand.New(rand.NewSource(time.Now().UnixNano()))
model.Id = fmt.Sprint(r.Intn(1000))
model.Props = []*lessgo.Prop{}
fillObjects := []interface{}{}
for i := 0; i < 7; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例6: TmkStatisticsDetailAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " limit ?,?"
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
lessgo.Log.Debug(sql)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
r := rand.New(rand.NewSource(time.Now().UnixNano()))
model.Id = fmt.Sprint(r.Intn(1000))
model.Props = []*lessgo.Prop{}
fillObjects := []interface{}{}
for i := 0; i < 11; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例7: CenterCallCenterDetailAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by tc.cd_create_time desc limit ?,?"
lessgo.Log.Debug(sql)
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 10; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例8: GalleryListAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門,錯誤信息:" + err.Error()
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by gal.id desc limit ?,?"
lessgo.Log.Debug(sql)
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 5; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例9: ValidForCallCenterListAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by c.id desc limit ?,?"
lessgo.Log.Debug(sql)
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 8; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例10: WyClassListAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by c.class_id desc limit ?,?"
lessgo.Log.Debug(sql)
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 9; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例11: TmkAllConsumerListAction
//.........這裏部分代碼省略.........
countSql += " group by a.consumer_id) aa "
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, paramsForCount...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
lessgo.Log.Debug(sql)
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 13; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例12: ConsumerContactRecordListAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by c.start_time desc ,c.aid desc limit ?,?"
lessgo.Log.Debug(sql)
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 11; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Error(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例13: TmkConsumerSelfListAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by tc.tmk_create_time desc,cons.contact_status ,cons.last_contact_time desc limit ?,? "
lessgo.Log.Debug(sql)
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 15; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例14: EmployeeSignInListAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by esi.id desc limit ?,?"
lessgo.Log.Debug(sql)
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 2; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例15: ConsultantPhoneDetailListAction
//.........這裏部分代碼省略.........
where e.user_id=? and au.remotephone != '' and au.remotephone is not null %v) num`
lessgo.Log.Debug(fmt.Sprintf(countSql, whereSql))
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(fmt.Sprintf(countSql, whereSql), params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
lessgo.Log.Debug(fmt.Sprintf(sql, whereSql, "left join (select consumer_id,GROUP_CONCAT(concat(DATE_FORMAT(create_time,'%Y-%m-%d %H:%i'),' ',note) ORDER BY id SEPARATOR '<br/>') remark from consumer_contact_log group by consumer_id) b on b.consumer_id=cons.id"))
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(fmt.Sprintf(sql, whereSql, "left join (select consumer_id,GROUP_CONCAT(concat(DATE_FORMAT(create_time,'%Y-%m-%d %H:%i'),' ',note) ORDER BY id SEPARATOR '<br/>') remark from consumer_contact_log group by consumer_id) b on b.consumer_id=cons.id"), params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 13; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}