修复getStoresSql中对于角色查询条件的bug

This commit is contained in:
gazebo
2019-10-08 17:05:14 +08:00
parent 78a2c4270a
commit 1c7edc4b86

View File

@@ -188,9 +188,10 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte
SELECT COUNT(*)
FROM casbin_rule t11
JOIN user t12 ON t12.user_id = t11.v0 AND t12.mobile LIKE ?
WHERE t11.v1 <> '' AND (t11.v1 = CONCAT(?, t1.id) OR t11.v1 = t1.market_man_role OR t11.v1 = t1.operator_role OR t11.v1 = t1.operator_role2)
WHERE t11.v1 <> '' AND (t11.v1 = CONCAT(?, t1.id) OR t11.v1 = CONCAT(?, t1.market_man_role) OR t11.v1 = CONCAT(?, t1.operator_role) OR t11.v1 = CONCAT(?, t1.operator_role2))
) > 0`
sqlWhereParams = append(sqlWhereParams, keyword+"%", autils.NewStoreBossRole(-1).GetFullName()) // 必须要前缀,不然不能用过些会很慢
prefix := autils.NewRole("", 0).GetFullName()
sqlWhereParams = append(sqlWhereParams, keyword+"%", autils.NewStoreBossRole(-1).GetFullName(), prefix, prefix, prefix) // 必须要前缀,不然不能用过些会很慢
}
sqlWhere += " OR t1.id = ? OR t1.city_code = ? OR t1.district_code = ?"
sqlWhereParams = append(sqlWhereParams, keywordInt64, keywordInt64, keywordInt64)