拍卖参与者query
Inheritance: QueryModel
 public BasePageList<AuctionCarParticipantViewModel> GetAuctionParticipantList(AuctionCarParticipantQueryModel query)
 {
     return _auctionservice.GetAuctionParticipantList(query);
 }
        /// <summary>
        /// 获取竞拍人列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public BasePageList<AuctionCarParticipantViewModel> GetAuctionParticipantList(AuctionCarParticipantQueryModel query)
        {
            const string spName = "sp_common_pager";
            const string tableName = @"auction_participant as a
                                       left join auction_carinfo as b on b.innerid=a.auctionid
                                       left join car_info as c on c.innerid=b.carid
                                       left join base_carmodel as c1 on c.model_id=c1.innerid
                                       left join sys_user as su on su.innerid=b.operatedid
                                       left join base_city as ct on c.cityid=ct.innerid
                                       left join base_province as pr on c.provid=pr.innerid
                                       left join (select count(1) as pricecount,auctionid from auction_participant group by auctionid) as e on e.auctionid=a.auctionid";
            const string fields = @"a.innerid,a.auctionid,a.mobile,a.amount,a.status,a.createrid,a.createdtime,a.username,
                                    a.orderno,b.no as auctionno,b.lowestprice,b.validtime,b.status as auditstatus, now() as currenttime,c.register_date,c.mileage,c.pic_url,
                                    c1.modelprice as price,c1.modelname as model_name,
                                    ct.cityname,pr.provname,e.pricecount";
            var oldField = string.IsNullOrWhiteSpace(query.Order) ? " a.createdtime asc " : query.Order;

            var sqlWhere = new StringBuilder("1=1");

            //拍卖ID
            if (!string.IsNullOrWhiteSpace(query.Auctionid))
            {
                sqlWhere.Append($" and a.auctionid='{query.Auctionid}'");
            }
            //手机号
            if (!string.IsNullOrWhiteSpace(query.Mobile))
            {
                sqlWhere.Append($" and a.mobile='{query.Mobile}'");
            }
            //用户ID
            if (!string.IsNullOrWhiteSpace(query.userid))
            {
                sqlWhere.Append($" and a.userid='{query.userid}'");
            }
            //员工编号
            if (!string.IsNullOrWhiteSpace(query.userno))
            {
                sqlWhere.Append($" and su.no='{query.userno}'");
            }
            //拍卖编号
            if (!string.IsNullOrWhiteSpace(query.auctionno))
            {
                sqlWhere.Append($" and b.no='{query.auctionno}'");
            }
            //状态
            if (query.status.HasValue)
            {
                sqlWhere.Append($" and a.status={query.status}");
            }
            //业务员
            if (!string.IsNullOrWhiteSpace(query.operatedid))
            {
                sqlWhere.Append($" and b.operatedid='{query.operatedid}'");
            }
            //里程数
            if (query.minmileage.HasValue)
            {
                sqlWhere.Append($" and c.mileage>={query.minmileage}");
            }
            //里程数
            if (query.maxmileage.HasValue)
            {
                sqlWhere.Append($" and c.mileage<{query.maxmileage}");
            }
            //上牌时间
            if (query.register_date.HasValue)
            {
                sqlWhere.Append($" and YEAR(c.register_date)=YEAR('{query.register_date}')");
            }
            //城市
            if (query.cityid != null)
            {
                sqlWhere.Append($" and c.cityid={query.cityid}");
            }

            var model = new PagingModel(spName, tableName, fields, oldField, sqlWhere.ToString(), query.PageSize, query.PageIndex);
            var list = Helper.ExecutePaging<AuctionCarParticipantViewModel>(model, query.Echo);
            return list;
        }
 public JResult GetAllAuctionParticipantList(AuctionCarParticipantQueryModel query)
 {
     return _auctionservice.GetAllAuctionParticipantList(query);
 }
        /// <summary>
        ///  获取所有竞拍记录
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public IEnumerable<AuctionCarParticipantViewModel> GetAllAuctionParticipantList(AuctionCarParticipantQueryModel query)
        {
            var sql = new StringBuilder("select * from auction_participant as a ");

            var sqlWhere = new StringBuilder(" where 1=1");
            if (query != null)
            {
                if (!string.IsNullOrWhiteSpace(query.Auctionid))
                {
                    sqlWhere.Append($" and a.auctionid='{query.Auctionid}'");
                }

                if (!string.IsNullOrWhiteSpace(query.Mobile))
                {
                    sqlWhere.Append($" and a.mobile='{query.Mobile}'");
                }
            }
            sql.Append(sqlWhere.ToString());
            sql.Append(" order by createdtime desc; ");
            try
            {
                var list = Helper.Query<AuctionCarParticipantViewModel>(sql.ToString());
                return list;
            }
            catch (Exception ex)
            {
                LoggerFactories.CreateLogger().Write("获取竞拍记录:", TraceEventType.Information, ex);
                return null;
            }
        }