date类型转string类型:
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
java.util.Date beginDate=mdaSubsidies.getBeginDate();
String begintime=sdf.format(beginDate);
System.out.println("begintime:"+begintime);
在pl/sql里
SELECT a.id AS "id", a.begin_date AS "beginDate" FROM mda_subsidies a WHERE a.begin_date=TO_DATE('2017/10/29 10:32:47','YYYY-MM-DD HH24:MI:SS')
需要进行to_date转换。
而在dao.xml代码里
<if test="beginDate != null and beginDate != '' > and a.begin_date=#{beginDate} </if>
a.begin_date和beginDate都是date类型,则不需要to_date转换。