当前位置:网站首页>Common SQL sets
Common SQL sets
2022-07-03 21:19:00 【Catch clues】
@valid Verification method :
If you are springboot project , So you don't have to introduce , Has introduced , He exists at the core of web In the development package .
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.0.5.RELEASE</version>
</dependency>
If you're not springboot project , Then introduce the following dependencies :
<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>
Introduce annotations between entity classes
/** full name */
@NotBlank(message = " Please enter name ")
@Length(message = " Names cannot exceed {max} character ", max = 10)
public String name;
/** Age */
@NotNull(message = " Please enter age ")
@Range(message = " The age range is {min} To {max} Between ", min = 1, max = 100)
public Integer age;

Abnormal information :
Confused query plus foreach The batch operation :
<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>
边栏推荐
- Redis data migration (II)
- MySQL——JDBC
- SQL injection - Fundamentals of SQL database operation
- 2022-02-15 Daily: 2022 AAAI fellow release
- UI automation test: selenium+po mode +pytest+allure integration
- 不同业务场景该如何选择缓存的读写策略?
- [vulnhub shooting range] impulse: lupinone
- Brief analysis of ref nerf
- 2022 safety officer-c certificate examination and safety officer-c certificate registration examination
- 内存分析器 (MAT)
猜你喜欢

Mysql - - Index

Pengcheng cup Web_ WP

@Transactional注解失效的场景

Tidb's initial experience of ticdc6.0

Getting started with postman -- built-in dynamic parameters, custom parameters and assertions

TiDB 之 TiCDC6.0 初体验

2022 high voltage electrician examination and high voltage electrician reexamination examination

2022 low voltage electrician examination and low voltage electrician simulation examination question bank

2022 safety officer-c certificate examination and safety officer-c certificate registration examination

2022 melting welding and thermal cutting examination materials and free melting welding and thermal cutting examination questions
随机推荐
[vulnhub shooting range] impulse: lupinone
Set, weakset, map, weakmap in ES6
同花顺开户注册安全靠谱吗?有没有风险的?
MySQL——索引
Single page application architecture
内存分析器 (MAT)
Is flush account opening and registration safe and reliable? Is there any risk?
如临现场的视觉感染力,NBA决赛直播还能这样看?
Refer to some books for the distinction between blocking, non blocking and synchronous asynchronous
Strange way of expressing integers (expanding Chinese remainder theorem)
treevalue——Master Nested Data Like Tensor
Discussion Net legacy application transformation
Read the root directory of the folder, write txt and generate random samples
Getting started with postman -- environment variables and global variables
Tidb's initial experience of ticdc6.0
The post-90s resigned and started a business, saying they would kill cloud database
TLS environment construction and plaintext analysis
Talk about daily newspaper design - how to write a daily newspaper and what is the use of a daily newspaper?
Interval product of zhinai sauce (prefix product + inverse element)
浅析 Ref-NeRF