<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. Windows控制台下绘制简单图形

    最近接触到一个很有意思的问题,如何在Windows控制台下画图,翻遍了C的头文件也没找到画图的函数,好吧,那就用Windows提供的API函数吧,看来想移植是没戏了.先画一个简单的图,类似心电图那种吧 ...

  2. An internal error occurred during: "Building workspace". GC overhead limit exceeded

    1 错误描述 2 错误原因 3 解决办法

  3. ORA-00922:选项缺失或无效

    1.错误描述    ORA-00922:选项缺失或无效 2.错误原因 3.解决办法

  4. SpringMVC_第一个程序

    一.基本代码的完成 补充 1.在myeclipse中 WEB-INF下放的资源和WebRoot下的资源区别: WEB-INF下放到资源是不能通过浏览器直接访问的,是比较安全的,只能是后台服务端程序进行 ...

  5. LinkedHashMap和HashMap

    1.HashMap: HashMap里面存入的键值对在取出的时候是随机的,是比较常用的Map.它根据key的HashCode值存储数据,根据key可以直接取出它的值(当然也有冲突的情况,不过遍历链表就 ...

  6. C#构造函数与析构函数--C#基础

    1.构造函数 1)构造函数没有返回值,也不能写void,必须是public 修饰符 2)构造函数和类名相同 3)构造函数也是可以重载的 public Clerk(string name,Gender ...

  7. [BZOJ2752][HAOI2012]高速公路

    BZOJ Luogu sol 看上去是道数学期望题但实际上是个傻逼数据结构 首先答案的形式应该就是 \[\frac{\mbox{[l,r]区间内的子区间权值之和}}{\mbox{[l,r]区间内的子区 ...

  8. C++对一组pair数据进行排序(sort函数的使用)

    最近在写一个算法的时候,把一些数据存在了pair中,并且需要根据pair中first或者second的值对这些数据进行排序.比如:输入数据(1,2).(4,2).(3,3).(2,1)根据first的 ...

  9. leetcode【14题】Longest Common Prefix

    题目:Longest Common Prefix 内容: Write a function to find the longest common prefix string amongst an ar ...

  10. Win10_x86_x64PE维护光盘——我用过最好用的PE

    先感谢hongxj和fish2006两位大大提供的PE. 先放出所有工具的下载地址: hongxj的PE:https://yunpan.cn/crAw6HS6ar9ck  访问密码 4a4e fish ...