Mybatis (3) map and fuzzy query expansion

iLisa 2021-04-08 11:14:37
mybatis map fuzzy query expansion

One : Omnipotent Map

hypothesis , Our entity classes , Or a table in a database , Too many fields or parameters , We should consider using Map!

Why does it show up Map?


  When we change the password , Just one id And the password , At this time, it's a little too big for us to pass on an entity ( In the case of entities, we need to assign values to all the attributes of the entities ) So let's pass on a map If we gather, we only need to pass one id And the password . as follows :(Map If we do, we'll be at the bottom userid You can do it again map I'll call you any name I want ( It refers to us key value ), When we're in user Entity class is not allowed. It must have the same attribute name as our entity )


test :



 Map Pass parameters , Directly in sql Remove from key that will do ! 【parameterType="map"}】

Object passing parameters , Directly in sql Just take the attribute of the object from ! 【parameterType="Object】

With only one basic type parameter , Can be directly in sql Remove from !( such as int)

Multiple parameters with Map, Or annotation !

Two : Fuzzy query

How to write fuzzy query ? When the code executes , Pass wildcard % %


 2. stay sql Using wildcards in stitching !

( prevent sql The way of Injection , Is to put our ? It's written here to prevent 1or1=1 Such code injection )


  1. Java version spring cloud + spring boot + mybatis distributed mall micro Service Mall multi tenant mall e-commerce live delivery mall social E-commerce
  2. Java 任意音频转MP3
  3. Docker 的 DNS
  4. Docker-搭建日志监控系统
  5. ssm+mysql+maven+shiro进销存系统wms
  6. Installing redis5.0 on win10
  7. (15) Springcloud of springboot E-commerce mall - using Eureka cluster to build and implement high availability service registry
  8. (14) Springcloud Eureka self protection mode and instanceid configuration of springboot E-commerce mall
  9. Peanut shell intranet penetration (Linux version)
  10. Deploying elastic search with docker (stand alone)
  11. (13) Springcloud of springboot E-commerce mall - using Eureka cluster to build and implement high availability service registry
  12. (12) Eureka registry of springboot E-commerce mall opens password authentication
  13. 爱上 Java 的10 大理由!
  14. 7、 Spring boot integrates thymeleaf template engine
  15. 【DB宝41】监控利器PMM的使用--监控MySQL、PG、MongoDB、ProxySQL等
  16. 【DB宝42】MySQL高可用架构MHA+ProxySQL实现读写分离和负载均衡
  17. MySQL command line second replication database
  18. Windows installation of MySQL (MSI graphic installation)
  19. The full link startup speed of Java applications has been increased to 15s, and the SAE capability of alicloud has been upgraded again
  20. Java 学生成绩管理系统课程设计,附源码!
  21. Linux basic command
  22. Java arbitrary audio to MP3
  23. DNS of docker
  24. Docker - build log monitoring system
  25. SSM + MySQL + Maven + Shiro WMS
  26. Top 10 reasons to fall in love with java!
  27. 一本关于HTTP的恋爱日记
  28. 【RocketMQ源码分析】深入消息存储(3)
  29. SpringCloud+Nacos实现服务配置中心(Hoxton版本)
  30. SCIP:构造数据抽象--数据结构中队列与树的解释
  31. SCIP:构造过程抽象--面向对象的解释
  32. 使用 docker 进行 ElasticSearch + Kibana 集群搭建
  33. Spring IOC 特性有哪些,不会读不懂源码!
  34. [DB Bao 41] use of PMM -- monitoring mysql, PG, mongodb, proxysql, etc
  35. Spring Cloud 升级之路 - 2020.0.x - 3. Undertow 的 accesslog 配置
  36. [DB Bao 42] MySQL high availability architecture MHA + proxysql realizes read-write separation and load balancing
  37. [DataGuard] recovery of physical DG in case of losing archive files in main database (7)
  38. MyBatis(3)Map和模糊查询拓展
  39. 【TTS】AIX->Linux--基于RMAN(真实环境)
  40. 【TTS】传输表空间AIX->linux基于rman
  41. 【TTS】传输表空间AIX asm -> linux asm
  42. 【TTS】传输表空间Linux asm -> AIX asm
  43. 【DB宝40】MySQL高可用管理工具Orchestrator简介及测试
  44. 【TTS】传输表空间Linux ->AIX 基于rman
  45. 一本关于HTTP的恋爱日记
  46. 【RocketMQ源码分析】深入消息存储(3)
  47. SpringCloud+Nacos实现服务配置中心(Hoxton版本)
  48. SICP:构造过程抽象--面向对象的解释
  49. 3w 字长文爆肝 Java 基础面试题!太顶了!!!
  50. Spring Cloud 升级之路 - 2020.0.x - 3. Undertow 的 accesslog 配置
  51. win10卸载mysql5.7
  52. MySQL 批量插入,如何不插入重复数据?
  53. k8s cronjob应用示例
  54. 非常规方法,轻松应对Oracle数据库危急异常
  55. Oracle hang 之sqlplus -prelim使用方法
  56. 如何全文搜索oracle官方文档
  57. Java student achievement management system course design, with source code!
  58. win10安装mysql8.0
  59. 手把手教你写一个spring IOC容器
  60. JAVA 中的异常(1)- 基本概念