当前位置:网站首页>常用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>
边栏推荐
- TiDB 之 TiCDC6.0 初体验
- Offset related concepts + drag modal box case
- 2022 melting welding and thermal cutting examination materials and free melting welding and thermal cutting examination questions
- Leetcode daily question 540 A single element in an ordered array Valentine's Day special article looking for a single dog in a pile of lovers ~ the clown is myself
- 设计电商秒杀系统
- Basic preprocessing and data enhancement of image data
- 不同业务场景该如何选择缓存的读写策略?
- MySQL - SQL injection problem
- Summary of common operation and maintenance commands
- SQL injection - Fundamentals of SQL database operation
猜你喜欢

Custom view incomplete to be continued

@Scenario of transactional annotation invalidation

QT6 QML book/qt quick 3d/ Basics
![[Tang Laoshi] C -- encapsulation: member variables and access modifiers](/img/be/0b38c0f1a27f819f7c79bcf634fbd4.jpg)
[Tang Laoshi] C -- encapsulation: member variables and access modifiers

MySQL——idea连接MySQL

强化学习-学习笔记1 | 基础概念

全网都在疯传的《老板管理手册》(转)

9 pyqt5 qscrollarea scroll area and qscrollbar scroll bar

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

Such as the visual appeal of the live broadcast of NBA Finals, can you still see it like this?
随机推荐
Operate BOM objects (key)
jvm jni 及 pvm pybind11 大批量数据传输及优化
Leetcode daily question 540 A single element in an ordered array Valentine's Day special article looking for a single dog in a pile of lovers ~ the clown is myself
The 12th Blue Bridge Cup
Is flush account opening and registration safe and reliable? Is there any risk?
9 pyqt5 qscrollarea scroll area and qscrollbar scroll bar
No matter how hot the metauniverse is, it cannot be separated from data
Inventory 2021 | yunyuansheng embracing the road
Interval product of zhinai sauce (prefix product + inverse element)
Memory analyzer (MAT)
Wireless network (preprocessing + concurrent search)
leetcode-540. A single element in an ordered array
强化學習-學習筆記1 | 基礎概念
JVM JNI and PVM pybind11 mass data transmission and optimization
SQL injection - Fundamentals of SQL database operation
C 10 new feature [caller parameter expression] solves my confusion seven years ago
Use nodejs+express+mongodb to complete the data persistence project (with modified source code)
Go learning notes (4) basic types and statements (3)
上周内容回顾
[secretly kill little buddy pytorch20 days -day02- example of image data modeling process]