65 lines
2.5 KiB
C#
65 lines
2.5 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using WX.CRM.BLL.Util;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.IBLL.Wx;
|
|
using WX.CRM.Model.Entity;
|
|
using WX.CRM.Model.MAP;
|
|
|
|
namespace WX.CRM.BLL.Wx
|
|
{
|
|
public class WX_SZZYSUBPRODUCT_BL : DbContextRepository<WX_SZZYSUBPRODUCT>, IWX_SZZYSUBPRODUCT
|
|
{
|
|
public List<WX_SZZYSUBPRODUCT> GetList(decimal[] subProductIds)
|
|
{
|
|
using (var db = new crmContext())
|
|
{
|
|
var queryData = db.WX_SZZYSUBPRODUCT.AsQueryable();
|
|
if (subProductIds != null && subProductIds.Length > 0)
|
|
{
|
|
queryData = queryData.Where(m => subProductIds.Contains(m.SUBPRODUCTID)).OrderByDescending(m => m.SORT);
|
|
}
|
|
return queryData.ToList();
|
|
}
|
|
}
|
|
|
|
public WX_SZZYSUBPRODUCT GetModel(decimal subproductid)
|
|
{
|
|
using (var db = new crmContext())
|
|
{
|
|
return db.WX_SZZYSUBPRODUCT.FirstOrDefault(M => M.SUBPRODUCTID == subproductid);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public List<WX_SZZYSUBPRODUCT> GetList_SubProduct(ref Pager pager, Wx_SzzySubProduct_QueryDto query)
|
|
{
|
|
using (var db = new WX.CRM.Model.Entity.crmContext())
|
|
{
|
|
var queryData = db.WX_SZZYSUBPRODUCT.AsQueryable<WX.CRM.Model.Entity.WX_SZZYSUBPRODUCT>();
|
|
if (!string.IsNullOrWhiteSpace(query.productCode))
|
|
{
|
|
query.productCode = query.productCode.Trim();
|
|
queryData = queryData.Where(m => m.PRODUCTCODE == query.productCode);
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(query.productName))
|
|
{
|
|
query.productName = query.productName.Trim();
|
|
queryData = queryData.Where(m => m.SUBPRODUCTNAME.Contains(query.productName) || m.PRODUCTALIAS.Contains(query.productName));
|
|
}
|
|
if (query.isShow.HasValue)
|
|
{
|
|
queryData = queryData.Where(m => m.ISSHOW == query.isShow);
|
|
}
|
|
if (query.isVaild.HasValue)
|
|
{
|
|
queryData = queryData.Where(m => m.ISVALID == query.isVaild);
|
|
}
|
|
queryData = queryData.OrderByDescending(m => m.SUBPRODUCTID);
|
|
PagerUtil.SetPager<WX.CRM.Model.Entity.WX_SZZYSUBPRODUCT>(ref queryData, ref pager);//分页
|
|
return queryData.ToList();
|
|
}
|
|
}
|
|
}
|
|
} |