首页 > 其他分享 >常用mybatis语法

常用mybatis语法

时间:2023-04-25 15:45:41浏览次数:33  
标签:insert 常用 set name into 语法 user mybatis

接口名与SQL格式

List<String> selectByService(@Param("serviceCode") stringCode,@Param("serviceName") stringName);
<select id="selectByService" resultType="java.lang.String">

</select>

模糊查询

like concat('%',#{name},'%')

if条件

<if test=" serviceName==null or serviceName>'1'.toString() ">
</if>

对于'1'这种长度为1的字符串,要用toString方法转换

in语法

name in
<foreach collection="nameList" itme="name" index="index" open="(" close=")" separator=",">
  #{name}
</foreach>

更新语法

update table set name='123',age='11' where name='111'

插入语法

insert into user value(null, '张三', 1, 20, null, 1602295286);		//单条 省略字段名
insert into user(`status`, `create_time`) value(1, 1602295286);		//单条
insert into user(`nickname`, `status`) value('张大民', 1), ('小新', 0), ('小刚同学', 1);  //多条
insert into user set `nickname` = '大王', `status` = '0';              //set

标签:insert,常用,set,name,into,语法,user,mybatis
From: https://www.cnblogs.com/sjj123/p/17352805.html

相关文章

  • Windows CMD常用命令
    1.dir查看目录dir 2.route操作网络路由表双网卡下添加静态路由示例:(1)删除默认路由(0.0.0.0是指所有地址)routedelete0.0.0.0(2)添加内网静态路由routeadd10.37.0.0mask255.255.0.010.37.132.129-p注:它表示访问10.37.0.0网段的所有数据都要经过网关10.37.132......
  • linux中修改文件常用vim命令
    linux中修改文件常用vim命令个人博客地址:https://note.raokun.top拥抱ChatGPT,国内访问网站:https://www.playchat.top按键作用含义i在当前字符前插入(记忆:insert)I在光标所在行的行首插入a在当前字符后插入(记忆:afterinsert)A在光标所在行的行尾插入......
  • [软件下载] 常用软件安装包链接-阿里云盘
    1、Typora导出文件安装包Pandoc2、JDK1.53、JDK174、redis客户端工具RedisDesktopManager5、数据库链接工具DBeaver6、Typora带序列号破解7、ApiPost接口测试工具8、IDEA2021+破解工具 ......
  • CEPH 常用命令
    CEPH常用命令cephhealthdetail查看运行状况详细信息cephosddump查看osd映射信息cephquorum_status--formatjson-pretty查看Mon_quorum状态cephosdpoollsdetail查看pool类型cephosdpoolls查看所有的储存池radosdf查看pool详细信息cephosdpoolcre......
  • RHEL8常用命令-Linux就该这么学2
       首先介绍系统内核和Shell终端的关系与作用,然后介绍Bash解释器的4大优势并学习Linux命令的执行方法。经验丰富的运维人员能够通过合理地组合命令,来更精准地满足工作需求,还可以尽可能地降低系统资源消耗。   本章选出常用的数十个Linux命令,它们与系统工作......
  • 阮一峰 Flex 布局教程:语法篇
    网页布局(layout)是CSS的一个重点应用。布局的传统解决方案,基于盒状模型,依赖 display 属性+ position属性+ float属性。它对于那些特殊布局非常不方便,比如,垂直居中就不容易实现。2009年,W3C提出了一种新的方案----Flex布局,可以简便、完整、响应式地实现各种页面布局。......
  • 记录使用Layui中一些常用的api
    获取当前操作行数据varcols=[[{title:'操作',toolbar:'#option',align:'center',height:80,width:120,fixed:'right'}]]<scriptty......
  • Linux常用技巧(十三)
    1、点亮指定硬盘:定位,磁盘闪灯/opt/MegaRAID/MegaCli/MegaCli64-PdLocate-start-physdrv[E:S]-a0/opt/MegaRAID/MegaCli/MegaCli64-PdLocate-stop-physdrv[E:S]-a02、查看证书过期时间echo|openssls_client-servername${domain}-connect${domain}:4432>/dev/null|......
  • mybatis-plus只查询部分字段的两种方法
    方法1:只需要查询出name和phone两个字段:使用queryWrapper的select()方法指定要查询的字段publicListselectByWrapper1(){ QueryWrapperqueryWrapper=newQueryWrapper<>(); queryWrapper.select("username");//指定查询某字段 ListsysUsers=sysUserService.list(queryWr......
  • Virsh常用命令-v4-20210308_123613
    Virsh常用命令企业云平台产品中心共享知识库Exportedon03/08/2021TableofContentsVirsh是基于libvirt写的一个命令行工具,用来通过Virsh来对虚拟机的生命周期进行管理,以下是常用的一些Virsh命令:1、查看在运行的虚拟机virshlist2、查看创建的所有虚拟机virshlist--all3、启......