Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Mybatis query condition including List

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you the Mybatis query conditions including List example analysis, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to understand it!

Cases where the query condition contains List

When searching in mybatis, sometimes the parameter contains List, such as the passed-in parameter:

Public class FileRequest {/ / File Type private Integer fileType; / / status private List statusList;} public class Status {/ / Registration status private Integer registerStatus / / meeting status private Integer meetingStatus} statement queried in mybatis select * from tableName where 1 status 1 and file_type = # {fileType} and and register_status= # {item.registerStatus} and meeting_status= # {item.meetingStatus} Query conditions with List and other types of field requirements

Mybatis query conditions with List and other types of fields (Integer,String,...).

Select * from table where type=?and code in

Mapper.java file

List selectByTypeAndCodes (@ Param ("codes") List codes,@Param ("type") Integer type) Mapper.xml.

Note that Parameters: 34 (Integer), 1 (Integer), 2 (Integer), 3 (Integer)

BaseJdbcLogger.debug (BaseJdbcLogger.java:145)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report