Merge remote-tracking branch 'origin/mark' into don

This commit is contained in:
Rosy-zhudan
2019-09-12 08:40:59 +08:00
9 changed files with 83 additions and 46 deletions

View File

@@ -63,15 +63,16 @@ func UpdateEntityByKV(db *DaoDB, item interface{}, kvs map[string]interface{}, c
func BatchUpdateEntityByKV(db *DaoDB, items []*KVUpdateItem) (num int64, err error) {
if len(items) > 0 {
Begin(db)
defer func() {
if r := recover(); r != nil || err != nil {
Rollback(db)
if r != nil {
panic(r)
}
}
}()
// 不用事务应该是OK的吧用事务经常会导致死锁不同平台在同步同一条数据
// Begin(db)
// defer func() {
// if r := recover(); r != nil || err != nil {
// Rollback(db)
// if r != nil {
// panic(r)
// }
// }
// }()
for _, v := range items {
num2, err2 := UpdateEntityByKV(db, v.Item, v.KVs, nil)
if err = err2; err != nil {
@@ -79,7 +80,7 @@ func BatchUpdateEntityByKV(db *DaoDB, items []*KVUpdateItem) (num int64, err err
}
num += num2
}
Commit(db)
// Commit(db)
}
return num, nil
}

View File

@@ -61,8 +61,8 @@ func QueryPageStores(db *DaoDB, pageSize, offset int, keyword string, vendorStor
}
if keyword != "" {
keywordLike := "%" + keyword + "%"
sql += " AND (t1.name LIKE ? OR t1.tel1 LIKE ? OR t1.tel2 LIKE ? OR t1.org_code LIKE ? OR t1.address LIKE ? OR t2.name LIKE ? OR t3.name LIKE ?"
sqlParams = append(sqlParams, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike)
sql += " AND (t1.name LIKE ? OR t1.tel1 LIKE ? OR t1.tel2 LIKE ? OR t1.org_code LIKE ? OR t1.address LIKE ? OR t2.name LIKE ? OR t3.name LIKE ? OR t1.licence_code LIKE ?"
sqlParams = append(sqlParams, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike)
sql += ")"
}
sql += `

View File

@@ -49,7 +49,7 @@ const (
var (
StoreStatusName = map[int]string{
StoreStatusDisabled: "禁用",
StoreStatusClosed: "长期休息",
StoreStatusClosed: "休息",
StoreStatusHaveRest: "临时休息",
StoreStatusOpened: "营业中",
}