当前位置: 首页>>代码示例>>Java>>正文


Java EntityWrapper.setSqlSelect方法代码示例

本文整理汇总了Java中com.baomidou.mybatisplus.mapper.EntityWrapper.setSqlSelect方法的典型用法代码示例。如果您正苦于以下问题:Java EntityWrapper.setSqlSelect方法的具体用法?Java EntityWrapper.setSqlSelect怎么用?Java EntityWrapper.setSqlSelect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.baomidou.mybatisplus.mapper.EntityWrapper的用法示例。


在下文中一共展示了EntityWrapper.setSqlSelect方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSqlSelect

import com.baomidou.mybatisplus.mapper.EntityWrapper; //导入方法依赖的package包/类
/**
 * 测试 sqlselect
 */
@Test
public void testSqlSelect() {
    EntityWrapper entityWrapper = new EntityWrapper();
    // entityWrapper.setSqlSelect(Column.create().column("col").as("name"),null,Column.create(),Column.create().as("11"),Column.create().column("col"));
    entityWrapper.setSqlSelect(Column.create().column("col").as("name"), null, Column.create(), Column.create().as("11"), Column.create().column("col"));
    System.out.println(entityWrapper.getSqlSelect());
    Assert.assertEquals("col AS name,col", entityWrapper.getSqlSelect());

}
 
开发者ID:Caratacus,项目名称:mybatis-plus-mini,代码行数:13,代码来源:EntityWrapperTest.java

示例2: testSelectSql4SelectMaps

import com.baomidou.mybatisplus.mapper.EntityWrapper; //导入方法依赖的package包/类
@Test
public void testSelectSql4SelectMaps() {
    EntityWrapper<H2User> ew = new EntityWrapper<>();
    ew.setSqlSelect("test_id, test_type");
    List<Map<String, Object>> list = userService.selectMaps(ew);
    for (Map<String, Object> map : list) {
        System.out.println(map);
        Object obj = map.get("TEST_DATE");
        if (obj != null) {
            System.out.println("TEST_DATE.class" + obj.getClass().getName());
        } else {
            obj = map.get("test_date");
            if (obj != null) {
                System.out.println("test_date.class" + obj.getClass().getName());
            } else {
                obj = map.get("testDate");
                if (obj != null) {
                    System.out.println("testDate.class" + obj.getClass().getName());
                } else {
                    obj = map.get("TESTDATE");
                    if (obj != null) {
                        System.out.println("TESTDATE.class" + obj.getClass().getName());
                    } else {
                        obj = map.get("testdate");
                        if (obj != null) {
                            System.out.println("testdate.class" + obj.getClass().getName());
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:baomidou,项目名称:mybatis-plus,代码行数:34,代码来源:H2MapUnderline2CamelTest.java

示例3: testSelectSqlNotMapping

import com.baomidou.mybatisplus.mapper.EntityWrapper; //导入方法依赖的package包/类
@Test
public void testSelectSqlNotMapping() {
    EntityWrapper<H2User> ew = new EntityWrapper<>();
    ew.setSqlSelect("test_id, test_type");
    List<H2User> list = userService.selectList(ew);
    for (H2User u : list) {
        System.out.println(JSONObject.toJSON(u));
        Assert.assertNull("test_id is not null, but should not mapping to id", u.getId());
        Assert.assertNotNull("test_type should be convert to testType", u.getTestType());
    }
}
 
开发者ID:baomidou,项目名称:mybatis-plus,代码行数:12,代码来源:H2MapUnderline2CamelTest.java

示例4: testEntityWrapperSelectSql

import com.baomidou.mybatisplus.mapper.EntityWrapper; //导入方法依赖的package包/类
@Test
public void testEntityWrapperSelectSql() {
    EntityWrapper<H2User> ew = new EntityWrapper<>();
    ew.setSqlSelect("test_id as id, name, age");
    List<H2User> list = userService.selectList(ew);
    for (H2User u : list) {
        Assert.assertNotNull(u.getId());
        Assert.assertNotNull(u.getName());
        Assert.assertNull(u.getPrice());
    }

}
 
开发者ID:baomidou,项目名称:mybatis-plus,代码行数:13,代码来源:H2UserTest.java

示例5: testSqlSelectStrings

import com.baomidou.mybatisplus.mapper.EntityWrapper; //导入方法依赖的package包/类
/**
 * 测试 sqlselect
 */
@Test
public void testSqlSelectStrings() {
    EntityWrapper entityWrapper = new EntityWrapper();
    entityWrapper.setSqlSelect("name", "age", "sex");
    System.out.println(entityWrapper.getSqlSelect());
    Assert.assertEquals("name,age,sex", entityWrapper.getSqlSelect());
}
 
开发者ID:baomidou,项目名称:mybatis-plus,代码行数:11,代码来源:EntityWrapperTest.java

示例6: testSqlSelect

import com.baomidou.mybatisplus.mapper.EntityWrapper; //导入方法依赖的package包/类
/**
 * 测试 sqlselect
 */
@Test
public void testSqlSelect() {
    EntityWrapper entityWrapper = new EntityWrapper();
    // entityWrapper.setSqlSelect(Column.create().column("col").as("name"),null,Column.create(),Column.create().as("11"),Column.create().column("col"));
    entityWrapper.setSqlSelect(Column.create().column("col").as("name"), null, Column.create(), Column.create().as("11"), Column.create().column("col"));
    System.out.println(entityWrapper.getSqlSelect());
    Assert.assertNotNull("col AS name,col", entityWrapper.getSqlSelect());

}
 
开发者ID:baomidou,项目名称:mybatis-plus,代码行数:13,代码来源:EntityWrapperTest.java

示例7: testSqlSelectColumns

import com.baomidou.mybatisplus.mapper.EntityWrapper; //导入方法依赖的package包/类
/**
 * 测试 sqlselect
 */
@Test
public void testSqlSelectColumns() {
    EntityWrapper entityWrapper = new EntityWrapper();
    Columns columns = Columns.create().column("name", "name1").column("age").column("sex", "sex1", false);
    entityWrapper.setSqlSelect(columns);
    System.out.println(entityWrapper.getSqlSelect());
    Assert.assertEquals("name AS name1,age,sex AS sex1", entityWrapper.getSqlSelect());
}
 
开发者ID:baomidou,项目名称:mybatis-plus,代码行数:12,代码来源:EntityWrapperTest.java


注:本文中的com.baomidou.mybatisplus.mapper.EntityWrapper.setSqlSelect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。