-
Notifications
You must be signed in to change notification settings - Fork 865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PersistPoco基类对自定义查询实体返回结果显示了的问题 #68
Labels
question
Further information is requested
Comments
发一下你ListVM的代码看看 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using WTMTest.Models;
namespace WTMTest.ViewModels.SandSVMs
{
public partial class SandSListVM : BasePagedListVM<SandS_View, SandSSearcher>
{
protected override List<GridAction> InitGridAction()
{
return new List<GridAction>
{
this.MakeStandardAction("SandS", GridActionStandardTypesEnum.Details, "详细","", dialogWidth: 800),
this.MakeStandardAction("SandS", GridActionStandardTypesEnum.BatchDelete, "批量删除","", dialogWidth: 800),
this.MakeStandardExportAction(null,false,ExportEnum.Excel)
};
}
protected override IEnumerable<IGridColumn<SandS_View>> InitGridHeader()
{
return new List<GridColumn<SandS_View>>{
this.MakeGridHeader(x => x.SchoolCode),
this.MakeGridHeader(x => x.SchoolName),
this.MakeGridHeader(x => x.SchoolType),
this.MakeGridHeader(x => x.LoginName),
this.MakeGridHeader(x => x.Name),
this.MakeGridHeader(x => x.CellPhone),
this.MakeGridHeader(x => x.ZipCode),
this.MakeGridHeader(x => x.EnRollDate),
//this.MakeGridHeader(x => x.PhotoId).SetFormat(PhotoIdFormat),
this.MakeGridHeaderAction(width: 200)
};
}
private List<ColumnFormatInfo> PhotoIdFormat(SandS_View entity, object val)
{
return new List<ColumnFormatInfo>
{
//ColumnFormatInfo.MakeDownloadButton(ButtonTypesEnum.Button,entity.PhotoId),
//ColumnFormatInfo.MakeViewButton(ButtonTypesEnum.Button,entity.PhotoId,640,480),
};
}
public override IOrderedQueryable<SandS_View> GetSearchQuery()
{
var query = EntityHelper.GetEntityList<SandS>(DC.RunSQL("select a.ID,SchoolCode,SchoolName,SchoolType,[Name],[LoginName],[CellPhone],[ZipCode],[EnRollDate] From Students a left join schools b on a.SchoolId=b.id "));
var req = query.AsQueryable().CheckContain(Searcher.SchoolCode, x => x.SchoolCode)
.CheckContain(Searcher.SchoolName, x => x.SchoolName)
.CheckContain(Searcher.SchoolType, x => x.SchoolType)
.CheckContain(Searcher.LoginName, x => x.LoginName)
.CheckContain(Searcher.Name, x => x.Name)
.Select(x => new SandS_View
{
ID = x.ID,
SchoolCode = x.SchoolCode,
SchoolName = x.SchoolName,
SchoolType = x.SchoolType,
LoginName = x.LoginName,
Name = x.Name,
CellPhone = x.CellPhone,
ZipCode = x.ZipCode,
EnRollDate = x.EnRollDate,
})
.OrderBy(x => x.ID);
return req;
}
}
public class SandS_View : SandS{
}
}
…------------------ 原始邮件 ------------------
发件人: "liuliang-wt"<notifications@github.com>;
发送时间: 2019年9月18日(星期三) 晚上8:45
收件人: "dotnetcore/WTM"<WTM@noreply.github.com>;
抄送: "无名"<2044545827@QQ.COM>;"Author"<author@noreply.github.com>;
主题: Re: [dotnetcore/WTM] PersistPoco基类对自定义查询实体返回结果显示了的问题 (#68)
发一下你ListVM的代码看看
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
你这最后不是returen req么,也没returen query啊。。。 |
req 是query处理条件后得出来的呀
…------------------ 原始邮件 ------------------
发件人: "liuliang-wt"<notifications@github.com>;
发送时间: 2019年9月19日(星期四) 下午3:41
收件人: "dotnetcore/WTM"<WTM@noreply.github.com>;
抄送: "无名"<2044545827@QQ.COM>;"Author"<author@noreply.github.com>;
主题: Re: [dotnetcore/WTM] PersistPoco基类对自定义查询实体返回结果显示了的问题 (#68)
你这最后不是returen req么,也没returen query啊。。。
另外,虽然你这样写也可以,但是如果是sql语句或者存储过程,应该重写GetCommand方法,直接返回一个command,你可以参考文档中使用存储过程的部分
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
哦,你这个可能是因为如果GetSearchQuery的对象是一个PersistPoco,框架会自动在你返回的查询语句里面拼接一个where(x=>x.IsValid == true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
定义一个model继承PersistPoco后,时使用DC.RUSQL自定义查询,反回结果给LIST无效,提示无数据的问题
The text was updated successfully, but these errors were encountered: