Advertisement

mybatis对不同表的查询合并解决方案(不是多表查询)

阅读量:

在实际应用过程中,该技术方案涉及到了union这一关键操作。

复制代码
 ​

    
 	<select id="getDiseManageList" parameterType="map" resultType="DiseManageList">
    
 		select t.* from (select null type,
    
 		       null her_id,
    
 		       null visit_id,
    
 		       null visit_date,
    
 		       null visit_code,
    
 		       null visit_name,
    
 		       null org_id,
    
 		       null org_name,
    
 		       null doc_id,
    
 		       null doc_name
    
 		  from dual
    
 		 where 1 = 2
    
 		<if test="type == null or type =='' or type ==2">
    
 			union
    
 			select '2' type,
    
 			       t1.he

全部评论 (0)

还没有任何评论哟~