作者 yangfu

计数

... ... @@ -198,7 +198,11 @@ func GetIncrementSql(table string, column string, incre int, id int64) *utils.Sq
var sql *bytes.Buffer
sql = bytes.NewBuffer(nil)
sql.WriteString(fmt.Sprintf("update %s set %s=%s+%d ", table, column, column, incre))
if incre > 0 {
sql.WriteString(fmt.Sprintf(" where id=%d", id))
} else {
sql.WriteString(fmt.Sprintf(" where id=%d and %v>0", id, column))
}
return &utils.SqlData{
Sql: sql.String(),
}
... ...