当前位置:网站首页>常用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>
边栏推荐
- Inventory 2021 | yunyuansheng embracing the road
- flink sql-client 退出,表就会被清空怎么办?
- Cesiumjs 2022 ^ source code interpretation [7] - Analysis of the request and loading process of 3dfiles
- For in, foreach, for of
- Measurement fitting based on Halcon learning -- Practice [1]
- Custom view incomplete to be continued
- Offset related concepts + drag modal box case
- [vulnhub shooting range] impulse: lupinone
- Goodbye 2021, how do programmers go to the top of the disdain chain?
- MySQL - index
猜你喜欢

leetcode-540. A single element in an ordered array

强化學習-學習筆記1 | 基礎概念

Basic preprocessing and data enhancement of image data

Baohong industry | good habits that Internet finance needs to develop

Hcie security Day10: six experiments to understand VRRP and reliability

Xai+ network security? Brandon University and others' latest "interpretable artificial intelligence in network security applications" overview, 33 page PDF describes its current situation, challenges,

JVM JNI and PVM pybind11 mass data transmission and optimization

QT6 QML book/qt quick 3d/ Basics

QFileDialog

"Actbert" Baidu & Sydney University of technology proposed actbert to learn the global and local video text representation, which is effective in five video text tasks
随机推荐
Set, weakset, map, weakmap in ES6
How to choose cache read / write strategies in different business scenarios?
Hcie security Day10: six experiments to understand VRRP and reliability
CesiumJS 2022^ 源码解读[7] - 3DTiles 的请求、加载处理流程解析
Sort out several network request methods of JS -- get rid of callback hell
[secretly kill little buddy pytorch20 days -day02- example of image data modeling process]
No matter how hot the metauniverse is, it cannot be separated from data
Yiwen teaches you how to choose your own NFT trading market
Cesiumjs 2022 ^ source code interpretation [7] - Analysis of the request and loading process of 3dfiles
MySQL——规范数据库设计
2022-2-14 acwing1027 grid access
leetcode-540. A single element in an ordered array
《ActBERT》百度&悉尼科技大学提出ActBERT,学习全局局部视频文本表示,在五个视频-文本任务中有效!...
@Transactional注解失效的场景
上周内容回顾
Basic preprocessing and data enhancement of image data
MySQL——JDBC
What is the maximum number of concurrent TCP connections for a server? 65535?
Interval product of zhinai sauce (prefix product + inverse element)
Preliminary understanding of C program design