-
java中EQ、NE、GT、LT、GE、LE分别代表含义
IS_NOT_NULL | 不等于NULL |
EQ | 等于 |
NE | 不等于 |
GT | 大于 |
LT | 小于 |
GE | 大于等于 |
LE | 小于等于 |
IS_NULL | 等于NULL |
-
mybatis 中 SQL 写在mapper.xml文件中,而xml解析 < 、>、<=、>= 时会出错,这时应该使用转义写法。有两种解决方法:
方法一:
< | <= | > | >= | & | ' | " |
< | <= | > | >= | & | ' | " |
方法二:
<![CDATA[ sql语句 ]]>
示例:
num <![CDATA[ >= ]]> #{num}
-
日期格式化常用方法
SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss:ss");
System.out.println(dateFormat.format(new Date()));
-
日期加减一天
//日历工具类 ,创建Calendar 的实例
Calendar calendar = Calendar.getInstance();
//给日历类初始化日期
calendar.setTime(new Date());
//当前时间减去一天,即一天前的时间
calendar.add(Calendar.DAY_OF_MONTH,-1);
-
JSON的数据格式转为实体类
//创建实体
Entity entity= new Entity ();
//创建字符串
String str = "";
//转换成VbaizhaLog
entity= JSON.parseObject(str, entity.class);
-
定时任务注解
@Configuration
@EnableScheduling
@Service
public class TestService {
// 每5分钟调用一次
@Scheduled(cron = "0 */5 * * * ?")
public String test1() {
System.out.println("调用信息");
}
}