第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

MyBatis-Plus入門

難度高級
時長 4小時 0分
學(xué)習(xí)人數(shù)
綜合評分9.57
102人評價 查看評價
9.7 內(nèi)容實用
9.4 簡潔易懂
9.6 邏輯清晰
  • http://img1.sycdn.imooc.com//5e26953d0001d62106550250.jpg

    http://img1.sycdn.imooc.com//5e269597000140f506890318.jpg13333333333333333

    查看全部
  • selectByMap()

    http://img1.sycdn.imooc.com//5e2692da0001ce2604350173.jpg

    查看全部
    0 采集 收起 來源:普通查詢

    2020-01-21

  • selectBatchIds(@Param(Constants.COLLECTION)Collection<? extends Serializable> idList);
    根據(jù)id集合獲取對象集合list
    Arrays.asList(id1,id2)

    將list集合參數(shù)進行forEach輸出:
    userList.forEach(System.out::println);

    查看全部
    0 采集 收起 來源:普通查詢

    2020-01-21

  • selectById(...id) 根據(jù)主鍵獲取實體

    查看全部
    0 采集 收起 來源:普通查詢

    2020-01-21

  • @TableField(exist=false)? //exist=false表示數(shù)據(jù)庫字段并無該屬性
    private String remark;

    查看全部
  • @Transient 注解的實體類字段不參數(shù)序列化過程

    查看全部
  • 其它字段指定數(shù)據(jù)庫中對應(yīng)名稱
    @TableField("name")//數(shù)據(jù)庫中叫name
    private String realName;

    查看全部
    0 采集 收起 來源:常用注解

    2020-01-21

  • @TableId 注解到實體類的表id字段 可以取代表中id主鍵不叫id的別名的
    對應(yīng)駝峰寫法 如 實體類 memberId, 表中 member_id

    查看全部
    0 采集 收起 來源:常用注解

    2020-01-21

  • @TableName 在實體類執(zhí)行表名 別名

    查看全部
    0 采集 收起 來源:常用注解

    2020-01-21

  • zzzccc
    查看全部
    0 采集 收起 來源:分頁查詢

    2020-01-15

  • asdasdagasdfgadf
    查看全部
    0 采集 收起 來源:分頁查詢

    2020-01-15

  • asdasda

    查看全部
    0 采集 收起 來源:分頁查詢

    2020-01-15

  • package?com.mp;
    
    import?com.baomidou.mybatisplus.core.conditions.Wrapper;
    import?com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
    import?com.baomidou.mybatisplus.core.toolkit.Wrappers;
    import?com.mp.dao.UserMapper;
    import?com.mp.entity.User;
    import?org.junit.Test;
    import?org.junit.runner.RunWith;
    import?org.springframework.beans.factory.annotation.Autowired;
    import?org.springframework.boot.test.context.SpringBootTest;
    import?org.springframework.test.context.junit4.SpringRunner;
    
    import?java.util.Arrays;
    import?java.util.HashMap;
    import?java.util.List;
    import?java.util.Map;
    
    /**
    ?*?@Description
    ?*?@auther?mohuani
    ?*?@create?2019-12-25?11:37
    ?*/
    @RunWith(SpringRunner.class)
    @SpringBootTest
    public?class?RetrieveTest?{
    
    ????@Autowired
    ????private?UserMapper?userMapper;
    
    ????@Test
    ????public?void?selectById()?{
    ????????User?user?=?userMapper.selectById(1088250446457389058L);
    ????????System.out.println(user);
    ????}
    
    ????@Test
    ????public?void?selectBatchIds()?{
    ????????List<Long>?list?=?Arrays.asList(1088248166370832385L,?1094590409767661570L,?1209509417456001025L);
    ????????List<User>?userList?=?userMapper.selectBatchIds(list);
    ????????userList.forEach(System.out::println);
    ????}
    
    ????@Test
    ????public?void?selectByMap()?{
    ????????Map<String,?Object>?columnMap?=?new?HashMap<>();
    ????????columnMap.put("name",?"李藝偉");
    ????????columnMap.put("age",?28);
    ????????List<User>?userList?=?userMapper.selectByMap(columnMap);
    ????????userList.forEach(System.out::println);
    ????}
    
    ????/**
    ?????*?1、名字中包含雨并且年齡小于40
    ?????*?????name?like?'%雨%'?and?age<40
    ?????*/
    ????@Test
    ????public?void?selectByWrapper()?{
    ????????QueryWrapper<User>?queryWrapper?=?new?QueryWrapper<>();
    ????????queryWrapper.like("name",?"雨").lt("age",?40);
    
    ????????List<User>?userList?=?userMapper.selectList(queryWrapper);
    ????????userList.forEach(System.out::println);
    ????}
    
    ????/**
    ?????*?2、名字中包含雨年并且齡大于等于20且小于等于40并且email不為空
    ?????*????name?like?'%雨%'?and?age?between?20?and?40?and?email?is?not?null
    ?????*/
    ????@Test
    ????public?void?selectByWrapper2()?{
    ????????QueryWrapper<User>?queryWrapper?=?new?QueryWrapper<>();
    ????????queryWrapper.like("name",?"雨").between("age"?,20?,40).isNotNull("email");
    
    ????????List<User>?userList?=?userMapper.selectList(queryWrapper);
    ????????userList.forEach(System.out::println);
    ????}
    
    ????/**
    ?????*?3、名字為王姓或者年齡大于等于25,按照年齡降序排列,年齡相同按照id升序排列
    ?????*????name?like?'王%'?or?age>=25?order?by?age?desc,id?asc
    ?????*/
    ????@Test
    ????public?void?selectByWrapper3()?{
    ????????QueryWrapper<User>?queryWrapper?=?new?QueryWrapper<>();
    ????????queryWrapper.likeRight("name",?"王").or().gt("age",?25).orderByDesc("age").orderByAsc("id");
    
    ????????List<User>?userList?=?userMapper.selectList(queryWrapper);
    ????????userList.forEach(System.out::println);
    ????}
    }


    查看全部
  • 一、查詢需求

    1、名字中包含雨并且年齡小于40

    ?????? name like '%雨%' and age<40

    2、名字中包含雨年并且齡大于等于20且小于等于40并且email不為空

    ?? name like '%雨%' and age between 20 and 40 and email is not null

    3、名字為王姓或者年齡大于等于25,按照年齡降序排列,年齡相同按照id升序排列

    ?? name like '王%' or age>=25 order by age desc,id asc

    4、創(chuàng)建日期為2019年2月14日并且直屬上級為名字為王姓

    ????? date_format(create_time,'%Y-%m-%d')='2019-02-14' and manager_id in (select id from user where name like '王%')

    5、名字為王姓并且(年齡小于40或郵箱不為空)

    ??? name like '王%' and (age<40 or email is not null)

    6、名字為王姓或者(年齡小于40并且年齡大于20并且郵箱不為空)

    ??? name like '王%' or (age<40 and age>20 and email is not null)

    7、(年齡小于40或郵箱不為空)并且名字為王姓

    ??? (age<40 or email is not null) and name like '王%'

    8、年齡為30、31、34、35

    ??? age in (30、31、34、35)?

    9、只返回滿足條件的其中一條語句即可

    limit 1

    二、select中字段不全部出現(xiàn)的查詢

    10、名字中包含雨并且年齡小于40(需求1加強版)

    第一種情況:select id,name

    ?????? ?????????? from user

    ?????? ?????????? where name like '%雨%' and age<40

    第二種情況:select id,name,age,email

    ?????? ?????????? from user

    ?????? ?????????? where name like '%雨%' and age<40

    三、統(tǒng)計查詢:

    11、按照直屬上級分組,查詢每組的平均年齡、最大年齡、最小年齡。

    并且只取年齡總和小于500的組。

    select avg(age) avg_age,min(age) min_age,max(age) max_age

    from user

    group by manager_id

    having sum(age) <500


    查看全部
  • 一、查詢需求

    1、名字中包含雨并且年齡小于40

    ?????? name like '%雨%' and age<40

    2、名字中包含雨年并且齡大于等于20且小于等于40并且email不為空

    ?? name like '%雨%' and age between 20 and 40 and email is not null

    3、名字為王姓或者年齡大于等于25,按照年齡降序排列,年齡相同按照id升序排列

    ?? name like '王%' or age>=25 order by age desc,id asc

    4、創(chuàng)建日期為2019年2月14日并且直屬上級為名字為王姓

    ????? date_format(create_time,'%Y-%m-%d')='2019-02-14' and manager_id in (select id from user where name like '王%')

    5、名字為王姓并且(年齡小于40或郵箱不為空)

    ??? name like '王%' and (age<40 or email is not null)

    6、名字為王姓或者(年齡小于40并且年齡大于20并且郵箱不為空)

    ??? name like '王%' or (age<40 and age>20 and email is not null)

    7、(年齡小于40或郵箱不為空)并且名字為王姓

    ??? (age<40 or email is not null) and name like '王%'

    8、年齡為30、31、34、35

    ??? age in (30、31、34、35)?

    9、只返回滿足條件的其中一條語句即可

    limit 1

    二、select中字段不全部出現(xiàn)的查詢

    10、名字中包含雨并且年齡小于40(需求1加強版)

    第一種情況:select id,name

    ?????? ?????????? from user

    ?????? ?????????? where name like '%雨%' and age<40

    第二種情況:select id,name,age,email

    ?????? ?????????? from user

    ?????? ?????????? where name like '%雨%' and age<40

    三、統(tǒng)計查詢:

    11、按照直屬上級分組,查詢每組的平均年齡、最大年齡、最小年齡。

    并且只取年齡總和小于500的組。

    select avg(age) avg_age,min(age) min_age,max(age) max_age

    from user

    group by manager_id

    having sum(age) <500


    查看全部

舉報

0/150
提交
取消
課程須知
1、有Java開發(fā)基礎(chǔ),了解Lambda表達(dá)式; 2、至少會使用一種關(guān)系型數(shù)據(jù)庫; 3、熟悉Maven; 4、熟悉SpringBoot; 5、最好熟悉MyBatis。
老師告訴你能學(xué)到什么?
1、了解MP的基本原理及框架特點; 2、掌握MP通用Mapper的使用; 3、掌握MP常用注解的使用; 4、掌握ActiveRecord模式的使用; 5、掌握MP多種主鍵策略的使用; 6、掌握MP常用配置的使用; 7、掌握MP通用Service的使用; 8、掌握MP在某些應(yīng)用場景下的具體使用方式。

微信掃碼,參與3人拼團

微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號

友情提示:

您好,此課程屬于遷移課程,您已購買該課程,無需重復(fù)購買,感謝您對慕課網(wǎng)的支持!