添加项目文件。
This commit is contained in:
59
SamplePre.DAL/DAL/SystemDal.cs
Normal file
59
SamplePre.DAL/DAL/SystemDal.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using Dapper;
|
||||
using DataDAL.DBContext;
|
||||
using Models.Models;
|
||||
using SamplePre.DAL.DBContext;
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePre.Models.Models;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SamplePre.DAL
|
||||
{
|
||||
public class SystemDal
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取用户数据
|
||||
/// </summary>
|
||||
/// <param name="standId"></param>
|
||||
/// <returns></returns>
|
||||
public List<config_user_ext> QueryUserData()
|
||||
{
|
||||
using (IDbConnection dbConnection = new DapperDBContext().Connection)
|
||||
{
|
||||
dbConnection.Open();
|
||||
|
||||
string querySql = @"
|
||||
SELECT a.*,b.all_role_names from config_user a
|
||||
LEFT JOIN (
|
||||
|
||||
SELECT
|
||||
x.user_id,
|
||||
|
||||
GROUP_CONCAT(x.role_id SEPARATOR ',') AS all_role_ids,
|
||||
|
||||
GROUP_CONCAT(y.`name` SEPARATOR ',') AS all_role_names
|
||||
FROM
|
||||
config_user_role x
|
||||
LEFT JOIN config_role y ON x.role_id = y.id
|
||||
|
||||
GROUP BY
|
||||
x.user_id
|
||||
|
||||
) b on a.id = b.user_id
|
||||
";
|
||||
|
||||
List<config_user_ext> data = dbConnection.Query<config_user_ext>(querySql).ToList();
|
||||
|
||||
return data;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user