自考大型网站开发工具,做培训的网站,带前台的wordpress模板下载,树状菜单网站MybatisPlus------MyBatisX插件#xff08;十二#xff09;
MyBatisX插件是IDEA插件#xff0c;如果想要使用它#xff0c;那么首先需要在IDEA中进行安装。
安装插件 搜索MyBatisX#xff0c;点击Install#xff0c;之后重启IDEA即可。
插件基本用途…MybatisPlus------MyBatisX插件十二
MyBatisX插件是IDEA插件如果想要使用它那么首先需要在IDEA中进行安装。
安装插件 搜索MyBatisX点击Install之后重启IDEA即可。
插件基本用途接口与xml文件跳转
之后就可以在Mapper接口中看到红色小鸟的标识点击这个红色小鸟会自动找到对应mapper.xml文件以及文件中的方法。可以说十分方便。 在mapper.xml文件中也会有蓝色小鸟点击后会自动跳转到mapper接口的位置。
插件快速生成代码
首先需要在IDEA中连接到数据库 点击数据库点击对应的表名点击“MybatisX-Generator” 之后填写对应的内容 之后是配置生成mapper文件service文件的位置。 选中Lombok就不用再选toString/hashCode/equals 之后点击finish即可。
快速生成CRUD
不需要写返回值只需要写方法名就能够快速生成CRUD 选择之后需要点击“AltEnter”才能够生效。 选择Generate Mybatis Sql,即可在mapper文件中自动生成sql。
测试delete
int deleteByNumAndProductCode(Param(num) Integer num, Param(productCode) String productCode);delete iddeleteByNumAndProductCodedeletefrom aaaaawhere num #{num,jdbcTypeNUMERIC}AND product_code #{productCode,jdbcTypeVARCHAR}/delete测试update
int updateProductCodeByNumAndProductCode(Param(productCode) String productCode, Param(num) Integer num, Param(oldProductCode) String oldProductCode);注意update方法名的语法要有By加条件。 update idupdateProductCodeByNumAndProductCodeupdate aaaaaset product_code #{productCode,jdbcTypeVARCHAR}where num #{num,jdbcTypeNUMERIC}AND product_code #{oldProductCode,jdbcTypeVARCHAR}/updateselect、query 查找 update 更新 delete删除 by 条件 and 连接条件 太牛皮了我敲