Mybatis-Plus 实战完整学习笔记(十)------条件构造器核心用法大全(下)
31、升序orderByAsc
1 31、升序orderByAsc 2 3 List<Employee> employeeList = employeeMapper.selectList(new QueryWrapper<Employee>().orderByAsc(true,"age")); 4 5 6 7 if (!employeeList.isEmpty()) { 8 logger.info("++条件构造器查询员工信息+++++" + gson.toJson(employeeList)); 9 }
32、降序orderByDesc
1 32、降序orderByDesc 2 List<Employee> employeeList = employeeMapper.selectList(new QueryWrapper<Employee>().orderByDesc(true,"age")); 3 4 5 if (!employeeList.isEmpty()) { 6 logger.info("++条件构造器查询员工信息+++++" + gson.toJson(employeeList)); 7 }
33、回显字段设置
1 33、回显字段设置 2 // SELECT last_Name,email FROM tbl_employee 3 List<Employee> employeeList = employeeMapper.selectList(new QueryWrapper<Employee>().select("last_Name,email")); 4 5 6 7 8 9 if (!employeeList.isEmpty()) { 10 logger.info("++条件构造器查询员工信息+++++" + gson.toJson(employeeList)); 11 }
十年磨一剑,一剑破万法