Mybatis的幾種用法
1. 在mapper.xml中添加參數。如在以下的應用中
例如:統計大於某個時間段的交易異常
代碼如下:
在mapper.xml文件中,可以這樣使用常量中的參數
代碼如下:
select o.id, o.price, o.pStatus from tblOrders as o where o.wdate > '${@com.bns.sp.Constants@ABNORMAL_ORDER_TIME}' and (o.pStatus = 1 or (o.Status = 1 and datediff(n,o.wdate,getdate()) > 15)) |