问个ibatis的查询配置文件条件怎么写

来源:百度知道 编辑:UC知道 时间:2024/05/17 16:56:06
select bassto ,count(bassto) from
(select distinct id,bassto from so where begintime>=#begintime# and endtime <=#endtime#) as tocx
group by bassto

sql语句如上,但是在(select distinct id,bassto from so where begintime>=#begintime# and endtime <=#endtime#)
中的where子句中还有些动态的查询条件不知道怎么去添加,数据库是DB2,请有经验的人给个例子,谢谢了

用abator直接生成啊
可以省去很多麻烦
不过有些还是要手动写的
下面是一个例子
<select id="abatorgenerated_selectByExample" resultMap="abatorgenerated_UsersResult" parameterClass="java.util.Map">
<!--
WARNING - This element is automatically generated by Abator for iBATIS, do not modify.
This element was generated on Mon Apr 23 13:27:30 CST 2007.
-->
select top $pagesize$ users.usersid,
users.username,
users.schoolid,
users.passwords,
users.rcode,
users.ctime,
users.ftime,
users.other1,
users.other2,
users.other3,
users.other4,
users.other5,
users.other6,
users.other7,
users.other8,
users.other9,
users.other10
from users
where users.schoolid=#schoolid# and users.rcode <![CDATA[ <> ]]>'admin