CCN.Modules.Customer.DataAccess.CustomerDA.GetCustById C# (CSharp) Method

GetCustById() public method

获取会员详情
public GetCustById ( string innerid ) : CustViewModel
innerid string 会员id
return CCN.Modules.Customer.BusinessEntity.CustViewModel
        public CustViewModel GetCustById(string innerid)
        {
            const string sql = @"select a.*,b.provname,c.cityname from cust_info as a
                left join base_province as b on a.provid=b.innerid
                left join base_city as c on a.cityid=c.innerid where a.innerid=@innerid;";

            try
            {
                var custModel = Helper.Query<CustViewModel>(sql, new { innerid }).FirstOrDefault();
                //获取微信信息
                if (custModel != null)
                {
                    custModel.Wechat = Helper.Query<CustWechat>("select a.* from wechat_friend as a inner join cust_wechat as b on a.openid=b.openid where b.custid=@custid;", new
                    {
                        custid = innerid
                    }).FirstOrDefault();

                    custModel.TotalInfo = Helper.Query<CustTotalModel>("select * from cust_total_info where custid=@custid;", new { custid = innerid }).FirstOrDefault();
                }
                return custModel;

            }
            catch (Exception ex)
            {
                return null;
            }
        }