wzp
2021-07-19 58ec6ffd2dc6a3e490e28026dd559352678a273d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FineAdmin.IRepository;
using FineAdmin.Model;
using Dapper;
 
namespace FineAdmin.Repository
{
    public class ModuleRepository : BaseRepository<ModuleModel>, IModuleRepository
    {
        /// <summary>
        /// 根据角色ID获取菜单列表
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="roleId"></param>
        /// <returns></returns>
        public IEnumerable<ModuleModel> GetModuleListByRoleId(string sql, int roleId)
        {
            using (var conn = OracleHelper.OracleConnection())
            {
                sql += @" WHERE id in(SELECT a.ModuleId FROM dbsys_roleauthorize a
                        INNER JOIN dbsys_module b ON a.ModuleId = b.Id
                        WHERE 1=1
                        and a.RoleId = :RoleId
                        GROUP BY a.ModuleId)
                        ORDER BY m.SortCode ASC";
                return conn.Query<ModuleModel>(sql, new { RoleId = roleId });
            }
        }
    }
}