当前位置:网站首页>常用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>
边栏推荐
- Pengcheng cup Web_ WP
- Capture de paquets et tri du contenu externe - - autoresponder, composer, statistiques [3]
- MySQL——规范数据库设计
- Mysql - - Index
- Visiontransformer (I) -- embedded patched and word embedded
- 2022 high voltage electrician examination and high voltage electrician reexamination examination
- Inventory 2021 | yunyuansheng embracing the road
- No more! Technical team members resign collectively
- Notes on MySQL related knowledge points (startup, index)
- Do you really know how old you are?
猜你喜欢

17 websites for practicing automated testing. I'm sure you'll like them

Apprentissage intensif - notes d'apprentissage 1 | concepts de base

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

不同业务场景该如何选择缓存的读写策略?

Haven't expressed the artifact yet? Valentine's Day is coming. Please send her a special gift~

MySQL——数据库备份

Hcie security Day11: preliminarily learn the concepts of firewall dual machine hot standby and vgmp

Use nodejs+express+mongodb to complete the data persistence project (with modified source code)

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

Day 9 HomeWrok-ClassHierarchyAnalysis
随机推荐
Kubernetes abnormal communication network fault solution ideas
鹏城杯 WEB_WP
Qt6 QML Book/Qt Quick 3D/基础知识
Reinforcement learning - learning notes 1 | basic concepts
Kubernetes 通信异常网络故障 解决思路
Borui data and Sina Finance released the 2021 credit card industry development report
全网都在疯传的《老板管理手册》(转)
Apprentissage intensif - notes d'apprentissage 1 | concepts de base
What if the Flink SQL client exits and the table is emptied?
一台服务器最大并发 tcp 连接数多少?65535?
Qualcomm platform WiFi -- P2P issue
9 pyqt5 qscrollarea scroll area and qscrollbar scroll bar
Read the root directory of the folder, write txt and generate random samples
Is it OK for fresh students to change careers to do software testing? The senior answered with his own experience
SQL injection - Fundamentals of SQL database operation
Mysql database ----- common commands of database (based on database)
Haven't expressed the artifact yet? Valentine's Day is coming. Please send her a special gift~
Selenium has three waiting methods (forced waiting, implicit waiting, and display waiting)
仿网易云音乐小程序
Install and use Chrony, and then build your own time server