5.0.1.01 BUG和需求提交入口 返回

SqlSugar 老数据
23 2100

禁止水贴                         

热忱回答23

  • 能否对sqlsugar进行拆包呢?比如我数据库只能MySQL,但引用Sqlsugar后,其他Oracle、Sqlite的包也都下载下来了

    0 回复
  • @某年某月 ,。某日: sqlsugarcorenodrive 就是无依赖版本 

    0 回复
  • 银 VIP0
    2020/11/2

    希望能增加多个queryable的关联查询

    0 回复
  • 王杰 王杰 VIP0
    2020/11/2

    数据库版本:mysql

    系统环境:linux

    本地测试没问题,linux上 执行sqlfunc.todate 转换的时间 不支持 mysql的查询 导致查询数据为空 

    linux上输出sql语句为

    微信截图_20201102160238.png


    上图这样查询出来的数据是0    正确应该是:

    微信图片_20201102160433.png


    代码本地测试没问题  就是linux 有问题  暂时不知道怎么解决 也不知道是否是sqlsugar bug

    0 回复
  • @王杰:你的代码怎么写的没走参数化吗?

    0 回复
  • @银:多个是几个啊!!

    0 回复
  • 王杰 王杰 VIP0
    2020/11/3

    1

    0 回复
  • 王杰 王杰 VIP0
    2020/11/3

    @fate stay night:有啊  代码这样写的

    微信截图_20201103085807.png

    0 回复
  • 银 VIP0
    2020/11/3

    @fate stay night:两个以上3个4个五个6个,统计的话会用到很多个的

    0 回复
  • @王杰:你试试在外面用C#转好了在传进来

    0 回复
  • 我看你这个是个字符串

    0 回复
  • 你好,我发现这边子查询生成的sql无法指定对应的表别名:

    代码截图:image.png


    生成的sql没有指定表别名:

    image.png

    0 回复
  • @On 々way

    1、提供什么数据库

    2、sqlsugar版本号

    3、具体哪个表达式解析出的问题你画了一圈

    0 回复
  • @fate stay night

    1. mysql数据库 

    2.  版本号:5.0.0.14 

    3. image.png


    0 回复
  • @On 々way:更新最新试试

    0 回复
  • @fate stay night:升级后一样,也是没指定到表别名。  

    image.png

    0 回复
  • @fate stay night:这是代码

    image.png


    0 回复
  • @On 々way:记下来了

    0 回复
  • Mr、谢 Mr、谢 VIP0
    2020/11/5

    postgresql数据类型为json的时候,连表查询json数据没转换出来,下面是demo

    using SqlSugar;

    using System;

    using System.Collections.Generic;


    namespace PgSqlTest

    {

        internal class Program

        {

            [SugarTable("User")]

            public class User

            {

                [SugarColumn(IsNullable = false, ColumnDataType = "uuid", IsPrimaryKey = true)]

                public Guid Id { get; set; }


                /// <summary>

                /// 部门名称

                /// </summary>

                [SugarColumn(IsNullable = false)]

                public string Name { get; set; }


                /// <summary>

                /// 用户部门

                /// </summary>

                [SugarColumn(IsNullable = false, IsJson = true, ColumnDataType = "json")]

                public List<Department> UserDpt { get; set; }

            }


            [SugarTable("User2")]

            public class User2

            {

                [SugarColumn(IsNullable = false, ColumnDataType = "uuid", IsPrimaryKey = true)]

                public Guid Id { get; set; }


                [SugarColumn(IsNullable = false, ColumnDataType = "uuid")]

                public Guid UserId { get; set; }

            }


            public class Department

            {

                public Guid Id { get; set; }

                public string Name { get; set; }

            }


            private static void Main(string[] args)

            {

                SqlSugarClient db = new SqlSugarClient(

                 new ConnectionConfig()

                 {

                     ConnectionString = "*",

                     DbType = DbType.PostgreSQL,//设置数据库类型

                     IsAutoCloseConnection = true,//自动释放数据务,如果存在事务,在事务结束后释放

                     InitKeyType = InitKeyType.Attribute //从实体特性中读取主键自增列信息

                 });

                db.Aop.OnError = (exp) =>//SQL报错

                {

                    string sql = exp.Sql;

                    //exp.sql 这样可以拿到错误SQL

                };

                //db.DbMaintenance.CreateDatabase();

                db.CodeFirst.InitTables(typeof(User), typeof(User2));

                List<Department> departments = new List<Department>();

                departments.Add(new Department { Id = Guid.NewGuid(), Name = "研发部" });

                departments.Add(new Department { Id = Guid.NewGuid(), Name = "市场部" });

                Guid userId = Guid.NewGuid();

                User user = new User

                {

                    Id = userId,

                    Name = "张三",

                    UserDpt = departments

                };

                db.Insertable(user).ExecuteCommand();

                User2 user2 = new User2();

                user2.Id = Guid.NewGuid();

                user2.UserId = userId;


                db.Insertable(user2).ExecuteCommand();

                var data = db.Queryable<User, User2>((a, b) => new object[] { JoinType.Inner, a.Id == b.UserId })

                    .Where((a, b) => a.Id == userId)

                    .Select((a, b) => new

                    {

                        User = a,

                        Items = a.UserDpt

                    }).ToList();

                Console.ReadKey();

            }

        }

    }



    0 回复
  • @Mr、谢:下个版本修复

    0 回复
  • Bless Bless VIP0
    2020/11/10

    无实体的查询  AS关键字和Union All 冲突,会报 “对象名'XXX'无效” 5.0.1.0版本

    之前版本好像无此问题,但是Oracle环境下ToPageList分页有问题


    0 回复
  • @Bless:上代码

    0 回复
  • Mr、谢 Mr、谢 VIP0
    2020/11/11

    @fate stay night:大佬,还是有问题啊

    image.png

    这个里面的json对象集合还是空的

    0 回复