• ssm和springboot整合


    一、整合Mybatis

    1、新建一个springboot项目

    在这里插入图片描述

    2、修改pom依赖

    <dependency>
                <groupId>mysqlgroupId>
                <artifactId>mysql-connector-javaartifactId>
                <version>5.1.44version>
            dependency>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    <plugin>
                    <groupId>org.mybatis.generatorgroupId>
                    <artifactId>mybatis-generator-maven-pluginartifactId>
                    <version>1.3.2version>
                    <dependencies>
                        
                        <dependency>
                            <groupId>mysqlgroupId>
                            <artifactId>mysql-connector-javaartifactId>
                            <version>5.1.44version>
                        dependency>
                    dependencies>
                    <configuration>
                        <overwrite>trueoverwrite>
                    configuration>
                plugin>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

    3、修改generatorConfig.xml

    
            <sqlMapGenerator targetPackage="com.xnx.springbootmybatis.mapper"
                             targetProject="src/main/resources/mappers">
                
                <property name="enableSubPackages" value="false"/>
            sqlMapGenerator>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    4、修改application.yml

    mybatis:
        mapper-locations: classpath:mappers/**/*.xml
        type-aliases-package: com.xnx.springbootmybatis.model
    server:
        port: 8080
    spring:
        application:
            name: springbootmybatis
        datasource:
            driver-class-name: com.mysql.jdbc.Driver
            name: defaultDataSource
            password: 123456
            url: jdbc:mysql://localhost:3306/t280?useUnicode=true&characterEncoding=UTF-8
            username: root
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    5、配置逆向生成

    在这里插入图片描述

    6、边写controller层

    BookController:

    package com.xnx.springbootmybatis;
    
    import com.xnx.springbootmybatis.mapper.BookMapper;
    import com.xnx.springbootmybatis.model.Book;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.web.bind.annotation.*;
    
    import java.util.List;
    
    /**
     * @author xnx
     * @create 2022-11-01 15:07
     */
    @RestController
    @RequestMapping("/mybatis")
    public class BookController {
        @Autowired
        private BookMapper bookMapper;
    
    //    查询
        @GetMapping("/get")
        public Book get(Integer bid){
            return bookMapper.selectByPrimaryKey(bid);
        }
    
        //    删除
        @DeleteMapping("/delete")
        public int delete(Integer bid){
            return bookMapper.deleteByPrimaryKey(bid);
        }
    
        //    新增
        @PutMapping("/add")
        public int add(Book book){
            return bookMapper.insert(book);
        }
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38

    7、测试

    新增:
    在这里插入图片描述
    查询单个:
    在这里插入图片描述
    删除:
    在这里插入图片描述
    在这里插入图片描述

    二、整合Mybatisplus

    1、新建一个springboot项目

    在这里插入图片描述

    2、application.yml

    server:
        port: 8080
    spring:
        application:
            name: springbootmp
        datasource:
            driver-class-name: com.mysql.jdbc.Driver
            name: defaultDataSource
            password: 123456
            url: jdbc:mysql://localhost:3306/t280?useUnicode=true&characterEncoding=UTF-8
            username: root
    logging:
        level:
            com.zking.demo: debug
    mybatis-plus:
        mapper-locations: classpath:mappers/**/*.xml
        type-aliases-package: com.xnx.springbootmp.book.model
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    3、MPGenerator

    package com.xnx.springbootmp.mp;
    
    import com.baomidou.mybatisplus.annotation.DbType;
    import com.baomidou.mybatisplus.annotation.IdType;
    import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
    import com.baomidou.mybatisplus.core.toolkit.StringPool;
    import com.baomidou.mybatisplus.core.toolkit.StringUtils;
    import com.baomidou.mybatisplus.generator.AutoGenerator;
    import com.baomidou.mybatisplus.generator.InjectionConfig;
    import com.baomidou.mybatisplus.generator.config.*;
    import com.baomidou.mybatisplus.generator.config.po.TableInfo;
    import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
    import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
    
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Scanner;
    
    /**
     * @author xnx
     * @create 2022-11-01 15:44
     */
    public class MPGenerator {
        /**
         * 

    * 读取控制台内容 *

    */
    public static String scanner(String tip) { Scanner scanner = new Scanner(System.in); StringBuilder help = new StringBuilder(); help.append("请输入" + tip); System.out.println(help.toString()); if (scanner.hasNext()) { String ipt = scanner.next(); if (StringUtils.isNotBlank(ipt)) { if ("quit".equals(ipt)) return ""; return ipt; } } throw new MybatisPlusException("请输入正确的" + tip + "!"); } public static void main(String[] args) { // 代码生成器 AutoGenerator mpg = new AutoGenerator(); // 1.全局配置 GlobalConfig gc = new GlobalConfig(); String projectPath = System.getProperty("user.dir") + "/springbootmp"; System.out.println(projectPath); gc.setOutputDir(projectPath + "/src/main/java"); gc.setOpen(false); gc.setBaseResultMap(true);//生成BaseResultMap gc.setActiveRecord(false);// 不需要ActiveRecord特性的请改为false gc.setEnableCache(false);// XML 二级缓存 gc.setBaseResultMap(true);// XML ResultMap gc.setBaseColumnList(true);// XML columList //gc.setSwagger2(true); //实体属性 Swagger2 注解 gc.setAuthor("xnx"); // 自定义文件命名,注意 %s 会自动填充表实体属性! gc.setMapperName("%sMapper"); gc.setXmlName("%sMapper"); gc.setServiceName("%sService"); gc.setServiceImplName("%sServiceImpl"); gc.setControllerName("%sController"); gc.setIdType(IdType.AUTO); mpg.setGlobalConfig(gc); // 2.数据源配置 DataSourceConfig dsc = new DataSourceConfig(); dsc.setDbType(DbType.MYSQL); dsc.setUrl("jdbc:mysql://localhost:3306/t280?useUnicode=true&characterEncoding=UTF-8"); dsc.setDriverName("com.mysql.jdbc.Driver"); dsc.setUsername("root"); dsc.setPassword("123456"); mpg.setDataSource(dsc); // 3.包配置 PackageConfig pc = new PackageConfig(); String moduleName = scanner("模块名(quit退出,表示没有模块名)"); if (StringUtils.isNotBlank(moduleName)) { pc.setModuleName(moduleName); } // 设置基包(父包) pc.setParent("com.xnx.springbootmp") .setMapper("mapper") .setService("service") .setController("controller") .setEntity("model"); mpg.setPackageInfo(pc); // 4.自定义配置 InjectionConfig cfg = new InjectionConfig() { @Override public void initMap() { // to do nothing } }; // 如果模板引擎是 freemarker String templatePath = "/templates/mapper.xml.ftl"; // 自定义输出配置 List<FileOutConfig> focList = new ArrayList<>(); // 自定义配置会被优先输出 focList.add(new FileOutConfig(templatePath) { @Override public String outputFile(TableInfo tableInfo) { // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!! if (StringUtils.isNotBlank(pc.getModuleName())) { return projectPath + "/src/main/resources/mappers/" + pc.getModuleName() + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML; } else { return projectPath + "/src/main/resources/mappers/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML; } } }); cfg.setFileOutConfigList(focList); mpg.setCfg(cfg); // 配置模板 TemplateConfig templateConfig = new TemplateConfig(); templateConfig.setXml(null); mpg.setTemplate(templateConfig); // 5.策略配置 StrategyConfig strategy = new StrategyConfig(); // 表名生成策略(下划线转驼峰命名) strategy.setNaming(NamingStrategy.underline_to_camel); // 列名生成策略(下划线转驼峰命名) strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 是否启动Lombok配置 strategy.setEntityLombokModel(true); // 是否启动REST风格配置 strategy.setRestControllerStyle(true); // 自定义实体父类strategy.setSuperEntityClass("com.baomidou.mybatisplus.extension.activerecord.Model"); // 自定义service父接口strategy.setSuperServiceClass("com.baomidou.mybatisplus.extension.service.IService"); // 自定义service实现类strategy.setSuperServiceImplClass("com.baomidou.mybatisplus.extension.service.impl.ServiceImpl"); // 自定义mapper接口strategy.setSuperMapperClass("com.baomidou.mybatisplus.core.mapper.BaseMapper"); strategy.setSuperEntityColumns("id"); // 写于父类中的公共字段plus strategy.setSuperEntityColumns("id"); strategy.setInclude(scanner("表名,多个英文逗号分割").split(",")); strategy.setControllerMappingHyphenStyle(true); //表名前缀(可变参数):“t_”或”“t_模块名”,例如:t_user或t_sys_user strategy.setTablePrefix("t_", "t_sys_"); //strategy.setTablePrefix(scanner("请输入表前缀")); mpg.setStrategy(strategy); mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行 mpg.execute(); } }
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157

    4、生成代码

    ①MvcBookMapper

    package com.xnx.springbootmp.book.mapper;
    
    import com.xnx.springbootmp.book.model.MvcBook;
    import com.baomidou.mybatisplus.core.mapper.BaseMapper;
    import org.springframework.stereotype.Repository;
    
    /**
     * 

    * Mapper 接口 *

    * * @author xnx * @since 2022-11-01 */
    @Repository public interface MvcBookMapper extends BaseMapper<MvcBook> { }
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19

    ②MvcBook

    package com.xnx.springbootmp.book.model;
    
    import com.baomidou.mybatisplus.annotation.TableName;
    import com.baomidou.mybatisplus.annotation.IdType;
    import com.baomidou.mybatisplus.annotation.TableId;
    import java.io.Serializable;
    import lombok.Data;
    import lombok.EqualsAndHashCode;
    
    /**
     * 

    * *

    * * @author xnx * @since 2022-11-01 */
    @Data @EqualsAndHashCode(callSuper = false) @TableName("t_mvc_book") public class MvcBook implements Serializable { private static final long serialVersionUID = 1L; @TableId(value = "bid", type = IdType.AUTO) private Integer bid; private String bname; private Float price; }
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34

    ③MvcBookServiceImpl

    package com.xnx.springbootmp.book.service.impl;
    
    import com.xnx.springbootmp.book.model.MvcBook;
    import com.xnx.springbootmp.book.mapper.MvcBookMapper;
    import com.xnx.springbootmp.book.service.MvcBookService;
    import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
    import org.springframework.stereotype.Service;
    
    /**
     * 

    * 服务实现类 *

    * * @author xnx * @since 2022-11-01 */
    @Service public class MvcBookServiceImpl extends ServiceImpl<MvcBookMapper, MvcBook> implements MvcBookService { }
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21

    ④MvcBookService

    package com.xnx.springbootmp.book.service;
    
    import com.xnx.springbootmp.book.model.MvcBook;
    import com.baomidou.mybatisplus.extension.service.IService;
    
    /**
     * 

    * 服务类 *

    * * @author xnx * @since 2022-11-01 */
    public interface MvcBookService extends IService<MvcBook> { }
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    ⑤MvcBookMapper.xml

    
    DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
    <mapper namespace="com.xnx.springbootmp.book.mapper.MvcBookMapper">
    
        
        <resultMap id="BaseResultMap" type="com.xnx.springbootmp.book.model.MvcBook">
            <id column="bid" property="bid" />
            <result column="bname" property="bname" />
            <result column="price" property="price" />
        resultMap>
    
        
        <sql id="Base_Column_List">
            bid, bname, price
        sql>
    
    mapper>
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    5、MvcBookController

    package com.xnx.springbootmp.book.controller;
    
    
    import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
    import com.xnx.springbootmp.book.model.MvcBook;
    import com.xnx.springbootmp.book.service.MvcBookService;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.web.bind.annotation.*;
    
    import java.util.List;
    
    /**
     * 

    * 前端控制器 *

    * * @author xnx * @since 2022-11-01 */
    @RestController @RequestMapping("/book/mvc-book") public class MvcBookController { @Autowired private MvcBookService bookService; // 查询所有 @GetMapping("/list") public List<MvcBook> list(){ return bookService.list(); } // 按条件查询 @GetMapping("/listByCondition") public List<MvcBook> listByCondition(MvcBook book){ // 如果使用的是Mybatis.那么我们需要写sql语句,而mp不需要 QueryWrapper qw = new QueryWrapper(); qw.like("bname",book.getBname()); return bookService.list(qw); } // 查询单个 @GetMapping("/get") public MvcBook get(MvcBook book){ return bookService.getById(book.getBid()); } // 增加 @PutMapping("/add") public boolean add(MvcBook book){ return bookService.save(book); } // 删除 @DeleteMapping("/delete") public boolean delete(MvcBook book){ return bookService.removeById(book.getBid()); } // 修改 @PostMapping("/update") public boolean update(MvcBook book){ return bookService.saveOrUpdate(book); } }
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64

    6、测试

    在这里插入图片描述
    在这里插入图片描述

    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

    三、Mybatisplus中使用Mybatis实现多表连查的功能

    1、MvcBookMapper.xml

    
    DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
    <mapper namespace="com.xnx.springbootmp.book.mapper.MvcBookMapper">
    
        
        <resultMap id="BaseResultMap" type="com.xnx.springbootmp.book.model.MvcBook">
            <id column="bid" property="bid" />
            <result column="bname" property="bname" />
            <result column="price" property="price" />
        resultMap>
    
        
        <sql id="Base_Column_List">
            bid, bname, price
        sql>
        
        <select id="queryUserRole" parameterType="java.util.Map" resultType="java.util.Map">
            select u.username,r.rolename from
            t_shiro_user u,t_shiro_user_role ur,t_shiro_role r
            where u.userid = ur.userid
            and ur.roleid = r.roleid
            <if test="username !=null and username != ''">
                and u.username = #{username}
            if>
        select>
    
    mapper>
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28

    2、MvcBookMapper

    package com.xnx.springbootmp.book.mapper;
    
    import com.xnx.springbootmp.book.model.MvcBook;
    import com.baomidou.mybatisplus.core.mapper.BaseMapper;
    import org.springframework.stereotype.Repository;
    
    import java.util.List;
    import java.util.Map;
    
    /**
     * 

    * Mapper 接口 *

    * * @author xnx * @since 2022-11-01 */
    @Repository public interface MvcBookMapper extends BaseMapper<MvcBook> { List<Map> queryUserRole(Map map); }
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23

    3、MvcBookService

    package com.xnx.springbootmp.book.service;
    
    import com.xnx.springbootmp.book.model.MvcBook;
    import com.baomidou.mybatisplus.extension.service.IService;
    
    import java.util.List;
    import java.util.Map;
    
    /**
     * 

    * 服务类 *

    * * @author xnx * @since 2022-11-01 */
    public interface MvcBookService extends IService<MvcBook> { List<Map> queryUserRole(Map map); }
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    4、MvcBookServiceImpl

    package com.xnx.springbootmp.book.service.impl;
    
    import com.xnx.springbootmp.book.model.MvcBook;
    import com.xnx.springbootmp.book.mapper.MvcBookMapper;
    import com.xnx.springbootmp.book.service.MvcBookService;
    import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    
    import java.util.List;
    import java.util.Map;
    
    /**
     * 

    * 服务实现类 *

    * * @author xnx * @since 2022-11-01 */
    @Service public class MvcBookServiceImpl extends ServiceImpl<MvcBookMapper, MvcBook> implements MvcBookService { @Autowired private MvcBookMapper mvcBookMapper; @Override public List<Map> queryUserRole(Map map) { return mvcBookMapper.queryUserRole(map); } }
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32

    5、MvcBookController

    package com.xnx.springbootmp.book.controller;
    
    
    import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
    import com.xnx.springbootmp.book.model.MvcBook;
    import com.xnx.springbootmp.book.service.MvcBookService;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.web.bind.annotation.*;
    
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    
    /**
     * 

    * 前端控制器 *

    * * @author xnx * @since 2022-11-01 */
    @RestController @RequestMapping("/book/mvc-book") public class MvcBookController { @Autowired private MvcBookService bookService; // 查询所有 @GetMapping("/list") public List<MvcBook> list(){ return bookService.list(); } // 按条件查询 @GetMapping("/listByCondition") public List<MvcBook> listByCondition(MvcBook book){ // 如果使用的是Mybatis.那么我们需要写sql语句,而mp不需要 QueryWrapper qw = new QueryWrapper(); qw.like("bname",book.getBname()); return bookService.list(qw); } // 查询单个 @GetMapping("/get") public MvcBook get(MvcBook book){ return bookService.getById(book.getBid()); } // 增加 @PutMapping("/add") public boolean add(MvcBook book){ return bookService.save(book); } // 删除 @DeleteMapping("/delete") public boolean delete(MvcBook book){ return bookService.removeById(book.getBid()); } // 修改 @PostMapping("/update") public boolean update(MvcBook book){ return bookService.saveOrUpdate(book); } // 多表联查,用户账户对应角色的功能,轮着mybatisplus是一样可以使用mybatis功能 @GetMapping("/dbcx") public List<Map> get(String uname){ // 前端传了一个张三 Map map = new HashMap(); map.put("username",uname); return bookService.queryUserRole(map); } }
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75

    在这里插入图片描述

  • 相关阅读:
    使用Blazor WebAssembly整合PocketBase的基础项目模板
    Kotlin 开发Android app(七)上:Kotlin函数fun
    小程序真机调试提示系统错误
    Minecraft 1.16.5模组开发(五十三) 多种生物类型(Variant)
    世界第一台通用计算机:ENIAC
    好奇喵 | Tor浏览器——如何拥有一颗洋葱并使用
    linux每处理器内存分配
    SpringRetry
    JavaWeb-服务器&Tomcat
    【开源】SpringBoot框架开发房屋出售出租系统
  • 原文地址:https://blog.csdn.net/weixin_67677668/article/details/127634328