<resultMap type="com.asiainfo.channel.model.weeklyNewspaper.WorkReportInfo" id="WorkReportInfoMap">
<result property="reportId" column="report_id" />
<result property="reportType" column="report_type" />
<result property="completeContent" column="complete_content" />
<result property="needComplete" column="need_complete" />
<result property="needHelp" column="need_help" />
<result property="beginDt" column="begin_dt" javaType="date" jdbcType="DATE"/>
<result property="endDt" column="end_dt" javaType="date" jdbcType="DATE"/>
<result property="createStaff" column="create_staff" />
<result property="createDt" column="createDt" javaType="date" jdbcType="DATE"/> <collection property="reportFileInfoList" ofType="com.asiainfo.channel.model.weeklyNewspaper.ReportFileInfo"
select="getReportFileInfoList" column="report_id">
</collection> <collection property="workReportSendListInfoList" ofType="com.asiainfo.channel.model.weeklyNewspaper.WorkReportSendListInfo"
select="getWorkReportSendListInfoList" column="report_id">
</collection> </resultMap> <!-- 查询工作报告详情 映射到内部集合 -->
<select id="queryworkReportDetail" parameterType="map" resultMap="WorkReportInfoMap">
select report_id ,
report_type ,
complete_content,
need_complete ,
need_help ,
begin_dt ,
end_dt ,
create_staff ,
create_dt
from work_report t
where 1=1
<include refid="queryWorkReportListCondition"/>
</select> <!-- 一对多映射使用的子查询 -->
<select id="getReportFileInfoList" parameterType="int" resultType="com.asiainfo.channel.model.weeklyNewspaper.ReportFileInfo">
select t.report_file_id,
t.report_id,
t.file_uuid,
t.file_name,
t.FILE_DIR,
t.FILE_TYPE,
t.FILE_POST_FIX
from report_file t
where t.report_id = #{reportId}
</select> <!-- 一对多映射使用的子查询 -->
<select id="getWorkReportSendListInfoList" parameterType="int" resultType="com.asiainfo.channel.model.weeklyNewspaper.WorkReportSendListInfo">
select send_id,
report_id,
receive_name,
receive_code,
receive_staff_id,
receive_mail,
receive_num
from work_report_send_list t
where t.report_id = #{reportId}
</select>

<sql id="queryWorkReportListCondition">
<!-- 类型 -->
<if test="workReportCycle != null and workReportCycle != '' ">
and t.REPORT_TYPE = #{workReportCycle}
</if>
<!-- 地区 -->
<if test="commonRegionId != null and commonRegionId != '' ">
and t.COMMON_REGION_ID IN (
select COMMON_REGION_ID from common_region
CONNECT BY PRIOR COMMON_REGION_ID=UP_REGION_ID
START WITH COMMON_REGION_ID=#{commonRegionId}
)
</if>
<!-- 开始时间 -->
<if test="beginDt != null and beginDt != '' ">
and t.BEGIN_DT &gt; to_date(#{beginDt},'yyyy-mm-dd hh24:mi:ss')
</if>
<!-- 截止时间 -->
<if test="endDt != null and endDt != '' ">
and t.BEGIN_DT &lt; to_date(#{endDt},'yyyy-mm-dd hh24:mi:ss')
</if> <!-- 人名 模糊查询 staffName -->
<if test="staffName != null and staffName != '' ">
and t.create_staff like concat(concat('%',#{staffName}),'%')
</if> <!-- 主键ID -->
<if test="reportId != null and reportId != '' ">
and t.report_id = #{reportId}
</if>
</sql>

mybatis整合oracle 实现一对多查询 备注?的更多相关文章

  1. mybatis的一对一,一对多查询,延迟加载,缓存介绍

    一对一查询 需求 查询订单信息关联查询用户信息 sql语句 /*通过orders关联查询用户使用user_id一个外键,只能关联查询出一条用户记录就可以使用内连接*/ SELECT orders.*, ...

  2. JAVAEE——Mybatis第二天:输入和输出映射、动态sql、关联查询、Mybatis整合spring、Mybatis逆向工程

    1. 学习计划 1.输入映射和输出映射 a) 输入参数映射 b) 返回值映射 2.动态sql a) If标签 b) Where标签 c) Sql片段 d) Foreach标签 3.关联查询 a) 一对 ...

  3. MyBatis动态条件、一对多、整合spring(二)

    输入映射和输出映射 Mapper.xml映射文件定义了操作数据库的sql,每一个sql是一个statement,映射文件是mybatis的核心. parameterType输入类型 1.传递简单类型 ...

  4. Mybatis oracle多表联合查询分页数据重复的问题

    Mybatis oracle多表联合查询分页数据重复的问题 多表联合查询分页获取数据时出现一个诡异的现象:数据总条数正确,但有些记录多了,有些记录却又少了甚至没了.针对这个问题找了好久,最后发现是由于 ...

  5. mybatis由浅入深day02_3一对多查询

    3 一对多查询 3.1 需求(查询订单及订单明细的信息) 查询订单及订单明细的信息. 3.2 sql语句 确定主查询表:订单表 确定关联查询表:订单明细表 在一对一查询基础上添加订单明细表关联即可. ...

  6. mybatis中实现一对一,一对多查询

    在实际的开发中我们经常用到的是一对一查询和一对多查询.而多对多的实现是通过中间来实现,这里就没有给出来了 比如: 订单和用户是一对一的关系(一个订单只能对应一个用户) 订单和订单明细是一对多的关系(一 ...

  7. mybatis 一对多查询 集合创建空对象的问题

    在做 mybatis 一对多查询的时候, resultMap 里面用到了集合标签 collection ,后来发现 当该条数据没有子集的时候, collection 会自动创建一个属性都是null的对 ...

  8. springboot整合mybatis连接oracle

    pom.xml: <!-- 链接:https://pan.baidu.com/s/1agHs5vWeXf90r3OEeVGniw 提取码:wsgm --> <dependency&g ...

  9. Mybatis一对多查询得不到多方结果

    一对多查询:一个年级对应多个学生,现在要查询年级(带学生)信息. 查询结果: [main] INFO com.java1234.service.GradeTest - 查询年级(带学生)[main] ...

随机推荐

  1. Java中的字符串拼接

    Java中的字符串拼接 1.设计源码 /** * @Title:IndexOf.java * @Package:com.you.freemarker.model * @Description: * @ ...

  2. hdu5945 Fxx and game

    单调队列学习 其实和单调栈类似 都是因为有些元素是没有价值的可以舍去 #include<bits/stdc++.h> using namespace std; #define sz(X) ...

  3. POI 的API大全二

    1.POI结构与常用类 (1)POI介绍 Apache POI是Apache软件基金会的开源项目,POI提供API给Java程序对Microsoft Office格式档案读和写的功能. .NET的开发 ...

  4. java查看程序执行时间

    public static void main(String[] args) { long a= System.currentTimeMillis();//获取当前系统时间(毫秒) for (int ...

  5. 【BZOJ4652】【NOI2016】循环之美(莫比乌斯反演,杜教筛)

    [BZOJ4652]循环之美(莫比乌斯反演,杜教筛) 题解 到底在求什么呢... 首先不管他\(K\)进制的问题啦,真是烦死啦 所以,相当于有一个分数\(\frac{i}{j}\) 因为值要不相等 所 ...

  6. 【CJOJ P1096】最佳老农

    http://oj.changjun.com.cn/problem/detail/pid/1096 Description FJ打算带着他可爱的N (1 ≤ N ≤ 2,000)头奶牛去参加" ...

  7. 剑指offer-(20)包含min函数的栈

    题目描述 定义栈的数据结构,请在该类型中实现一个能够得到栈最小元素的min函数. 题目分析 首先一开始我们分析得到最小值肯定要比较嘛,和栈里面的数据一一比较,但是栈这种数据结构,你又只能和栈顶弹出来的 ...

  8. golang goroutine的调度

    golang goroutine的调度 1.什么是协程? 协程是一种用户态的轻量级线程. 2.进程.线程.协程的关系和区别: * 进程拥有自己独立的堆和栈,既不共享堆,亦不共享栈,进程由操作系统调度. ...

  9. npm包管理器相关知识

    关于npm包安装命令的介绍,如下图:

  10. jquery 选择器 且 或

    jquery选择器具有很强大的功能,基本的使用方法随处可见,jquery还提供了更为方便的使用. 且:$("div[id^='AAA_']div[id$='_DIV']"),此选择 ...