using CRM.Core.DAL; using CRM.Core.Model; using MySql.Data.MySqlClient; using System; using System.Collections.Generic; using System.Data; namespace CRM.Core.BLL.Wx { public class Wx_SzzyOrderModuleRefund_BL : AuditContextRepository { public List GetRefund(DateTime ftime) { var sql = @" select CONVERT(DATE_FORMAT(f.refunddate,'%Y%m'), SIGNED INTEGER) fmonth,sum(f.refundprice) refundprice from wx_szzyordermodulerefund f where f.refunddate < @arg_ftime group by DATE_FORMAT(f.refunddate,'%Y%m')"; var param = new List { new MySqlParameter { ParameterName = "arg_ftime", DbType = DbType.DateTime, Value = ftime } }; var ds = MySqlDbHelper.DataQueray(ConStringHelper.AuditConn, System.Data.CommandType.Text, sql, param.ToArray()); //return ds.Tables[0].ToList(); var list = new List(); foreach (DataRow row in ds.Tables[0].Rows) { list.Add(new RefundDto() { fMonth = Convert.ToInt32(row[0]), refundPrice = Convert.ToDecimal(row[1]) }); } return list; } public class RefundDto { public int fMonth { get; set; } public decimal refundPrice { get; set; } } } }