<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.inspur.analysis.tool.ontology.linkType.dao.LinkTypeMapper"> <resultMap type="com.inspur.analysis.tool.ontology.linkType.data.LinkType" id="linkType">
<id property="linkUri" column="LINK_URI"/>
<result property="uriHash" column="URI_HASH"/>
<result property="baseTypeUri" column="BASE_TYPE_URI"/>
<result property="linkLabel" column="LINK_LABEL"/>
<result property="isAsymmetrical" column="IS_ASYMMETRICAL"/>
<result property="aliase" column="ALIASE"/>
<result property="pcName" column="P_C_NAME"/>
<result property="pcAliase" column="P_C_ALIASE"/>
<result property="cpName" column="C_P_NAME"/>
<result property="cpAliase" column="C_P_ALIASE"/>
<result property="detailIconUri" column="DETAIL_ICON_URI"/>
<result property="detailIcon" column="DETAIL_ICON"/>
<result property="edgeIconUri" column="EDGE_ICON_URI"/>
<result property="edgeIcon" column="EDGE_ICON"/>
<result property="isSys" column="IS_SYS"/>
<result property="note" column="NOTE"/>
<result property="creatorId" column="CREATOR_ID"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="editorId" column="EDITOR_ID"/>
<result property="editTime" column="EDIT_TIME"/>
<result property="scn" column="SCN"/>
</resultMap> <select id="existLinkTypeUri" parameterType="String"
resultMap="linkType">
SELECT * FROM OD_LINK_TYPE
WHERE LINK_URI = #{linkUri}
</select> <select id="isRootLinkType" parameterType="String"
resultType="int">
SELECT EXISTS(SELECT LINK_URI FROM OD_LINK_TYPE
WHERE LINK_URI=BASE_TYPE_URI AND LINK_URI=#{linkUri})
</select> <select id="deleteRootLinkType" parameterType="String">
DELETE FROM OD_LINK_TYPE WHERE BASE_TYPE_URI=#{baseTypeUri}
</select> <select id="getRootLinkTypeList" resultMap="linkType">
SELECT * FROM OD_LINK_TYPE
WHERE LINK_URI = BASE_TYPE_URI
</select> <select id="getAllLinkTypeListByParent" parameterType="java.util.Map"
resultMap="linkType">
SELECT * FROM OD_LINK_TYPE
<where>
LINK_URI != BASE_TYPE_URI
<if test="baseTypeUri != null">
AND BASE_TYPE_URI=#{baseTypeUri}
</if>
</where>
<if test="orderfield != null" >
ORDER BY
<choose>
<when test="orderfield == 'linkUri'">
LINK_URI ${orderdir}
</when>
<when test="orderfield == 'linkLabel'">
LINK_LABEL ${orderdir}
</when>
<otherwise>
BASE_TYPE_URI ${orderdir}
</otherwise>
</choose>
</if>
</select> <select id="getLinkTypeListByCondition" parameterType="java.util.Map" resultMap="linkType">
SELECT * FROM OD_LINK_TYPE
<where>
LINK_URI != BASE_TYPE_URI
<if test="linkUri != null">
AND LINK_URI LIKE '%${linkUri}%'
</if>
<if test="linkLabel != null">
AND LINK_LABEL LIKE '%${linkLabel}%'
</if>
<if test="baseTypeUri != null">
AND BASE_TYPE_URI=#{baseTypeUri}
</if>
</where>
<if test="orderfield != null" >
ORDER BY
<choose>
<when test="orderfield == 'linkUri'">
LINK_URI ${orderdir}
</when>
<when test="orderfield == 'linkLabel'">
LINK_LABEL ${orderdir}
</when>
<otherwise>
BASE_TYPE_URI ${orderdir}
</otherwise>
</choose>
</if>
</select> </mapper>

MyBatis基本查询、条件查询、查询排序的更多相关文章

  1. 指定查询条件,查询对应的集合List(单表)

    TestDao.java(测试类) @Test public void findCollectionByConditionNoPage(){  ApplicationContext ac = new ...

  2. SolrJ查询条件组合查询实现——(十六)

    带查询条件的实现原理: 查询按钮被包在一个大表单,表单还有三个隐藏域,一个商品筛选,一个 价格,一个排序,每次点击查询时候清空三个隐藏域,就带着一个大条件去查询;点击下面的筛选条件时,给隐藏域的筛选条 ...

  3. jeecg 扩展封装查询条件 时间段查询

    使用jeecg框架开发的小伙伴们知道,添加查询条件,通常是我们加一个配置(query="true")就可以将该字段设置为查询条件.简单方便.但是这样的配置查询条件仅适用于输入框输入 ...

  4. 3. 如何封装查询条件与查询结果到map中

    public Map<String, Object> queryOrderStatus(String orderNo) { // 查询到的结果与查询的条件一一对应,封装到map中! Str ...

  5. 【mysql】 mybatis实现 主从表 left join 1:n 一对多 分页查询 主表从表都有查询条件 【mybatis】count 统计+JSON查询

    mybatis实现 主从表 left join  1:n 一对多 分页查询   主表从表都有查询条件+count 需求: ======================================= ...

  6. JPA实现复杂条件分页查询

    相信熟悉Hibernate的人对于ORM给编程带来的便利于快捷一定不陌生,相对于MyBatis等需要编写复杂的SQL语句,ORM映射为我们带来的便利显而易见.但是,在获得便利的同时,失去的便是灵活性, ...

  7. mybatis配合pagehelper分页助手查询

    Maven: 参考: springBoot2.x整合pagehelper5.1.2:https://blog.csdn.net/Carlson_Chis/article/details/8563748 ...

  8. Mybatis的插件 PageHelper 分页查询使用方法

    参考:https://blog.csdn.net/ckc_666/article/details/79257028 Mybatis的一个插件,PageHelper,非常方便mybatis分页查询,国内 ...

  9. eas之EntityViewInfo对象mainQuery中查询条件

    EntityViewInfo对象mainQuery中查询条件:  添加查询字段:(Sql语句中的selectz子句内容)    SelecttorItemCollection sic=new Sele ...

  10. mysql连表操作是先连表还是先查询条件

    mysql连表操作是先连表还是先查询条件 一.总结 一句话总结: 连表操作时:先根据查询条件和查询字段确定驱动表,确定驱动表之后就可以开始连表操作了,然后再在缓存结果中根据查询条件找符合条件的数据 1 ...

随机推荐

  1. CodeForces - 794C:Naming Company(博弈&简单贪心)

    Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little thi ...

  2. HihoCoder1337 动态第k大(treap)

    描述 小Ho:小Hi,之前你不是讲过Splay和Treap么,那么还有没有更简单的平衡树呢? 小Hi:但是Splay和Treap不是已经很简单了么? 小Ho:是这样没错啦,但是Splay和Treap和 ...

  3. mybatis与oracle使用总结

    Oracle使用总结 1.新建表删除表 新建表语句: CREATE TABLE +表名{ } create table AFA_USER ( USER_ID VARCHAR2() not null, ...

  4. POJ1733:Parity game

    浅谈并查集:https://www.cnblogs.com/AKMer/p/10360090.html 题目传送门:http://poj.org/problem?id=1733 带权并查集裸题.区间和 ...

  5. 解决方案: the selected file is a solution file but was created by a newer version of this application and cannot be opened

    最近在用IronGithub访问Github api时遇到一个问题: the selected file is a solution file but was created by a newer v ...

  6. UEditor富文本编辑器的图片上传 http://fex.baidu.com/ueditor/#server-deploy

    http://fex.baidu.com/ueditor/#server-deploy http://fex.baidu.com/ueditor/#server-path 首先 editor配置文件中 ...

  7. (转)nodejs搭建本地http服务器

    本文转载自:http://www.cnblogs.com/shawn-xie/archive/2013/06/06/3121173.html 由于不做php相关的东西,懒得装apache,干脆利用no ...

  8. Oracle 数据库迁移到MySQL (kettle,navicate,sql developer等工具

    Oracle 数据库迁移到MySQL (kettle,navicate,sql developer等工具 1 kettle --第一次使用kettle玩迁移,有什么不足之处和建议,请大家指正和建议. ...

  9. Rails:Rails使用sqlite3数据库 及数据操作基本命令

    Rails默认使用sqlite3做为数据库,虽然很多人更喜欢mysql.但如果是学习用,sqlite3够了,因为它轻量,不需要安装. 首先对sqlite3做个简短的介绍:1.sqlite3不需要配置, ...

  10. .netcore 在linux 上运行 Helllo World 例子

    要想在linux上运行netcore ,需要在linux 安装netcore SKD 下面分两步完成, 首先我的操作系统是 Ubuntu 14.04 ,不同版本可以参考 官网给出的连接 https:/ ...