美文网首页
mybatisplus笔记

mybatisplus笔记

作者: 我是电饭煲 | 来源:发表于2020-03-31 00:09 被阅读0次

    https://www.bilibili.com/video/av69233006?p=23

    注解

    • @TableName("表名") :指定表名
    • @TableId(type = IdType.AUTO) :指定id策略
    • @TableField:对象字段名与数据库字段不匹配(非驼峰字段);数据库没有的字段(@TableField(select = false))

    自定义sql

        @Select("select * from total_cash_flow ${ew.customSqlSegment} limit 0, 1")
        TotalCashFlow findFirstByAssetOrderByIdDesc(@Param(Constants.WRAPPER) Wrapper wrapper);
    
       @Update("update capital set balance = balance + #{cost}  ${ew.customSqlSegment}")
        void updateBalance(@Param(Constants.WRAPPER) Wrapper wrapper, @Param("cost") BigDecimal cost);
    

    IService使用教程

    https://blog.csdn.net/weixin_38111957/article/details/92415413

    条件更新方法

    • 方法一


      3G$AV46M_%~)53TG78RLPB2.png
    • 方法二


      3G[}A%Y5QTS{IR]KEVS_AH1.png

    删除

    • and删除:deleteByMap


      image.png
    • and删除:delete


      VQRQC)9U8YV0I0_1R41%187.png
    • 批量删除:


      OJVU~OAO8F6)O6RFU{2)JAT.png

    查询

    • 分页查询:selectPage


      KMF4C()P8~{I~$2%A0`~[MK.png](https://img.haomeiwen.com/i4428387/afae6a1f723c5885.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![9G[@4XGV`OTE%PN8K)AFXEY.png

    相关文章

      网友评论

          本文标题:mybatisplus笔记

          本文链接:https://www.haomeiwen.com/subject/mjycwctx.html