总结
无论是哪家公司,都很重视高并发高可用的技术,重视基础,重视JVM。面试是一个双向选择的过程,不要抱着畏惧的心态去面试,不利于自己的发挥。同时看中的应该不止薪资,还要看你是不是真的喜欢这家公司,是不是能真的得到锻炼。其实我写了这么多,只是我自己的总结,并不一定适用于所有人,相信经过一些面试,大家都会有这些感触。
最后我整理了一些面试真题资料,技术知识点剖析教程,还有和广大同仁一起交流学习共同进步,还有一些职业经验的分享。
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lqf.crud.bean.crm.User;
import com.lqf.crud.dao.crm.UserMapper;
import com.sun.org.apache.xerces.internal.util.EntityResolverWrapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.jsf.el.WebApplicationContextFacesELResolver;
import javax.naming.Name;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RunWith(SpringRunner.class)
@SpringBootTest
public class QueryWrapperTests {
@Autowired
private UserMapper mapper;
/**
-
-
根据根据 entity 条件,删除记录,QueryWrapper实体对象封装操作类(可以为 null)
-
下方获取到queryWrapper后删除的查询条件为name字段为null的and年龄大于等于12的and email字段不为null的
-
同理写法条件添加的方式就不做过多介绍了。
*/
@Test
public void delete() {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper
.isNull(“name”)
.ge(“age”, 12)
.isNotNull(“email”);
int delete = mapper.delete(queryWrapper);
System.out.println("delete return count = " + delete);
}
/**
-
-
根据 entity 条件,查询一条记录,
-
这里和上方删除构造条件一样,只是seletOne返回的是一条实体记录,当出现多条时会报错
*/
@Test
public void selectOne() {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq(“name”, “lqf”);
User user = mapper.selectOne(queryWrapper);
System.out.println(user);
}
/**
-
-
根据 Wrapper 条件,查询总记录数
-
@param queryWrapper 实体对象
*/
@Test
public void selectCount() {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq(“name”, “lqf”);
Integer count = mapper.selectCount(queryWrapper);
System.out.println(count);
}
/**
-
-
根据 entity 条件,查询全部记录
-
@param queryWrapper 实体对象封装操作类(可以为 null)为null查询全部
*/
@Test
public void selectList() {
List list = mapper.selectList(null);
System.out.println(list);
}
/**
-
-
根据 Wrapper 条件,查询全部记录
-
@param queryWrapper 实体对象封装操作类(可以为 null)
*/
@Test
public void selectMaps() {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.isNotNull(“name”);
List<Map<String, Object>> maps = mapper.selectMaps(queryWrapper);
for (Map<String, Object> map : maps) {
System.out.println(map);
}
}
/**
-
打印结果
-
{name=lqf, id=1046282328366391406, age=12, email=lqf@163.com, status=false}
-
{name=lqf, id=1046282328366391407, age=12, email=lqf@163.com, status=false}
-
{name=lqf, id=1046282328366391408, age=12, email=lqf@163.com, status=false}
-
{name=lqf, id=1046282328366391409, age=12, email=lqf@163.com, status=false}
-
{name=lqf, id=1046282328366391410, age=12, email=lqf@163.com, status=false}
-
{name=lqf, id=1046282328366391411, age=12, email=lqf@163.com, status=false}
-
{name=lqf, id=1046282328366391412, age=12, email=lqf@163.com, status=false}
-
{name=lqf, id=1046282328366391413, age=12, email=lqf@163.com, status=false}
-
{name=lqf, id=1046282328366391414, age=12, email=lqf@163.com, status=false}
-
{name=lqf, id=1046282328366391415, age=12, email=lqf@163.com, status=false}
-
{name=lqf, id=1046282328366391416, age=12, email=lqf@163.com, status=false}
-
{name=lqf, id=1046282328366391417, age=12, email=lqf@163.com, status=false}
-
{name=lqf, id=1046282328366391418, age=12, email=lqf@163.com, status=false}
-
json类型的键值对模式
*/
/**
-
-
根据 entity 条件,查询全部记录(并翻页)
-
@param page 分页查询条件(可以为 RowBounds.DEFAULT)
-
@param queryWrapper 实体对象封装操作类(可以为 null)
*/
@Test
public void selectPage() {
Page page = new Page<>(1, 5);
QueryWrapper queryWrapper = new QueryWrapper<>();
IPage userIPage = mapper.selectPage(page, queryWrapper);
System.out.println(userIPage);
}
/**
-
打印结果
-
==> Preparing: SELECT COUNT(1) FROM user
-
==> Parameters:
-
<== Columns: COUNT(1)
-
<== Row: 100
-
==> Preparing: SELECT id,name,age,email,status FROM user LIMIT 0,5
-
==> Parameters:
最后
如果觉得本文对你有帮助的话,不妨给我点个赞,关注一下吧!
如果觉得本文对你有帮助的话,不妨给我点个赞,关注一下吧!
[外链图片转存中…(img-1NUA52R0-1715457843209)]
[外链图片转存中…(img-8ZYU5MWf-1715457843211)]