当前位置:网站首页>常用sql集合
常用sql集合
2022-07-03 21:18:00 【捕風捉影】
@valid 校验方式:
如果你是 springboot 项目,那么可以不用引入了,已经引入了,他就存在于最核心的 web 开发包里面。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.0.5.RELEASE</version>
</dependency>
如果你不是 springboot 项目,那么引入下面依赖即可:
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.4.1.Final</version>
</dependency>
在实体类之间进行引入注解
/** 姓名 */
@NotBlank(message = "请输入名称")
@Length(message = "名称不能超过个 {max} 字符", max = 10)
public String name;
/** 年龄 */
@NotNull(message = "请输入年龄")
@Range(message = "年龄范围为 {min} 到 {max} 之间", min = 1, max = 100)
public Integer age;
异常信息:
迷糊查询加上foreach批量操作:
<select id="searchPrivate" resultType="">
select *
from customer c LEFT JOIN base_user bu ON c.cur_uid = bu.id AND bu.status = 1
<where>
c.del_flag = 0
<if test="param.cusName != null and param.cusName != ''">
and c.cus_name like concat('%',#{
param.cusName},'%')
</if>
<if test="param.cusId != null and param.cusId != ''">
and c.cus_id = #{
param.cusId}
</if>
<if test="param.intentElecStart != null">
and <![CDATA[ c.intent_elec >= #{
param.intentElecStart} ]]>
</if>
<if test="param.intentElecEnd != null">
and <![CDATA[ c.intent_elec <= #{
param.intentElecEnd} ]]>
</if>
<if test="param.cusType != null">
and c.cus_type = #{
param.cusType}
</if>
<if test="null != param.userIdList and param.userIdList.size() > 0">
and c.cur_uid in (
<foreach collection="param.userIdList" item="item" separator=",">
#{
item}
</foreach>
)
</if>
<if test="null != param.cusIds and param.cusIds.size() > 0">
or c.cus_id in (
<foreach collection="param.cusIds" item="item" separator=",">
#{
item}
</foreach>
)
</if>
</where>
order by c.update_time desc
</select>
边栏推荐
- C 10 new feature [caller parameter expression] solves my confusion seven years ago
- 内存分析器 (MAT)
- Is flush account opening and registration safe and reliable? Is there any risk?
- leetcode-540. A single element in an ordered array
- Borui data and Sina Finance released the 2021 credit card industry development report
- Kubernetes abnormal communication network fault solution ideas
- Gee calculated area
- Interval product of zhinai sauce (prefix product + inverse element)
- Basic preprocessing and data enhancement of image data
- TLS environment construction and plaintext analysis
猜你喜欢
Experience summary of database storage selection
内存分析器 (MAT)
Compilation Principle -- syntax analysis
Etcd 基于Raft的一致性保证
No more! Technical team members resign collectively
Apprentissage intensif - notes d'apprentissage 1 | concepts de base
9 pyqt5 qscrollarea scroll area and qscrollbar scroll bar
Borui data and Sina Finance released the 2021 credit card industry development report
Advanced technology management - how to examine candidates in the interview and increase the entry probability
Getting started with postman -- environment variables and global variables
随机推荐
17 websites for practicing automated testing. I'm sure you'll like them
Service discovery and load balancing mechanism -service
Single page application architecture
Kubernetes 通信异常网络故障 解决思路
The 12th Blue Bridge Cup
Install and use Chrony, and then build your own time server
Basic number theory -- Chinese remainder theorem
Do you really know how old you are?
JS three families
MySQL——规范数据库设计
MySQL——索引
Hcie security Day11: preliminarily learn the concepts of firewall dual machine hot standby and vgmp
Memory analyzer (MAT)
Offset related concepts + drag modal box case
一台服务器最大并发 tcp 连接数多少?65535?
QT6 QML book/qt quick 3d/ Basics
MySQL - database backup
Xai+ network security? Brandon University and others' latest "interpretable artificial intelligence in network security applications" overview, 33 page PDF describes its current situation, challenges,
Goodbye 2021, how do programmers go to the top of the disdain chain?
如临现场的视觉感染力,NBA决赛直播还能这样看?