<?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. 20181229模拟 T1 palindrome

    20181229模拟 T1 palindrome 题意 : \(S\)是字符串\(s\)的子串可重集,求\(\sum\limits_{x\in S}\sum\limits_{y\in S}(|x|+| ...

  2. java 简单实现socket

    server端 package socket; import java.io.BufferedReader; import java.io.IOException; import java.io.In ...

  3. walle代码发布系统配置

    walle Walle 一个web部署系统工具,配置简单.功能完善.界面流畅.开箱即用! 支持git.svn版本管理,支持各种web代码发布, PHP,Python,JAVA等代码的发布.回滚,可以通 ...

  4. Azure CLI的版本问题

    Azure支持多种管理方法.命令行方法有: PowerShell,PowerShell只能运行在Windows上 Azure CLI,而Azure CLI可以运行在Windows.MAC以及Linux ...

  5. openwrt: Makefile 框架分析[转载]

    openwrt目录结构 上图是openwrt目录结构,其中第一行是原始目录,第二行是编译过程中生成的目录.各目录的作用是: tools - 编译时需要一些工具, tools里包含了获取和编译这些工具的 ...

  6. 机器学习:集成学习(Soft Voting Classifier)

    一.Hard Voting 与 Soft Voting 的对比 1)使用方式 voting = 'hard':表示最终决策方式为 Hard Voting Classifier: voting = 's ...

  7. 机器学习:PCA(使用梯度上升法求解数据主成分 Ⅰ )

    一.目标函数的梯度求解公式 PCA 降维的具体实现,转变为: 方案:梯度上升法优化效用函数,找到其最大值时对应的主成分 w : 效用函数中,向量 w 是变量: 在最终要求取降维后的数据集时,w 是参数 ...

  8. MySQL导入MongoDB

    一.MongoDB的导入导出 mongoDB的导入导出,分为mongoDB官方提供的工具类,和第三方的工具类.下面依次介绍下: 1.1.mongoDB提供的工具 1.1.1.mongoimport工具 ...

  9. UML关系说明文档

    http://blog.csdn.net/suxinpingtao51/article/details/8011335/

  10. 11-03SQLserver基础--子查询语句

    一.子查询--查询的嵌套(重点记忆) select MAX(age)from haha where bumen='销售部' --汇总-- select MAX(age)from haha where  ...