Giter Site home page Giter Site logo

Comments (19)

DotNetNext avatar DotNetNext commented on September 28, 2024

加上Orderby 试一下

from sqlsugar.

DannyJyc avatar DannyJyc commented on September 28, 2024

image
image
加过OrderBy

from sqlsugar.

DotNetNext avatar DotNetNext commented on September 28, 2024

分页不可能出现问题的,你上面代码很多封装看不到最终结果 (例queryable多使用问题 :https://www.donet5.com/Home/Doc?typeId=2317 或者过滤器等都可能有影响)
所以先自个用空的模版自测
下面是提问模版按模版写一个可以重现的用Codefirst建表
https://www.donet5.com/Home/Doc?typeId=2366

from sqlsugar.

DotNetNext avatar DotNetNext commented on September 28, 2024

自测完如果有问题在提供你自测的代码

from sqlsugar.

DotNetNext avatar DotNetNext commented on September 28, 2024

image
还有这个方法不是自带的分页 orm自带的是topagelist不是topagedlist , 多了个d ,以文档为准按文写去写

from sqlsugar.

DannyJyc avatar DannyJyc commented on September 28, 2024

按照您的要求,我重新复现了一下问题。供您参考
image

from sqlsugar.

DotNetNext avatar DotNetNext commented on September 28, 2024

提供完整 能跑的,有加测试数据的,我能重现的DEMO,并且我能复制

from sqlsugar.

DannyJyc avatar DannyJyc commented on September 28, 2024

稍等,我将把最近一次发出来图片中的代码和相应数据库表建表和数据脚本发给您。

from sqlsugar.

DotNetNext avatar DotNetNext commented on September 28, 2024

image

from sqlsugar.

DannyJyc avatar DannyJyc commented on September 28, 2024

建表
`-- public.custom definition

-- Drop table

-- DROP TABLE public.custom;

CREATE TABLE public.custom (
id int8 NOT NULL, -- 主键Id
customname varchar(200) NOT NULL, -- 经销商名称
customcodesap varchar(50) NOT NULL, -- 经销商SAP编码
operationreason varchar(500) NULL DEFAULT NULL::character varying, -- 操作原因
status int4 NOT NULL, -- 经销商状态
rebateprogress varchar(255) NULL, -- 经销商返利进度
rebateorder int4 NOT NULL, -- 经销商返利顺序
createtime timestamp NULL, -- 创建时间
updatetime timestamp NULL, -- 更新时间
createuserid int8 NULL, -- 创建者Id
createusername varchar(64) NULL DEFAULT NULL::character varying, -- 创建者姓名
updateuserid int8 NULL, -- 修改者Id
updateusername varchar(64) NULL DEFAULT NULL::character varying, -- 修改者姓名
isdelete bool NOT NULL, -- 软删除
CONSTRAINT custom_pkey PRIMARY KEY (id)
);
CREATE INDEX index_custom_ct ON public.custom (createtime);
CREATE INDEX index_custom_custom ON public.custom (id);
COMMENT ON TABLE public.custom IS '下游经销商';

-- Column comments

COMMENT ON COLUMN public.custom.id IS '主键Id';
COMMENT ON COLUMN public.custom.customname IS '经销商名称';
COMMENT ON COLUMN public.custom.customcodesap IS '经销商SAP编码';
COMMENT ON COLUMN public.custom.operationreason IS '操作原因';
COMMENT ON COLUMN public.custom.status IS '经销商状态';
COMMENT ON COLUMN public.custom.rebateprogress IS '经销商返利进度';
COMMENT ON COLUMN public.custom.rebateorder IS '经销商返利顺序';
COMMENT ON COLUMN public.custom.createtime IS '创建时间';
COMMENT ON COLUMN public.custom.updatetime IS '更新时间';
COMMENT ON COLUMN public.custom.createuserid IS '创建者Id';
COMMENT ON COLUMN public.custom.createusername IS '创建者姓名';
COMMENT ON COLUMN public.custom.updateuserid IS '修改者Id';
COMMENT ON COLUMN public.custom.updateusername IS '修改者姓名';
COMMENT ON COLUMN public.custom.isdelete IS '软删除';`

数据
INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(33822351086613, 'code b 2', '经销商q', NULL, 1, '0', 6, '2024-04-28 13:56:00.952', '2024-04-28 15:58:32.482', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(33822351086612,'code b 2', '经销商q', '5555', 1, '0', 0, '2024-04-28 13:56:00.952', '2024-05-15 15:29:37.290', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(33822351086616,'code b 2', '经销商k', NULL, 1, '0', 1, '2024-04-28 13:56:00.952', '2024-05-09 16:24:28.271', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(33822351086615,'code b j', '经销商j', NULL, 2, '0', 900, '2024-04-28 13:56:00.952', '2024-04-29 11:05:42.459', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(33822351086614,'code b j', '经销商j', NULL, 2, '0', 800, '2024-04-28 13:56:00.952', '2024-04-29 11:05:42.459', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34067198032137, 'test02-11', 'test02-11', '', 1, NULL, 0, '2024-05-09 15:36:34.333', '2024-05-22 13:26:48.571', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34067198032136, 'test02-10', 'test02-10', '2022_零售_test14_0014_Q4_第4批 Import', 2, NULL, 1, '2024-05-09 15:36:34.333', '2024-05-22 13:27:02.818', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34067198032135, 'test02-09', 'test02-09', '2022_零售_test14_0014_Q4_第4批 Import', 2, NULL, 0, '2024-05-09 15:36:34.333', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34067198032134, 'test02-08', 'test02-08', '2022_零售_test14_0014_Q4_第4批 Import', 2, NULL, 0, '2024-05-09 15:36:34.333', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34067198032133, 'test02-07', 'test02-07', '2022_零售_test14_0014_Q4_第4批 Import', 2, NULL, 0, '2024-05-09 15:36:34.333', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34067198031882, 'test02-06', 'test02-06', '2022_零售_test14_0014_Q4_第4批 Import', 2, NULL, 0, '2024-05-09 15:36:34.332', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34067198031881, 'test02-05', 'test02-05', '解冻01', 2, NULL, 3, '2024-05-09 15:36:34.332', '2024-05-09 15:51:57.468', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34067198031880, 'test02-04', 'test02-04', '', 2, NULL, 0, '2024-05-09 15:36:34.332', '2024-05-15 15:45:06.716', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34067198031879, 'test02-03', 'test02-03', 'test', 1, NULL, 2, '2024-05-09 15:36:34.332', '2024-05-09 16:36:33.612', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34067198031878, 'test02-02', 'test02-02', '2022_零售_test14_0014_Q4_第4批 Import', 2, NULL, 0, '2024-05-09 15:36:34.332', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34067198031877, 'test01-01', 'test01-01', '5555', 1, NULL, 0, '2024-05-09 15:36:34.332', '2024-05-15 15:29:37.290', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(33841791889925, 'code a 1', 'code b j', NULL, 2, NULL, 3, '2024-04-29 11:01:41.589', '2024-05-09 16:19:44.978', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(33841791890182, 'code a 2', 'code b 2', '', 1, NULL, 8, '2024-04-29 11:01:41.591', '2024-05-09 16:43:10.886', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(33841791890181, 'code a 2', 'code b 2', NULL, 2, NULL, 3, '2024-04-29 11:01:41.591', '2024-05-09 16:19:44.978', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34066596165127, 'ZJ0164S', 'ZJ0164S', '', 1, NULL, 0, '2024-05-09 14:57:23.290', '2024-05-20 13:49:41.714', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34067010898949, 'TestSubAZ004', 'TestSubASP003', '批量操作测试02', 1, NULL, 5, '2024-05-09 15:24:23.344', '2024-05-09 17:19:16.231', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34066972598023, 'TestSubAZ003', 'TestSubASP003', '批量操作测试02', 1, NULL, 4, '2024-05-09 15:21:53.731', '2024-05-09 16:25:34.257', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34066972598022, 'TestSubAZ002', 'TestSubASP002', NULL, 2, NULL, 4, '2024-05-09 15:21:53.731', '2024-05-09 16:25:34.257', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34066972598021, 'TestSubAZ001', 'TestSubASP001', NULL, 2, NULL, 4, '2024-05-09 15:21:53.731', '2024-05-09 16:25:34.257', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34105835550215, 'Signature', 'Signature', '2029_经销商_test new1_new1_Q3_第1批 Import', 2, NULL, 0, '2024-05-11 09:32:02.138', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34066596165129, 'GS1099S', 'GS1099S', '333', 2, NULL, 0, '2024-05-09 14:57:23.290', '2024-05-15 15:26:12.530', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34397479453765, 'FnT2dow0002', 'FnT2dow0002', '2024_飞鹰_飞鹰返利_飞鹰倍平返利_Q4_第1批 Import', 2, NULL, 0, '2024-05-24 13:59:16.136', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34397454861125, 'FnT2dow0001', 'FnT2dow0001', '2024_飞鹰_飞鹰返利_飞鹰倍平返利_Q4_第1批 Import', 2, NULL, 0, '2024-05-24 13:57:40.069', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34400002105669, 'Fn-T2dow0002', 'Fn-T2dow0002', '2024_飞鹰_飞鹰返利_飞鹰倍平返利_Q4_第3批 Import', 2, NULL, 0, '2024-05-24 16:43:30.245', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34400002105670,'Fn-T2dow0001', 'Fn-T2dow0001', '2024_飞鹰_飞鹰返利_飞鹰倍平返利_Q4_第3批 Import', 2, NULL, 0, '2024-05-24 16:43:30.245', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34066596165128,'FJ0001', 'FJ0001', '5555', 1, NULL, 0, '2024-05-09 14:57:23.290', '2024-05-15 15:29:37.289', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34105833888773, 'CNSDB007', 'CNSDB007', '2024_经销商_051102_test_Q2_第1批 Import', 2, NULL, 0, '2024-05-11 09:31:55.647', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(33822351086617, 'code b 2', 'CNSDA002', NULL, 1, '0', 1100, '2024-04-28 13:56:00.952', '2024-04-29 11:05:42.459', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34066596164869, 'BJ1478S', 'BJ1478S', '555', 2, NULL, 0, '2024-05-09 14:57:23.288', '2024-05-15 15:29:15.375', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34066596165125, 'BJ0079S', 'BJ0079S', '5555', 1, NULL, 0, '2024-05-09 14:57:23.290', '2024-05-15 15:29:37.290', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34066596165126, 'BJ0004', 'BJ0004', '', 1, NULL, 0, '2024-05-09 14:57:23.290', '2024-05-20 13:49:41.713', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(33822351086603, 'AHA577S', 'AHA577S', '222', 1, '0', 0, '2024-04-28 13:56:00.952', '2024-05-15 15:27:34.221', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(33822351086085, 'AH1435S', 'AH1435S', '', 1, '0', 0, '2024-04-28 13:56:00.946', '2024-05-15 15:45:51.012', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(33822351086600, 'AH0001', 'AH0001', '', 2, '0', 0, '2024-04-28 13:56:00.952', '2024-05-15 15:45:58.927', 1300000000101, '超级管理员', 1300000000101, '超级管理员', false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34105835550219, ' Modification', ' Modification', '2029_经销商_test new1_new1_Q3_第1批 Import', 2, NULL, 0, '2024-05-11 09:32:02.138', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34105835550218, '', '', '2029_经销商_test new1_new1_Q3_第1批 Import', 2, NULL, 0, '2024-05-11 09:32:02.138', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34105835550217, '', '', '2029_经销商_test new1_new1_Q3_第1批 Import', 2, NULL, 0, '2024-05-11 09:32:02.138', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34105835550216, '', '', '2029_经销商_test new1_new1_Q3_第1批 Import', 2, NULL, 0, '2024-05-11 09:32:02.138', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34105835550214, '', '', '2029_经销商_test new1_new1_Q3_第1批 Import', 2, NULL, 0, '2024-05-11 09:32:02.138', NULL, 1300000000101, '超级管理员', NULL, NULL, false); INSERT INTO public.custom (id, customname, customcodesap, operationreason, status, rebateprogress, rebateorder, createtime, updatetime, createuserid, createusername, updateuserid, updateusername, isdelete) VALUES(34105835550213, '', '', '2029_经销商_test new1_new1_Q3_第1批 Import', 2, NULL, 0, '2024-05-11 09:32:02.138', NULL, 1300000000101, '超级管理员', NULL, NULL, false);

实体
`///


/// 下游经销商
///

[SugarTable("Custom", "下游经销商")]
public class Custom
{
public long Id { get; set; }
///
/// 经销商名称
///

[SugarColumn(ColumnDescription = "经销商名称", Length = 200)]
[MaxLength(200)]
public string CustomName { get; set; }
///
/// 经销商SAP编码
///

[SugarColumn(ColumnDescription = "经销商SAP编码", Length = 50)]
[MaxLength(50)]
public string CustomCodeSAP { get; set; } = "";
///
/// 操作原因
///

[SugarColumn(ColumnDescription = "操作原因", Length = 500, IsNullable = true)]
[MaxLength(500)]
public string OperationReason { get; set; }
///
/// 经销商状态
///

[SugarColumn(ColumnDescription = "经销商状态")]
public int Status { get; set; }
///
/// 经销商返利进度
///

[SugarColumn(ColumnDescription = "经销商返利进度", IsNullable = true)]
public string RebateProgress { get; set; }
///
/// 经销商返利顺序
///

[SugarColumn(ColumnDescription = "经销商返利顺序")]
[MaxLength(200)]
public int RebateOrder { get; set; }
///
/// 创建时间
///

[SugarColumn(ColumnDescription = "创建时间", IsOnlyIgnoreUpdate = true)]
public virtual DateTime? CreateTime { get; set; }

/// <summary>
/// 更新时间
/// </summary>
[SugarColumn(ColumnDescription = "更新时间")]
public virtual DateTime? UpdateTime { get; set; }

/// <summary>
/// 创建者Id
/// </summary>
[SugarColumn(ColumnDescription = "创建者Id", IsOnlyIgnoreUpdate = true)]
public virtual long? CreateUserId { get; set; }

/// <summary>
/// 创建者姓名
/// </summary>
[SugarColumn(ColumnDescription = "创建者姓名", Length = 64, IsOnlyIgnoreUpdate = true)]
public virtual string? CreateUserName { get; set; }

/// <summary>
/// 修改者Id
/// </summary>
[SugarColumn(ColumnDescription = "修改者Id")]
public virtual long? UpdateUserId { get; set; }

/// <summary>
/// 修改者姓名
/// </summary>
[SugarColumn(ColumnDescription = "修改者姓名", Length = 64)]
public virtual string? UpdateUserName { get; set; }

/// <summary>
/// 软删除
/// </summary>
[SugarColumn(ColumnDescription = "软删除")]
public virtual bool IsDelete { get; set; } = false;
/// <summary>
/// 读取excel凭证(详情)
/// </summary>
[SugarColumn(IsIgnore = true)]
private Dictionary<int, string> ReadExcelParam
{
    get
    {
        Dictionary<int, string> keyValuePairs = new Dictionary<int, string>();
        keyValuePairs.Add(0, "CustomName");
        keyValuePairs.Add(2, "CustomCodeSAP");
        keyValuePairs.Add(3, "RebateOrder");
        return keyValuePairs;
    }
}
/// <summary>
/// 导出excel凭证
/// </summary>
[SugarColumn(IsIgnore = true)]
private Dictionary<string, string> ExportExcelParam
{
    get
    {
        Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
        keyValuePairs.Add("下游经销商", "CustomName");
        keyValuePairs.Add("下游经销商ASP Code", "CustomCodeSAP");
        keyValuePairs.Add("返利顺序", "RebateOrder");
        return keyValuePairs;
    }
}
public Dictionary<int, string> GetReadExcelParam()
{
    return ReadExcelParam;
}
public Dictionary<string, string> GetExportExcelParam()
{
    return ExportExcelParam;
}

}`

代码
var db = new SqlSugarScope(new SqlSugar.ConnectionConfig() { ConnectionString = "Host=;Port=;Username=;PASSWORD=;Database=;SSL Mode=Require;Trust Server Certificate=True;", DbType = DbType.PostgreSQL, IsAutoCloseConnection = true }); int total = 0; var list = db.Queryable<Custom>().ToList(); var listOrderBy = db.Queryable<Custom>().OrderBy(p => p.RebateOrder).ToList(); var listOrderByPageList = await db.Queryable<Custom>().OrderBy(p => p.RebateOrder).ToPageListAsync(1, 10,total); Console.WriteLine($"listOrderBy 第一个元素:{listOrderBy[0].CustomCodeSAP}"); Console.WriteLine($"listOrderByPageList 第一个元素:{listOrderByPageList[0].CustomCodeSAP}"); Console.ReadKey();

from sqlsugar.

DotNetNext avatar DotNetNext commented on September 28, 2024

你格式都乱的,你先跟踪一下SQL吧,看生成的SQL

from sqlsugar.

DotNetNext avatar DotNetNext commented on September 28, 2024

只要SQL是对的那就是对的

from sqlsugar.

DannyJyc avatar DannyJyc commented on September 28, 2024

如何跟踪sql

from sqlsugar.

DotNetNext avatar DotNetNext commented on September 28, 2024

image

from sqlsugar.

DannyJyc avatar DannyJyc commented on September 28, 2024

我去跟一下稍后给您反馈

from sqlsugar.

DotNetNext avatar DotNetNext commented on September 28, 2024
  db.Aop.OnLogExecuting = (s, p) =>
  {
      Console.WriteLine(s);//在查询前面打印
  };
  //Query
  //查询
  var userInfo2=db.Queryable<UserInfo001>()
      .OrderBy(it=>it.UserId)
      .ToPageListAsync(1,10,1).GetAwaiter().GetResult();

from sqlsugar.

DotNetNext avatar DotNetNext commented on September 28, 2024

还有检查一下你排序的ID是不是存在重复字段
image

from sqlsugar.

DannyJyc avatar DannyJyc commented on September 28, 2024

image
问题查到了
在codefirst生成并且创建完索引后如果在查询不带着建立过的索引字段进行排序的话就会出现分页后错乱的问题
image
现在我判断不出来这个应该是我们的漏洞还是
我用的https://github.com/MonkSoul/Furion的问题

from sqlsugar.

DotNetNext avatar DotNetNext commented on September 28, 2024

ORM只负责生成SQL,只SQL是对的那就不是ORM的事情

from sqlsugar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.