- 博客(13)
- 收藏
- 关注
原创 JAVA中如何判断一个数组或者字符串是否为空
int [] array 数组为空的条件: if( arraynull||array.length0) String str 字符串为空的条件: if(str == null || str.length() == 0); s==null是有必要存在的。 1 如果想调用一个方法,首先要有一个对象,但是null并不是一个对象,内存中都没有它的空间,所以null是不能够调用String中的方法的,i...
2018-12-28 11:05:36
2551
原创 java判断集合list是否为空]
java判断集合list是否为空] 一种为: if(list!=null && list.size()>=0){ //判断list是否为空,且list集合中包含的元素个数小于等于0个 } isEmpty()判断list集合有没有元素,如果有元素返回false,没有返回true 一种为: if(list.isEmpty()){//如果为空,则返回null return null...
2018-12-28 11:04:44
1839
原创 Spring事务管理以及对属性的详细讲解
1.Spring事务管理概述 —————————————————— Spring事务管理分为编程式事务管理和声明式事务管理两种。 编程式事务允许用户在实现代码中使用显式的方式调用beginTransaction()开启事务、commit()提交事务、rollback()回滚事务,从而可以达到精确定义事务的边界。 声明式事务管理底层是建立在Spring AOP的基础上,在方式执行前后进行拦截,并在目...
2018-10-12 17:53:43
432
原创 mybatis批量软删除带时间
update renyuan_tijianjilubiao shanChuBiaoZhi = 0, when id=#{item.id} then #{item.shanChuShiJian} ...
2018-10-01 00:48:06
1532
原创 MyBatis分页插件PageHelper的用法
好多天没写博客了,因为最近在实习,大部分时间在熟悉实习相关的东西,也没有怎么学习新的东西,这周末学习了MyBatis的一个分页插件PageHelper,虽然没有那么的强大(我在最后会说明它的缺点),但还是挺不错的。这篇博文主要来总结下如何使用PageHelper。 我们知道,在mysql中,分页的sql是使用limit来做,如果我们自己写sql,那分页肯定是没有任何问题的。但是一旦model多...
2018-09-29 23:42:26
289
1
原创 MySQL 的IFNULL()函数的作用
在使用left join等联表查询时,常遇到某些字段为null,一般都在后台语言使用if (a==null) 判断做处理,其实MySQL本身也有一个IFNULL函数可以处理。同时我们也来说说ISNULL()和NULLIF()函数。 一、IFNULL(expr1,expr2)用法 假如expr1不为NULL,则 IFNULL() 的返回值为expr1; 否则其返回值为 expr2。IFNULL()的...
2018-09-29 23:18:28
2685
原创 concat函数的介绍及mybatis 中模糊查询
有的时候,我们有需要将由不同地方获得的字符串拼接在一起。 如:在很多时候,我们需要模糊查询 like, 对于mysql 的 like 而言,一般都要用 like concat() 组合,可以防止sql注入。 在mybatis 中就可以这么写: select * from region A where A.region_name like concat( '%' , '#{region_nam...
2018-09-29 23:11:07
3339
原创 MyBatis动态SQL之<choose><when><otherwise>标签的作用及使用
需求:查询的时候,带了带了哪个条件就用哪个条件进行查询 类似于Java 的 switch 语句的作用,其中只有一个判断满足条件。 可以通过标签实现: —————————————————————————————— <select id="getPerson" resultType="com.fzx.bean.Employee"> select * from PERSON...
2018-09-29 23:04:36
3285
2
原创 json.parsearray的作用和使用
1.这个方法的作用就是将json格式的数据转换成数组格式。 2.,假设有User这个类,有json类型数据str=str = [{“name”:“张三”,“age”:“1”},{“name”:“李四”,“age”:“4”}],那么 List listt = json.parseArray(str, User.class);listt就可以接收str了, ...
2018-09-29 16:54:53
4887
原创 Mysql批量删除数据
update renyuan_gongzuojinglibiao shanChuBiaoZhi = 0, when id=#{item.id} then #{item.shanChuShiJian} where id in #{item.id} ------------------------------------------------------------------...
2018-09-29 13:06:37
2738
原创 No bean named 'shiroFilter' is defined
问题:Spring在集成shiro,在启动时,报org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘shiroFilter’ is defined 解决方法: 1)首先要确保applicationContext-shiro.xml文件中的ShiroFilterFactoryBean 的id属...
2018-09-27 21:37:53
2888
原创 文件下载
文件下载 public static HttpServletResponse download(String path, HttpServletResponse response) { try { // path是指欲下载的文件的路径。 File file = new File(path); // 取得文件名。 String filename = f...
2018-09-27 12:06:23
167
原创 spring mvc 报 500[Circular view path [refundbbb]: would dispatch back to the current handler URL
[Circular view path [refundbbb]: would dispatch back to the current handler URL [/refundbbb] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default...
2018-09-23 10:53:34
427
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅