|
@@ -53,6 +53,20 @@ func GetUserReadRecordByUserId(userId int, condition string, pars []interface{},
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func GetUserReadRecordCountByUserId(userId int, condition string, pars []interface{}) (count int, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT COUNT(*) AS count
|
|
|
+ FROM user_read_record AS ur
|
|
|
+ LEFT JOIN user_read_permission2 AS urp2
|
|
|
+ ON ur.user_read_record_id = urp2.user_read_record_id
|
|
|
+ WHERE user_id = ? `
|
|
|
+ if condition != "" {
|
|
|
+ sql += condition
|
|
|
+ }
|
|
|
+ err = o.Raw(sql, userId, pars).QueryRow(&count)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func GetStaticReadCnt(condition string, pars []interface{}, startDate, endDate string) (items []*ReadCntStaitc, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT create_date, COUNT(*) AS count
|