【Lazy ORM】查询部分字段减少IO

Gitee
版本信息 1.2.2-JDK17-SNAPSHOT
    @Test
    public void  selectNameIdAge(){
        LazyUserTest userNameIdAge = lazyLambdaStream.selectOne(LazyWrappers.<LazyUserTest>lambdaWrapper()
                        .eq(LazyUserTest::getId, 1)
                        .eq(LazyUserTest::getIsDeleted, false)
                        .onlyUseAs()

                        .as(LazyUserTest::getId,LazyUserTest::getId)
                        .as(LazyUserTest::getAge,LazyUserTest::getAge)
                        .as(LazyUserTest::getUsername,LazyUserTest::getUsername)
                ,
                LazyUserTest.class);
        // SELECT  lazy_user_test.id as id , lazy_user_test.username as username , lazy_user_test.age as age  from lazy_user_test where  lazy_user_test.id  = 1  and  lazy_user_test.is_deleted  = false  and  lazy_user_test.is_deleted  = false
        System.out.println("只查询用户ID为1 的用户名称、ID、age:"+userNameIdAge);
    }

你可能感兴趣的:(Lazy,ORM,数据库)