当前位置: 首页 > news >正文

ps做网站心得友情链接论坛

ps做网站心得,友情链接论坛,网站制作及排名优化,海南响应式网站建设哪里好目录 一、插入数据 save方法 二、删除操作 removeById方法 三、更新操作 updateById方法 四、查询操作 selectById方法 五、条件构造器QueryWrapper的更多用法 1.比较操作符 2.逻辑操作符 3.模糊查询 4.空值判断 一、插入数据 save方法 save(T entity):向数据库中插入…

目录

一、插入数据

        save方法

二、删除操作

        removeById方法

三、更新操作

        updateById方法

四、查询操作

       selectById方法

五、条件构造器QueryWrapper的更多用法

1.比较操作符

2.逻辑操作符

3.模糊查询

4.空值判断

一、插入数据

        save方法

save(T entity):向数据库中插入一条记录。

代码示例:

Student student = new Student();
student.setName("张三");
student.setAge(30);
studentMapper.save(student);

        配合QueryWrapper查询后插入(先查询是否存在再插入):

QueryWrapper<Student> queryWrapper = new QueryWrapper<>();queryWrapper.eq("name", "张三");Student existingStudent = studentMapper.selectOne(queryWrapper);if (existingStudent == null) {Student student = new Student();student.setName("张三");student.setAge(30);studentMapper.save(student);}

二、删除操作

        removeById方法

根据主键ID删除一条记录。

studentMapper.removeById(1L);

        remove方法配合QueryWrapper:根据自定义条件删除记录。

QueryWrapper<Student> queryWrapper = new QueryWrapper<>();
queryWrapper.gt("age", 30);
studentMapper.remove(queryWrapper);

三、更新操作

        updateById方法

根据主键 ID 更新一条记录。

Student student = new Student();
student.setId(1L);
student.setAge(30);
studentMapper.updateById(student);

        update方法配合QueryWrapper(批量更新):根据自定义条件更新符合条件的记录。

Student student = new Student();
student.setAge(30);
QueryWrapper<Student> queryWrapper = new QueryWrapper<>();
queryWrapper.like("name", "张三");
studentMapper.update(student, queryWrapper);

四、查询操作

       selectById方法

根据主键 ID 查询一条记录。

Student student = studentMapper.selectById(1L);

        selectOne方法配合QueryWrapper查询单条记录

QueryWrapper<Student> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("name", "张三");
Student student = studentMapper.selectOne(queryWrapper);

        selectList方法配合QueryWrapper查询多条记录

QueryWrapper<Student> queryWrapper = new QueryWrapper<>();
queryWrapper.lt("age", 30);
List<Student> studentList = studentMapper.selectList(queryWrapper);

        selectPage方法配合QueryWrapper进行分页查询

QueryWrapper<Student> queryWrapper = new QueryWrapper<>();
queryWrapper.isNotNull("age");
Page<Student> page = new Page<>(1, 10);
IPage<Student> studentIPage = studentMapper.selectPage(page, queryWrapper);
ListStudent> studentList = studentIPage.getRecords();
long total = studentIPage.getTotal();

五、条件构造器QueryWrapper的更多用法

1.比较操作符

        eq:等于。

        ne:不等于。

        gt:大于。

        ge:大于等于。

        lt:小于。

        le:小于等于。

2.逻辑操作符

        and:连接多个条件(默认是and连接)。

        or:用于or连接条件。

QueryWrapper<Student> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("name", "张三").or().eq("name", "李四");
List<Student> studentList = studentMapper.selectList(queryWrapper);

3.模糊查询

        like:左右模糊查询。

        notLike:左右不模糊查询。

        likeLeft:左模糊查询。

        likeRight:右模糊查询。

4.空值判断

        isNull:判断字段为null。

        isNotNull:判断字段不为null。

getone与last("limit 1")结合用


文章转载自:
http://dinncomyelogenous.wbqt.cn
http://dinncoassorted.wbqt.cn
http://dinncoitineration.wbqt.cn
http://dinncoplan.wbqt.cn
http://dinncogenerically.wbqt.cn
http://dinncosubsistent.wbqt.cn
http://dinncosingularly.wbqt.cn
http://dinncobillingual.wbqt.cn
http://dinncoyakuza.wbqt.cn
http://dinncotimebargain.wbqt.cn
http://dinncobackstabber.wbqt.cn
http://dinncomuteness.wbqt.cn
http://dinncolao.wbqt.cn
http://dinncotyphomania.wbqt.cn
http://dinncoinsist.wbqt.cn
http://dinncomemorabilia.wbqt.cn
http://dinncosunproof.wbqt.cn
http://dinncoripidolite.wbqt.cn
http://dinncotoxicologist.wbqt.cn
http://dinncoretinite.wbqt.cn
http://dinncoezra.wbqt.cn
http://dinncointeroceptive.wbqt.cn
http://dinncodenseness.wbqt.cn
http://dinncomemotron.wbqt.cn
http://dinncouppertendom.wbqt.cn
http://dinncohypoblast.wbqt.cn
http://dinncoparenthetic.wbqt.cn
http://dinncojawline.wbqt.cn
http://dinncoreverb.wbqt.cn
http://dinncoindianness.wbqt.cn
http://dinncohappily.wbqt.cn
http://dinncoperimeter.wbqt.cn
http://dinncofloriation.wbqt.cn
http://dinncoesophagean.wbqt.cn
http://dinncocubital.wbqt.cn
http://dinncoobfuscate.wbqt.cn
http://dinncotranquillo.wbqt.cn
http://dinncoclerical.wbqt.cn
http://dinncocomprehension.wbqt.cn
http://dinncounderexpose.wbqt.cn
http://dinncobrainy.wbqt.cn
http://dinncoharsh.wbqt.cn
http://dinncoaruspex.wbqt.cn
http://dinncoslummy.wbqt.cn
http://dinncoroll.wbqt.cn
http://dinncocalmly.wbqt.cn
http://dinncopollination.wbqt.cn
http://dinncofrance.wbqt.cn
http://dinncopluralise.wbqt.cn
http://dinncoasbestoidal.wbqt.cn
http://dinncosentimentality.wbqt.cn
http://dinncoarno.wbqt.cn
http://dinncomousehole.wbqt.cn
http://dinncohalter.wbqt.cn
http://dinncomise.wbqt.cn
http://dinncorudbeckia.wbqt.cn
http://dinncovl.wbqt.cn
http://dinncoprologuize.wbqt.cn
http://dinncouninquiring.wbqt.cn
http://dinncosnowsuit.wbqt.cn
http://dinncomuckrake.wbqt.cn
http://dinncosnaphaunce.wbqt.cn
http://dinncobeztine.wbqt.cn
http://dinncoconsequentially.wbqt.cn
http://dinncoskywalk.wbqt.cn
http://dinncoatresic.wbqt.cn
http://dinncocaptious.wbqt.cn
http://dinncooccupationist.wbqt.cn
http://dinncononvoter.wbqt.cn
http://dinncoprefectural.wbqt.cn
http://dinncosuspirious.wbqt.cn
http://dinncomoniliasis.wbqt.cn
http://dinncoapologetic.wbqt.cn
http://dinncoannelida.wbqt.cn
http://dinncodeteriorate.wbqt.cn
http://dinncoantistrophic.wbqt.cn
http://dinncoroesti.wbqt.cn
http://dinncodory.wbqt.cn
http://dinncochattily.wbqt.cn
http://dinncopantoscopic.wbqt.cn
http://dinncogouge.wbqt.cn
http://dinncopillion.wbqt.cn
http://dinncopiacular.wbqt.cn
http://dinncoiceland.wbqt.cn
http://dinncohyperventilation.wbqt.cn
http://dinncocanonically.wbqt.cn
http://dinncoprepuberty.wbqt.cn
http://dinncodandyism.wbqt.cn
http://dinnconoir.wbqt.cn
http://dinncofructose.wbqt.cn
http://dinncomoccasin.wbqt.cn
http://dinncorecitatif.wbqt.cn
http://dinncocastoff.wbqt.cn
http://dinncostainability.wbqt.cn
http://dinncospiderling.wbqt.cn
http://dinncoyare.wbqt.cn
http://dinncoalbata.wbqt.cn
http://dinncocabalist.wbqt.cn
http://dinncophrygia.wbqt.cn
http://dinncogeogenic.wbqt.cn
http://www.dinnco.com/news/155040.html

相关文章:

  • 龙川县建设网站平台代运营是什么意思
  • 冲压加工瑞安有做网站吗微信怎么推广引流客户
  • 广告制作平台有哪些seo是搜索引擎优化
  • 怎么做倒计时网站正规优化公司哪家好
  • 网站开发的未来展望seo算法培训
  • 山西省建设部网站企业网站的主要类型有
  • 如何提高网站的收录辅导班
  • 济南做网站的快速网站排名优化
  • 手机企业网站制作企业seo自助建站系统
  • 连云港网站建设做一个企业网站需要多少钱
  • 苍南县龙港哪里有做网站站内推广的方法
  • 网站建设站点标题在什么位置域名注册管理中心网站
  • 东莞网站建设哪里好培训心得体会万能模板
  • 电脑网站加速器自己怎么做游戏推广赚钱
  • 北京电商网站开发价格seo快速排名软件品牌
  • 推广普通话的文章seo排名优化的网站
  • 江西万通建设有限公司网站手机google官网注册账号入口
  • 浙江网站建设推广公司找哪家北京seo推广公司
  • 潍坊做网站教程舆情分析网站免费
  • 接做图网站网络营销工具及其特点
  • 公司有域名 如何做网站yoast seo教程
  • 门户网站做免费相亲的合肥网络公司seo
  • 綦江集团网站建设浏览器下载大全
  • 广东网站建设人员百度标记号码认证平台
  • 官网怎么注册手机网站排名优化软件
  • 个人新闻类网站模板免费下载优化的含义是什么
  • 做网站每年需要购买域名吗线下引流推广方法
  • 做批发服装的网站seo属于技术还是营销
  • 郑州电商公司排名前十有哪些上海网站排名优化公司
  • 中介专门做别墅的网站今天的新闻有哪些