using System;
using System.Linq;
using System.Collections.Generic;
using PushPlatform.Data;
using System.Text;
using Dapper;
using System.Data;
using MySql.Data.MySqlClient;

namespace PushPlatform.Data.DaoAchieve
{
    public partial class ProjectInfoDaoAchieve
    {

        #region Dao

        #region 获取用户的项目列表
        public List<ProjectInfo> GetUserProject(string userId)
        {
            using (IDbConnection connection = new MySqlConnection(PushPlatformContext.connString))
            {
                StringBuilder sb = new StringBuilder();
                sb.Append(@"SELECT p.Id,p.ProjectName from map_user_project m INNER JOIN project_info p ON m.ProjectId=p.Id
WHERE m.Is_Deleted=0 AND p.Is_Deleted=0 AND m.UserId=@userId");
                var query = connection.Query<ProjectInfo>(sb.ToString(), new { userId = userId });
                return query.ToList();
            }
        }
        #endregion

        #endregion
    }
}