public IList <LotteryData> GetLotteryDatas(string lotteryType, int pageIndex, int pageSize, out int totalCount) { //var sqlStr1 = "SELECT * FROM dbo.LotteryDatas WHERE LotteryType =N'@LotteryType' ORDER BY Period"; var sqlStr1 = SqlParser.PageSql("dbo.LotteryDatas", "AND LotteryType =@LotteryType", "Id", "Period", pageSize, pageIndex, OrderType.Desc); var sqlStr2 = SqlParser.TotalCount("dbo.LotteryDatas", "AND LotteryType =@LotteryType"); using (var cn = LotteryDbConnection) { var list = cn.Query <LotteryData>(sqlStr1, new { LotteryType = lotteryType }).ToList(); totalCount = cn.ExecuteScalar <int>(sqlStr2, new { LotteryType = lotteryType }); return(list); } }