string转date(手动输入)
//日期在lowDate和heightDate之间 //创建SimpleDateFormat,并设置格式 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); //lowDate String lowDat = "2020-08-10"; Date lowDate = sdf.parse(lowDat); //heightDate String heightDat = "2020-08-31"; Date heightDate = sdf.parse(heightDat); //封装 goodsCondition.setLowDate(lowDate); goodsCondition.setHeightDate(heightDate);
在log4j中的sql:
DEBUG [main] - ==> Preparing: select * from t_goods WHERE gdate between ? and ? DEBUG [main] - ==> Parameters: 2020-08-10 00:00:00.0(Timestamp), 2020-08-31 00:00:00.0(Timestamp)