《一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码》,点击传送门,即可获取!
用来描述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}
)
总结
总体来说,如果你想转行从事程序员的工作,Java开发一定可以作为你的第一选择。但是不管你选择什么编程语言,提升自己的硬件实力才是拿高薪的唯一手段。
如果你以这份学习路线来学习,你会有一个比较系统化的知识网络,也不至于把知识学习得很零散。我个人是完全不建议刚开始就看《Java编程思想》、《Java核心技术》这些书籍,看完你肯定会放弃学习。建议可以看一些视频来学习,当自己能上手再买这些书看又是非常有收获的事了。
《一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码》,点击传送门,即可获取!
x=“index” separator=“,” > (#{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}
)
总结
总体来说,如果你想转行从事程序员的工作,Java开发一定可以作为你的第一选择。但是不管你选择什么编程语言,提升自己的硬件实力才是拿高薪的唯一手段。
如果你以这份学习路线来学习,你会有一个比较系统化的知识网络,也不至于把知识学习得很零散。我个人是完全不建议刚开始就看《Java编程思想》、《Java核心技术》这些书籍,看完你肯定会放弃学习。建议可以看一些视频来学习,当自己能上手再买这些书看又是非常有收获的事了。
[外链图片转存中…(img-jz4IONGY-1714707441616)]
《一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码》,点击传送门,即可获取!