接口名与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