/* 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}
)
总结
对于面试,一定要有良好的心态,这位小伙伴面试美团的时候没有被前面阿里的面试影响到,发挥也很正常,也就能顺利拿下美团的offer。
小编还整理了大厂java程序员面试涉及到的绝大部分面试题及答案,希望能帮助到大家,
最后感谢大家的支持,希望小编整理的资料能够帮助到大家!也祝愿大家都能够升职加薪!
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}
)
总结
对于面试,一定要有良好的心态,这位小伙伴面试美团的时候没有被前面阿里的面试影响到,发挥也很正常,也就能顺利拿下美团的offer。
小编还整理了大厂java程序员面试涉及到的绝大部分面试题及答案,希望能帮助到大家,
[外链图片转存中…(img-8yMnqdRh-1721147765376)]
[外链图片转存中…(img-XXyJAtWa-1721147765377)]
最后感谢大家的支持,希望小编整理的资料能够帮助到大家!也祝愿大家都能够升职加薪!