java 访问 domino数据库 怎么设置查询条件

java 访问 domino数据库 怎么设置查询条件,第1张

建议如下 *** 作

1、定位如果连接domino,比如diiop连接的方式

2、能直接访问连接domino后,就可以做查询了

比如,你有当前登陆用户(username="张三")为条件,查询当前用户在待办库(待办库:daiban.nsf)中的的所有待办工单(state="1"代表待办状态)(待办表单form="dbgd")。

1>那你可以建一个视图,搜索条件为:select form = "dbgd" &state = "1"

命名视图名为"chaxun1",这样你就建好了你要搜索的视图了。

2>在java中写代码咯~~

比如:

(以通过用户名密码进入取得session)

Database db = null

Documentcollection dc = null//文档集

Document doc = null

View view = null

db = session.getdatabase("domion服务器ip","baiban.nsf")

view = db.getview("chaxun1")

dc = view.getAllDocumentsByKey(doc.getItemValueString("张三")

if (dc.getCount()>0) {

for(int i=0i<dc.getCount()i++){

doc = dc.getNthDocument(i+1)

// ...取到文档,你还不会处理么- -》》》?

}

}

我只能帮到这里了。另外附上diiop配置和一则java代理的用例的链接(本人博客非广告)。你可以参考下。(去除“度娘防吞”中文字即可)

还有什么不明白可以在我博客留言或私信我(我不是每天上百度知道,不一定马上看到)。

用例:

h度ttp娘:/防/g5dfire.sy吞nology.me:度8888娘/blo防g/#para吞m=id_29

DIIOP配置:

h度ttp娘://防g5dfire.sy吞nology.me:8度888/bl娘og/#pa防ram=吞id_26

把你的条件添加到select语句后面,然后传下去,例如:

<!-- 旅行社详情 -->

<resultMap type="com.demo.teacher"   id="teacherMap">

    <id property="teacherId" column="teacher_id"/>

    <result property="teacherName" column="teacher_name"/>

    <!--注意下面这个声明,只有column-->

    <result column="age"/>

    <collection property="student" column="{teacherId=teacher_id,age=age}" ofType="java.util.Map"  select="studentMap">

        <id property="studentId" column="student_id" />

        <result property="studentName" column="student_name"/>

        <result property="studentAge" column="student_age"/>

    </collection>

</resultMap>

<!--主-->

<select id="getTeacher" parameterType="java.util.Map" resultMap="teacherMap">

    select 

        teacher_id,

        teacher_name,

        #{age} as age <!--把你的参数这样写-->

    from 

        teachers

    where

        teacher_name = '大西瓜'

</select> <!--从-->

<select id="studentMap" parameterType="java.util.Map" resultType="java.util.Map">

    select 

        student_id,

        student_name,

        student_age

    from 

        students

    where

        teacher_id = #{teacherId}

    and

        age > #{age} <!--这两个参数是resultMap中column指定的key-->

</select>

<!--mybatis的一对多级联查询多方的参数只能是一方的column,所以你要想办法把你的参数做成column-->


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11628976.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-17
下一篇2023-05-17

发表评论

登录后才能评论

评论列表(0条)

    保存