当前位置:网站首页>常用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>
边栏推荐
- Memory analyzer (MAT)
- 同花顺开户注册安全靠谱吗?有没有风险的?
- 大神们,我想发两个广播流1 从mysql加载基础数据,广播出去2 从kafka加载基础数据的变更
- 《ActBERT》百度&悉尼科技大学提出ActBERT,学习全局局部视频文本表示,在五个视频-文本任务中有效!...
- Hcie security Day12: supplement the concept of packet filtering and security policy
- What is the maximum number of concurrent TCP connections for a server? 65535?
- What if the Flink SQL client exits and the table is emptied?
- Yyds dry goods inventory TCP & UDP
- MySQL——索引
- APEC industry +: father of the king of the ox mill, industrial Internet "king of the ox mill anti-wear faction" Valentine's Day greetings | Asia Pacific Economic media | ChinaBrand
猜你喜欢
Link aggregation based on team mechanism
Go learning notes (4) basic types and statements (3)
Discussion Net legacy application transformation
Scientific research document management Zotero
Etcd raft Based Consistency assurance
No matter how hot the metauniverse is, it cannot be separated from data
技术管理进阶——如何在面试中考察候选人并增大入职概率
Nmap and masscan have their own advantages and disadvantages. The basic commands are often mixed to increase output
[vulnhub shooting range] impulse: lupinone
MySQL——数据库备份
随机推荐
2022 melting welding and thermal cutting examination materials and free melting welding and thermal cutting examination questions
Qualcomm platform WiFi update disconnect end open event
JVM JNI and PVM pybind11 mass data transmission and optimization
Set, weakset, map, weakmap in ES6
treevalue——Master Nested Data Like Tensor
鹏城杯 WEB_WP
C 10 new feature [caller parameter expression] solves my confusion seven years ago
设计电商秒杀系统
Advanced collaboration: coroutinecontext
2022 safety officer-c certificate examination and safety officer-c certificate registration examination
Tidb's initial experience of ticdc6.0
大神们,我想发两个广播流1 从mysql加载基础数据,广播出去2 从kafka加载基础数据的变更
MySQL——索引
电子科技大学|强化学习中有效利用的聚类经验回放
90 後,辭職創業,說要卷死雲數據庫
Hcie security Day11: preliminarily learn the concepts of firewall dual machine hot standby and vgmp
What should the future of the Internet be like when Silicon Valley employees flee the big factory and rush to Web3| Footprint Analytics
Brief analysis of ref nerf
Compilation Principle -- syntax analysis
鹏城杯 WEB_WP