用来描述select语句返回字段与java属性的映射关系。
可以有多个resultMap标签,用不同id区分不同标签。
可以实现一对多,多对多关系
–>
/* where 可以自动去除sql语句where关键字后的and关键字*/
/*
向sql传递数组或List, mybatis使用foreach解析,可以做批量处理。
collection:传入的集合的变量名称(要遍历的值)。
item:每次循环将循环出的数据放入这个变量中。
open:循环开始拼接的字符串。
close:循环结束拼接的字符串。
separator:循环中拼接的分隔符。
*/
/*
判断语句,test值等于true执行等于false跳过
test可以是一个值为Boolean型的计算语句
*/
/*
前缀’and’ 被’(’ 替换
prefix:前缀覆盖并增加其内容 不写的话默认替换为空
suffix:后缀覆盖并增加其内容 不写的话默认替换为空
prefixOverrides:前缀判断的条件
suffixOverrides:后缀判断的条件
*/
/*
choose 是或(or)的关系。
choose标签是按顺序判断其内部when标签中的test条件出否成立,如果有一个成立,则 choose 结束。
当 choose 中所有 when 的条件都不满则时,则执行 otherwise 中的sql。
类似于Java 的 switch 语句,choose 为 switch,when 为 case,otherwise 则为 default。
*/
and ${criterion.condition}
and ${criterion.condition} #{criterion.value}
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
and ${criterion.condition}
#{listItem}
and ${criterion.condition}
and ${criterion.condition} #{criterion.value}
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
and ${criterion.condition}
#{listItem}
id, name, logo, describe, is_enable, phone, admin, password, uuid
${fields}
select
distinct
/引入一个SQL模块/
from customer
order by ${orderByClause}
limit #{startRow} , #{pageSize}
select
id,name,logo,describe,is_enable,phone,admin,password,uuid
from customer
where id = #{id,jdbcType=INTEGER}
delete from customer
where id = #{id,jdbcType=INTEGER}
delete from customer
insert into customer (id, name, logo,
describe, is_enable, phone,
admin, password, uuid
)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{logo,jdbcType=VARCHAR},
#{describe,jdbcType=VARCHAR}, #{isEnable,jdbcType=BIT}, #{phone,jdbcType=VARCHAR},
#{admin,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{uuid,jdbcType=VARCHAR}
)
insert into customer
id,
name,
logo,
describe,
is_enable,
phone,
admin,
password,
uuid,
#{id,jdbcType=INTEGER},
#{name,jdbcType=VARCHAR},
#{logo,jdbcType=VARCHAR},
#{describe,jdbcType=VARCHAR},
#{isEnable,jdbcType=BIT},
#{phone,jdbcType=VARCHAR},
#{admin,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR},
#{uuid,jdbcType=VARCHAR},
select count(*) from customer
update customer
id = #{record.id,jdbcType=INTEGER},
name = #{record.name,jdbcType=VARCHAR},
logo = #{record.logo,jdbcType=VARCHAR},
describe = #{record.describe,jdbcType=VARCHAR},
is_enable = #{record.isEnable,jdbcType=BIT},
phone = #{record.phone,jdbcType=VARCHAR},
admin = #{record.admin,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR},
uuid = #{record.uuid,jdbcType=VARCHAR},
update customer
set id = #{record.id,jdbcType=INTEGER},
name = #{record.name,jdbcType=VARCHAR},
logo = #{record.logo,jdbcType=VARCHAR},
describe = #{record.describe,jdbcType=VARCHAR},
is_enable = #{record.isEnable,jdbcType=BIT},
phone = #{record.phone,jdbcType=VARCHAR},
admin = #{record.admin,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR},
uuid = #{record.uuid,jdbcType=VARCHAR}
update customer
name = #{name,jdbcType=VARCHAR},
logo = #{logo,jdbcType=VARCHAR},
describe = #{describe,jdbcType=VARCHAR},
is_enable = #{isEnable,jdbcType=BIT},
phone = #{phone,jdbcType=VARCHAR},
admin = #{admin,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
uuid = #{uuid,jdbcType=VARCHAR},
where id = #{id,jdbcType=INTEGER}
update customer
set name = #{name,jdbcType=VARCHAR},
logo = #{logo,jdbcType=VARCHAR},
describe = #{describe,jdbcType=VARCHAR},
is_enable = #{isEnable,jdbcType=BIT},
phone = #{phone,jdbcType=VARCHAR},
admin = #{admin,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
uuid = #{uuid,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
update customer
when #{item.id,jdbcType=INTEGER} then #{item.id,jdbcType=INTEGER}
when #{item.id,jdbcType=INTEGER} then customer.id
when #{item.id,jdbcType=INTEGER} then #{item.name,jdbcType=VARCHAR}
when #{item.id,jdbcType=INTEGER} then customer.name
when #{item.id,jdbcType=INTEGER} then #{item.logo,jdbcType=VARCHAR}
when #{item.id,jdbcType=INTEGER} then customer.logo
when #{item.id,jdbcType=INTEGER} then #{item.describe,jdbcType=VARCHAR}
when #{item.id,jdbcType=INTEGER} then customer.describe
when #{item.id,jdbcType=INTEGER} then #{item.isEnable,jdbcType=BIT}
when #{item.id,jdbcType=INTEGER} then customer.is_enable
when #{item.id,jdbcType=INTEGER} then #{item.phone,jdbcType=VARCHAR}
when #{item.id,jdbcType=INTEGER} then customer.phone
when #{item.id,jdbcType=INTEGER} then #{item.admin,jdbcType=VARCHAR}
when #{item.id,jdbcType=INTEGER} then customer.admin
when #{item.id,jdbcType=INTEGER} then #{item.password,jdbcType=VARCHAR}
when #{item.id,jdbcType=INTEGER} then customer.password
when #{item.id,jdbcType=INTEGER} then #{item.uuid,jdbcType=VARCHAR}
when #{item.id,jdbcType=INTEGER} then customer.uuid
where id in(
#{item.id,jdbcType=INTEGER}
)
insert into customer (id,
name, logo, describe,
is_enable, phone, admin,
password, uuid)
values (#{item.id,jdbcType=INTEGER},
#{item.name,jdbcType=VARCHAR}, #{item.logo,jdbcType=VARCHAR}, #{item.describe,jdbcType=VARCHAR},
#{item.isEnable,jdbcType=BIT}, #{item.phone,jdbcType=VARCHAR}, #{item.admin,jdbcType=VARCHAR},
#{item.password,jdbcType=VARCHAR}, #{item.uuid,jdbcType=VARCHAR})
delete from customer where id in (
#{id}
)
最后
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数Java工程师,想要提升技能,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。
因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,不论你是刚入门Java开发的新手,还是希望在技术上不断提升的资深开发者,这些资料都将为你打开新的学习之门!
如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
e=VARCHAR},
#{item.password,jdbcType=VARCHAR}, #{item.uuid,jdbcType=VARCHAR})
delete from customer where id in (
#{id}
)
最后
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数Java工程师,想要提升技能,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。
因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
[外链图片转存中…(img-ZXhASK68-1715831678621)]
[外链图片转存中…(img-9r8yRBrp-1715831678621)]
[外链图片转存中…(img-Kf73vCxw-1715831678622)]
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,不论你是刚入门Java开发的新手,还是希望在技术上不断提升的资深开发者,这些资料都将为你打开新的学习之门!
如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!