85 lines
2.4 KiB
C#
85 lines
2.4 KiB
C#
using BaseOUDAL;
|
|
using YLErp.Model;
|
|
|
|
namespace YLErp.Modules.MarginModule
|
|
{
|
|
public class MarginTemplateService : YLBaseService
|
|
{
|
|
public MarginTemplateService(OptUserInfo userInfo) : base(userInfo)
|
|
{
|
|
}
|
|
|
|
public MarginTemplateService(YLBaseService baseService) : base(baseService)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询margin_template列表
|
|
/// </summary>
|
|
public SearchListResult<margin_template> SearchTradeMarginList(margin_templateReq req)
|
|
{
|
|
var query = from margin_template in DbContext.margin_template
|
|
select margin_template;
|
|
|
|
if (!string.IsNullOrEmpty(req.Name))
|
|
{
|
|
query = query.Where(d => d.Name == req.Name);
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(req.sidx))
|
|
{
|
|
req.sidx = "id";
|
|
req.sord = "desc";
|
|
}
|
|
|
|
var retListResult = query.ToSearchList(req);
|
|
|
|
return retListResult;
|
|
}
|
|
|
|
public SearchListResult<margin_template_v2> SearchMarginTemplateV2List(margin_template_v2Req req)
|
|
{
|
|
var query = from margin_template_v2 in DbContext.margin_template_v2
|
|
select margin_template_v2;
|
|
|
|
if (!string.IsNullOrEmpty(req.Name))
|
|
{
|
|
query = query.Where(d => d.Name.Contains(req.Name));
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(req.TradeType))
|
|
{
|
|
query = query.Where(d => d.TradeTypes.Contains(req.TradeType));
|
|
}
|
|
|
|
if (req.RuleType != null)
|
|
{
|
|
query = query.Where(d => d.RuleType == req.RuleType.Value);
|
|
}
|
|
|
|
if (req.MarginType != null)
|
|
{
|
|
query = query.Where(d => d.MarginType == req.MarginType.Value);
|
|
}
|
|
|
|
if(req.IsValid.HasValue)
|
|
{
|
|
query = query.Where(d => d.IsValid == req.IsValid.Value);
|
|
}
|
|
|
|
query = query.Where(d => d.IsDefault == req.IsDefault);
|
|
query = query.Where(d => d.IsForClient == req.IsForClient);
|
|
|
|
if (string.IsNullOrEmpty(req.sidx))
|
|
{
|
|
req.sidx = "id";
|
|
req.sord = "desc";
|
|
}
|
|
|
|
var retListResult = query.ToSearchList(req);
|
|
|
|
return retListResult;
|
|
}
|
|
}
|
|
}
|