当前位置:网站首页>常用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>
边栏推荐
- Visiontransformer (I) -- embedded patched and word embedded
- Capturing and sorting out external articles -- autoresponder, composer, statistics [III]
- The "boss management manual" that is wildly spread all over the network (turn)
- Discussion Net legacy application transformation
- UI automation test: selenium+po mode +pytest+allure integration
- Compilation Principle -- syntax analysis
- Link aggregation based on team mechanism
- 浅析 Ref-NeRF
- C程序设计的初步认识
- 设计电商秒杀系统
猜你喜欢
随机推荐
鹏城杯 WEB_WP
Gauss elimination solves linear equations (floating-point Gauss elimination template)
Install and use Chrony, and then build your own time server
Baohong industry | good habits that Internet finance needs to develop
Advanced technology management - how to examine candidates in the interview and increase the entry probability
Goodbye 2021, how do programmers go to the top of the disdain chain?
浅析 Ref-NeRF
上周内容回顾
Rhcsa third day operation
Qualcomm platform WiFi -- P2P issue
Operate BOM objects (key)
Study diary: February 14th, 2022
[Tang Laoshi] C -- encapsulation: member variables and access modifiers
Kernel symbol table
强化学习-学习笔记1 | 基础概念
What if the Flink SQL client exits and the table is emptied?
leetcode-540. A single element in an ordered array
Qt6 QML Book/Qt Quick 3D/基础知识
Capturing and sorting out external articles -- autoresponder, composer, statistics [III]
Is it OK for fresh students to change careers to do software testing? The senior answered with his own experience









