How to receive the statistical data of group query in xml

Insert picture description here
Receive the result in xml:

1. Encapsulate entity classes

package org.skyviewpacs.model.pojo.localMaster;

public class QueueCountVo {
    
    
	
	private int resCount;//登记人数
	
	private int queueCount;//排队人数
	
	private String room;//房间名

	public int getResCount() {
    
    
		return resCount;
	}

	public void setResCount(int resCount) {
    
    
		this.resCount = resCount;
	}

	public int getQueueCount() {
    
    
		return queueCount;
	}

	public void setQueueCount(int queueCount) {
    
    
		this.queueCount = queueCount;
	}

	public String getRoom() {
    
    
		return room;
	}

	public void setRoom(String room) {
    
    
		this.room = room;
	}

	

}

  1. Add the following configuration
 <resultMap id="QueueCountVo"  type="org.skyviewpacs.model.pojo.localMaster.QueueCountVo">
    
    <id property="resCount" column="resCount" />  //为实体类中属性
     <id property="queueCount" column="queueCount" />
    <id property="room" column="room" />
        
  </resultMap>

3. Receiving the result set: (1) resultMap="QueueCountVo"
(2) RI_RoomName as room, COUNT(DISTINCT R_Number) as resCount


	 <select id="getResCount"  resultMap="QueueCountVo">
		select RI_RoomName as room, COUNT(DISTINCT R_Number) as resCount  from VUSAllFlat
		where R_SPSSD &gt;= #{
    
    start} and R_SPSSD &lt;= #{
    
    end} and R_Delete_Flag=0 and R_Arrival_State=1  and R_Modality=#{
    
    modality}
		
		  <if test="rNoonType !=null and rNoonType !=''">
		 and R_Noon_Type in (${
    
    rNoonType} )
		</if> 
		
		<if test="riRoomname !=null and riRoomname !=''">
		 and RI_RoomName in (${
    
    riRoomname} )
		</if> 
		
		GROUP BY RI_RoomName  
	
	</select> 

Guess you like

Origin blog.csdn.net/weixin_44215804/article/details/109530959